mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
(MESS) - N64: Improve blender performance. [MooglyGuy]
This commit is contained in:
parent
c839959541
commit
c6db5abc81
@ -2005,7 +2005,7 @@ void n64_rdp::DrawTriangle(bool shade, bool texture, bool zbuffer, bool rect)
|
||||
SpanBase.m_span_dw = dwdx;
|
||||
SpanBase.m_span_dz = OtherModes.z_source_sel ? 0 : dzdx;
|
||||
SpanBase.m_span_dymax = 0;
|
||||
SpanBase.m_span_dzpix = NormalizeDZPix(temp_dzpix & 0xffff) & 0xffff;
|
||||
SpanBase.m_span_dzpix = m_dzpix_normalize[temp_dzpix & 0xffff];
|
||||
|
||||
int xleft_inc = (dxmdy >> 2) & ~1;
|
||||
int xright_inc = (dxhdy >> 2) & ~1;
|
||||
@ -2694,6 +2694,7 @@ void n64_rdp::CmdSetOtherModes(UINT32 w1, UINT32 w2)
|
||||
OtherModes.blend_m2b_0 = (w2 >> 18) & 0x3; // 00
|
||||
OtherModes.blend_m2b_1 = (w2 >> 16) & 0x3; // 01
|
||||
OtherModes.force_blend = (w2 >> 14) & 1; // 0
|
||||
OtherModes.blend_shift = OtherModes.force_blend ? 5 : 2;
|
||||
OtherModes.alpha_cvg_select = (w2 >> 13) & 1; // 1
|
||||
OtherModes.cvg_times_alpha = (w2 >> 12) & 1; // 0
|
||||
OtherModes.z_mode = (w2 >> 10) & 0x3; // 00
|
||||
@ -2706,6 +2707,7 @@ void n64_rdp::CmdSetOtherModes(UINT32 w1, UINT32 w2)
|
||||
OtherModes.z_source_sel = (w2 >> 2) & 1; // 0
|
||||
OtherModes.dither_alpha_en = (w2 >> 1) & 1; // 0
|
||||
OtherModes.alpha_compare_en = (w2) & 1; // 0
|
||||
OtherModes.alpha_dither_mode = (OtherModes.alpha_compare_en << 1) | OtherModes.dither_alpha_en;
|
||||
}
|
||||
|
||||
void n64_rdp::CmdLoadTLUT(UINT32 w1, UINT32 w2)
|
||||
@ -3486,6 +3488,11 @@ n64_rdp::n64_rdp(n64_state &state) : poly_manager<UINT32, rdp_poly_state, 8, 320
|
||||
{
|
||||
ReplicatedRGBA[i] = (i << 3) | ((i >> 2) & 7);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 0x10000; i++)
|
||||
{
|
||||
m_dzpix_normalize[i] = (UINT16)NormalizeDZPix(i & 0xffff);
|
||||
}
|
||||
}
|
||||
|
||||
void n64_state::video_start()
|
||||
|
@ -288,7 +288,8 @@ struct OtherModesT
|
||||
int blend_m2b_0;
|
||||
int blend_m2b_1;
|
||||
int tex_edge;
|
||||
bool force_blend;
|
||||
int force_blend;
|
||||
int blend_shift;
|
||||
bool alpha_cvg_select;
|
||||
bool cvg_times_alpha;
|
||||
int z_mode;
|
||||
@ -299,8 +300,9 @@ struct OtherModesT
|
||||
bool z_compare_en;
|
||||
bool antialias_en;
|
||||
bool z_source_sel;
|
||||
bool dither_alpha_en;
|
||||
bool alpha_compare_en;
|
||||
int dither_alpha_en;
|
||||
int alpha_compare_en;
|
||||
int alpha_dither_mode;
|
||||
};
|
||||
|
||||
struct ColorInputsT
|
||||
@ -591,6 +593,8 @@ class n64_rdp : public poly_manager<UINT32, rdp_poly_state, 8, 32000>
|
||||
|
||||
UINT8 ReplicatedRGBA[32];
|
||||
|
||||
UINT16 m_dzpix_normalize[0x10000];
|
||||
|
||||
Rectangle Scissor;
|
||||
SpanBaseT SpanBase;
|
||||
|
||||
@ -668,9 +672,9 @@ class n64_rdp : public poly_manager<UINT32, rdp_poly_state, 8, 32000>
|
||||
Copier _Copy[2];
|
||||
Filler _Fill[2];
|
||||
|
||||
void write_pixel(UINT32 curpixel, UINT32 r, UINT32 g, UINT32 b, rdp_span_aux *userdata, const rdp_poly_state &object);
|
||||
void write_pixel(UINT32 curpixel, INT32 r, INT32 g, INT32 b, rdp_span_aux *userdata, const rdp_poly_state &object);
|
||||
void read_pixel(UINT32 curpixel, rdp_span_aux *userdata, const rdp_poly_state &object);
|
||||
void copy_pixel(UINT32 curpixel, UINT32 r, UINT32 g, UINT32 b, int CurrentPixCvg, const rdp_poly_state &object);
|
||||
void copy_pixel(UINT32 curpixel, INT32 r, INT32 g, INT32 b, int CurrentPixCvg, const rdp_poly_state &object);
|
||||
void fill_pixel(UINT32 curpixel, const rdp_poly_state &object);
|
||||
|
||||
class ZDecompressEntry
|
||||
|
@ -38,310 +38,485 @@ N64BlenderT::N64BlenderT()
|
||||
blend2[6] = &N64BlenderT::Blend2CycleBlendACVGNoDither;
|
||||
blend2[7] = &N64BlenderT::Blend2CycleBlendACVGDither;
|
||||
|
||||
cycle0[0] = &N64BlenderT::BlendEquationCycle0NoForceNoSpecial;
|
||||
cycle0[1] = &N64BlenderT::BlendEquationCycle0NoForceSpecial;
|
||||
cycle0[2] = &N64BlenderT::BlendEquationCycle0ForceNoSpecial;
|
||||
cycle0[3] = &N64BlenderT::BlendEquationCycle0ForceSpecial;
|
||||
|
||||
cycle1[0] = &N64BlenderT::BlendEquationCycle1NoForceNoSpecial;
|
||||
cycle1[1] = &N64BlenderT::BlendEquationCycle1NoForceSpecial;
|
||||
cycle1[2] = &N64BlenderT::BlendEquationCycle1ForceNoSpecial;
|
||||
cycle1[3] = &N64BlenderT::BlendEquationCycle1ForceSpecial;
|
||||
|
||||
compare[0] = &N64BlenderT::AlphaCompareNone;
|
||||
compare[1] = &N64BlenderT::AlphaCompareNone;
|
||||
compare[2] = &N64BlenderT::AlphaCompareNoDither;
|
||||
compare[3] = &N64BlenderT::AlphaCompareDither;
|
||||
for (int value = 0; value < 256; value++)
|
||||
{
|
||||
for (int dither = 0; dither < 8; dither++)
|
||||
{
|
||||
m_color_dither[(value << 3) | dither] = (UINT8)dither_color(value, dither);
|
||||
m_alpha_dither[(value << 3) | dither] = (UINT8)dither_alpha(value, dither);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleNoBlendNoACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
INT32 N64BlenderT::dither_alpha(INT32 alpha, INT32 dither)
|
||||
{
|
||||
DITHER_A(userdata->PixelColor.i.a, adseed);
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
TEST_REJECT();
|
||||
WRITE_OUT_NB_ND(0);
|
||||
|
||||
return true;
|
||||
return min(alpha + dither, 0xff);
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleNoBlendNoACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
INT32 N64BlenderT::dither_color(INT32 color, INT32 dither)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->PixelColor.i.a, adseed);
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
TEST_REJECT();
|
||||
ASSIGN_OUT(0);
|
||||
DITHER_RGB(dith);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
if ((color & 7) > dither)
|
||||
{
|
||||
color = (color & 0xf8) + 8;
|
||||
if (color > 247)
|
||||
{
|
||||
color = 255;
|
||||
}
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleNoBlendACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
WRITE_OUT_NB_ND(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleNoBlendACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
ASSIGN_OUT(0);
|
||||
DITHER_RGB(dith);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleBlendNoACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->PixelColor.i.a, adseed);
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 1);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleBlendNoACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->PixelColor.i.a, adseed);
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 1);
|
||||
DITHER_RGB(dith);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleBlendACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 1);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleBlendACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 1);
|
||||
DITHER_RGB(dith);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleNoBlendNoACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->PixelColor.i.a, adseed);
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 0);
|
||||
WRITE_BLENDED_COLOR();
|
||||
WRITE_OUT_NB_ND(1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleNoBlendNoACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->PixelColor.i.a, adseed);
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 0);
|
||||
WRITE_BLENDED_COLOR();
|
||||
ASSIGN_OUT(1);
|
||||
DITHER_RGB(dith);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleNoBlendACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 0);
|
||||
WRITE_BLENDED_COLOR();
|
||||
WRITE_OUT_NB_ND(1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleNoBlendACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 0);
|
||||
WRITE_BLENDED_COLOR();
|
||||
ASSIGN_OUT(1);
|
||||
DITHER_RGB(dith);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleBlendNoACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->PixelColor.i.a, adseed);
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 0);
|
||||
WRITE_BLENDED_COLOR();
|
||||
BLEND_CYCLE(1, 1);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleBlendNoACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->PixelColor.i.a, adseed);
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 0);
|
||||
WRITE_BLENDED_COLOR();
|
||||
BLEND_CYCLE(1, 1);
|
||||
DITHER_RGB(dith);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleBlendACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 0);
|
||||
WRITE_BLENDED_COLOR();
|
||||
BLEND_CYCLE(1, 1);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleBlendACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
DITHER_A(userdata->ShadeColor.i.a, adseed);
|
||||
|
||||
TEST_REJECT();
|
||||
BLEND_CYCLE(0, 0);
|
||||
WRITE_BLENDED_COLOR();
|
||||
BLEND_CYCLE(1, 1);
|
||||
DITHER_RGB(dith);
|
||||
WRITE_OUT();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define BLEND_PIPE(cycle, special, sum, shift) \
|
||||
BLEND_FACTORS(cycle, special, sum); \
|
||||
BLEND_MUL(cycle); \
|
||||
BLEND_ADD(cycle, special); \
|
||||
BLEND_SHIFT(shift); \
|
||||
BLEND_SCALE_CLAMP(sum);
|
||||
|
||||
void N64BlenderT::BlendEquationCycle0NoForceNoSpecial(int* r, int* g, int* b, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
BLEND_PIPE(0, 0, 1, 2);
|
||||
}
|
||||
|
||||
void N64BlenderT::BlendEquationCycle0NoForceSpecial(int* r, int* g, int* b, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
BLEND_PIPE(0, 1, 1, 2);
|
||||
}
|
||||
|
||||
void N64BlenderT::BlendEquationCycle0ForceNoSpecial(int* r, int* g, int* b, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
BLEND_PIPE(0, 0, 0, 5);
|
||||
}
|
||||
|
||||
void N64BlenderT::BlendEquationCycle0ForceSpecial(int* r, int* g, int* b, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
BLEND_PIPE(0, 1, 0, 5);
|
||||
}
|
||||
|
||||
void N64BlenderT::BlendEquationCycle1NoForceNoSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
BLEND_PIPE(1, 0, 1, 2);
|
||||
}
|
||||
|
||||
void N64BlenderT::BlendEquationCycle1NoForceSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
BLEND_PIPE(1, 1, 1, 2);
|
||||
}
|
||||
|
||||
void N64BlenderT::BlendEquationCycle1ForceNoSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
BLEND_PIPE(1, 0, 0, 5);
|
||||
}
|
||||
|
||||
void N64BlenderT::BlendEquationCycle1ForceSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
BLEND_PIPE(1, 1, 0, 5);
|
||||
}
|
||||
|
||||
bool N64BlenderT::AlphaCompareNone(UINT8 alpha, const rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
bool N64BlenderT::test_for_reject(rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
if (alpha_reject(userdata, object))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (object.OtherModes.antialias_en ? !userdata->CurrentPixCvg : !userdata->CurrentCvgBit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool N64BlenderT::AlphaCompareNoDither(UINT8 alpha, const rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
bool N64BlenderT::alpha_reject(rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
return alpha < userdata->BlendColor.i.a;
|
||||
switch (object.OtherModes.alpha_dither_mode)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return false;
|
||||
|
||||
case 2:
|
||||
return userdata->PixelColor.i.a < userdata->BlendColor.i.a;
|
||||
|
||||
case 3:
|
||||
return userdata->PixelColor.i.a < (rand() & 0xff);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool N64BlenderT::AlphaCompareDither(UINT8 alpha, const rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
bool N64BlenderT::Blend1CycleNoBlendNoACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
return alpha < (rand() & 0xff);
|
||||
userdata->PixelColor.i.a = m_alpha_dither[(userdata->PixelColor.i.a << 3) | adseed];
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*fr = *userdata->ColorInputs.blender1a_r[0];
|
||||
*fg = *userdata->ColorInputs.blender1a_g[0];
|
||||
*fb = *userdata->ColorInputs.blender1a_b[0];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleNoBlendNoACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
userdata->PixelColor.i.a = m_alpha_dither[(userdata->PixelColor.i.a << 3) | adseed];
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*fr = m_color_dither[((*userdata->ColorInputs.blender1a_r[0] & 0xff) << 3) | dith];
|
||||
*fg = m_color_dither[((*userdata->ColorInputs.blender1a_g[0] & 0xff) << 3) | dith];
|
||||
*fb = m_color_dither[((*userdata->ColorInputs.blender1a_b[0] & 0xff) << 3) | dith];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleNoBlendACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*fr = *userdata->ColorInputs.blender1a_r[0];
|
||||
*fg = *userdata->ColorInputs.blender1a_g[0];
|
||||
*fb = *userdata->ColorInputs.blender1a_b[0];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleNoBlendACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*fr = m_color_dither[((*userdata->ColorInputs.blender1a_r[0] & 0xff) << 3) | dith];
|
||||
*fg = m_color_dither[((*userdata->ColorInputs.blender1a_g[0] & 0xff) << 3) | dith];
|
||||
*fb = m_color_dither[((*userdata->ColorInputs.blender1a_b[0] & 0xff) << 3) | dith];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleBlendNoACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->PixelColor.i.a = m_alpha_dither[(userdata->PixelColor.i.a << 3) | adseed];
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
blend_with_partial_reject(&r, &g, &b, 0, partialreject, sel0, userdata, object);
|
||||
|
||||
*fr = r;
|
||||
*fg = g;
|
||||
*fb = b;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleBlendNoACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->PixelColor.i.a = m_alpha_dither[(userdata->PixelColor.i.a << 3) | adseed];
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
blend_with_partial_reject(&r, &g, &b, 0, partialreject, sel0, userdata, object);
|
||||
|
||||
*fr = m_color_dither[((r & 0xff) << 3) | dith];
|
||||
*fg = m_color_dither[((g & 0xff) << 3) | dith];
|
||||
*fb = m_color_dither[((b & 0xff) << 3) | dith];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleBlendACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
blend_with_partial_reject(&r, &g, &b, 0, partialreject, sel0, userdata, object);
|
||||
|
||||
*fr = r;
|
||||
*fg = g;
|
||||
*fb = b;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend1CycleBlendACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
blend_with_partial_reject(&r, &g, &b, 0, partialreject, sel0, userdata, object);
|
||||
|
||||
*fr = m_color_dither[((r & 0xff) << 3) | dith];
|
||||
*fg = m_color_dither[((g & 0xff) << 3) | dith];
|
||||
*fb = m_color_dither[((b & 0xff) << 3) | dith];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleNoBlendNoACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->PixelColor.i.a = m_alpha_dither[(userdata->PixelColor.i.a << 3) | adseed];
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
userdata->InvPixelColor.i.a = 0xff - *userdata->ColorInputs.blender1b_a[0];
|
||||
blend_pipe(0, sel0, &r, &g, &b, userdata, object);
|
||||
|
||||
userdata->BlendedPixelColor.i.r = r;
|
||||
userdata->BlendedPixelColor.i.g = g;
|
||||
userdata->BlendedPixelColor.i.b = b;
|
||||
userdata->BlendedPixelColor.i.a = userdata->PixelColor.i.a;
|
||||
*fr = *userdata->ColorInputs.blender1a_r[1];
|
||||
*fg = *userdata->ColorInputs.blender1a_g[1];
|
||||
*fb = *userdata->ColorInputs.blender1a_b[1];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleNoBlendNoACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->PixelColor.i.a = m_alpha_dither[(userdata->PixelColor.i.a << 3) | adseed];
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
userdata->InvPixelColor.i.a = 0xff - *userdata->ColorInputs.blender1b_a[0];
|
||||
blend_pipe(0, sel0, &r, &g, &b, userdata, object);
|
||||
|
||||
userdata->BlendedPixelColor.i.r = r;
|
||||
userdata->BlendedPixelColor.i.g = g;
|
||||
userdata->BlendedPixelColor.i.b = b;
|
||||
userdata->BlendedPixelColor.i.a = userdata->PixelColor.i.a;
|
||||
*fr = m_color_dither[((*userdata->ColorInputs.blender1a_r[1] & 0xff) << 3) | dith];
|
||||
*fg = m_color_dither[((*userdata->ColorInputs.blender1a_g[1] & 0xff) << 3) | dith];
|
||||
*fb = m_color_dither[((*userdata->ColorInputs.blender1a_b[1] & 0xff) << 3) | dith];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleNoBlendACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
userdata->InvPixelColor.i.a = 0xff - *userdata->ColorInputs.blender1b_a[0];
|
||||
blend_pipe(0, sel0, &r, &g, &b, userdata, object);
|
||||
|
||||
userdata->BlendedPixelColor.i.r = r;
|
||||
userdata->BlendedPixelColor.i.g = g;
|
||||
userdata->BlendedPixelColor.i.b = b;
|
||||
userdata->BlendedPixelColor.i.a = userdata->PixelColor.i.a;
|
||||
*fr = *userdata->ColorInputs.blender1a_r[1];
|
||||
*fg = *userdata->ColorInputs.blender1a_g[1];
|
||||
*fb = *userdata->ColorInputs.blender1a_b[1];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleNoBlendACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
userdata->InvPixelColor.i.a = 0xff - *userdata->ColorInputs.blender1b_a[0];
|
||||
blend_pipe(0, sel0, &r, &g, &b, userdata, object);
|
||||
|
||||
userdata->BlendedPixelColor.i.r = r;
|
||||
userdata->BlendedPixelColor.i.g = g;
|
||||
userdata->BlendedPixelColor.i.b = b;
|
||||
userdata->BlendedPixelColor.i.a = userdata->PixelColor.i.a;
|
||||
*fr = m_color_dither[((*userdata->ColorInputs.blender1a_r[1] & 0xff) << 3) | dith];
|
||||
*fg = m_color_dither[((*userdata->ColorInputs.blender1a_g[1] & 0xff) << 3) | dith];
|
||||
*fb = m_color_dither[((*userdata->ColorInputs.blender1a_b[1] & 0xff) << 3) | dith];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleBlendNoACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->PixelColor.i.a = m_alpha_dither[(userdata->PixelColor.i.a << 3) | adseed];
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
userdata->InvPixelColor.i.a = 0xff - *userdata->ColorInputs.blender1b_a[0];
|
||||
blend_pipe(0, sel0, &r, &g, &b, userdata, object);
|
||||
|
||||
userdata->BlendedPixelColor.i.r = r;
|
||||
userdata->BlendedPixelColor.i.g = g;
|
||||
userdata->BlendedPixelColor.i.b = b;
|
||||
userdata->BlendedPixelColor.i.a = userdata->PixelColor.i.a;
|
||||
|
||||
blend_with_partial_reject(&r, &g, &b, 1, partialreject, sel1, userdata, object);
|
||||
|
||||
*fr = r;
|
||||
*fg = g;
|
||||
*fb = b;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleBlendNoACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->PixelColor.i.a = m_alpha_dither[(userdata->PixelColor.i.a << 3) | adseed];
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
userdata->InvPixelColor.i.a = 0xff - *userdata->ColorInputs.blender1b_a[0];
|
||||
blend_pipe(0, sel0, &r, &g, &b, userdata, object);
|
||||
|
||||
userdata->BlendedPixelColor.i.r = r;
|
||||
userdata->BlendedPixelColor.i.g = g;
|
||||
userdata->BlendedPixelColor.i.b = b;
|
||||
userdata->BlendedPixelColor.i.a = userdata->PixelColor.i.a;
|
||||
|
||||
blend_with_partial_reject(&r, &g, &b, 1, partialreject, sel1, userdata, object);
|
||||
|
||||
*fr = m_color_dither[((r & 0xff) << 3) | dith];
|
||||
*fg = m_color_dither[((g & 0xff) << 3) | dith];
|
||||
*fb = m_color_dither[((b & 0xff) << 3) | dith];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleBlendACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
userdata->InvPixelColor.i.a = 0xff - *userdata->ColorInputs.blender1b_a[0];
|
||||
blend_pipe(0, sel0, &r, &g, &b, userdata, object);
|
||||
|
||||
userdata->BlendedPixelColor.i.r = r;
|
||||
userdata->BlendedPixelColor.i.g = g;
|
||||
userdata->BlendedPixelColor.i.b = b;
|
||||
userdata->BlendedPixelColor.i.a = userdata->PixelColor.i.a;
|
||||
|
||||
blend_with_partial_reject(&r, &g, &b, 1, partialreject, sel1, userdata, object);
|
||||
|
||||
*fr = r;
|
||||
*fg = g;
|
||||
*fb = b;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool N64BlenderT::Blend2CycleBlendACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
userdata->ShadeColor.i.a = m_alpha_dither[(userdata->ShadeColor.i.a << 3) | adseed];
|
||||
|
||||
if (test_for_reject(userdata, object))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
userdata->InvPixelColor.i.a = 0xff - *userdata->ColorInputs.blender1b_a[0];
|
||||
blend_pipe(0, sel0, &r, &g, &b, userdata, object);
|
||||
|
||||
userdata->BlendedPixelColor.i.r = r;
|
||||
userdata->BlendedPixelColor.i.g = g;
|
||||
userdata->BlendedPixelColor.i.b = b;
|
||||
userdata->BlendedPixelColor.i.a = userdata->PixelColor.i.a;
|
||||
|
||||
blend_with_partial_reject(&r, &g, &b, 1, partialreject, sel1, userdata, object);
|
||||
|
||||
*fr = m_color_dither[((r & 0xff) << 3) | dith];
|
||||
*fg = m_color_dither[((g & 0xff) << 3) | dith];
|
||||
*fb = m_color_dither[((b & 0xff) << 3) | dith];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void N64BlenderT::blend_with_partial_reject(INT32* r, INT32* g, INT32* b, INT32 cycle, INT32 partialreject, INT32 select, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
if (partialreject && userdata->PixelColor.i.a >= 0xff)
|
||||
{
|
||||
*r = *userdata->ColorInputs.blender1a_r[cycle];
|
||||
*g = *userdata->ColorInputs.blender1a_g[cycle];
|
||||
*b = *userdata->ColorInputs.blender1a_b[cycle];
|
||||
}
|
||||
else
|
||||
{
|
||||
userdata->InvPixelColor.i.a = 0xff - *userdata->ColorInputs.blender1b_a[cycle];
|
||||
blend_pipe(cycle, select, r, g, b, userdata, object);
|
||||
}
|
||||
}
|
||||
|
||||
void N64BlenderT::blend_pipe(const int cycle, const int special, int* r_out, int* g_out, int* b_out, rdp_span_aux *userdata, const rdp_poly_state& object)
|
||||
{
|
||||
const INT32 mask = 0xff &~ (0x73 * special);
|
||||
const INT32 shift_a = 3 + userdata->ShiftA * special;
|
||||
const INT32 shift_b = 3 + userdata->ShiftB * special;
|
||||
const INT32 blend1a = (*userdata->ColorInputs.blender1b_a[cycle] >> shift_a) & mask;
|
||||
const INT32 blend2a = (*userdata->ColorInputs.blender2b_a[cycle] >> shift_b) & mask;
|
||||
const INT32 special_shift = special << 1;
|
||||
|
||||
INT32 r = (((int)(*userdata->ColorInputs.blender1a_r[cycle]) * (int)(blend1a))) + (((int)(*userdata->ColorInputs.blender2a_r[cycle]) * (int)(blend2a)));
|
||||
INT32 g = (((int)(*userdata->ColorInputs.blender1a_g[cycle]) * (int)(blend1a))) + (((int)(*userdata->ColorInputs.blender2a_g[cycle]) * (int)(blend2a)));
|
||||
INT32 b = (((int)(*userdata->ColorInputs.blender1a_b[cycle]) * (int)(blend1a))) + (((int)(*userdata->ColorInputs.blender2a_b[cycle]) * (int)(blend2a)));
|
||||
|
||||
r += ((int)*userdata->ColorInputs.blender2a_r[cycle]) << special_shift;
|
||||
g += ((int)*userdata->ColorInputs.blender2a_g[cycle]) << special_shift;
|
||||
b += ((int)*userdata->ColorInputs.blender2a_b[cycle]) << special_shift;
|
||||
|
||||
r >>= object.OtherModes.blend_shift;
|
||||
g >>= object.OtherModes.blend_shift;
|
||||
b >>= object.OtherModes.blend_shift;
|
||||
|
||||
if (!object.OtherModes.force_blend)
|
||||
{
|
||||
INT32 factor_sum = ((blend1a >> 2) + (blend2a >> 2) + 1) & 0xf;
|
||||
if (factor_sum)
|
||||
{
|
||||
r /= factor_sum;
|
||||
g /= factor_sum;
|
||||
b /= factor_sum;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = g = b = 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
*r_out = min(r, 255);
|
||||
*g_out = min(g, 255);
|
||||
*b_out = min(b, 255);
|
||||
}
|
||||
|
||||
inline INT32 N64BlenderT::min(const INT32 x, const INT32 min)
|
||||
{
|
||||
if (x < min)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
return min;
|
||||
}
|
||||
|
@ -28,10 +28,8 @@ struct rdp_poly_state;
|
||||
class N64BlenderT
|
||||
{
|
||||
public:
|
||||
typedef bool (N64BlenderT::*Blender1)(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
typedef bool (N64BlenderT::*Blender2)(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
typedef void (N64BlenderT::*BlendEquation)(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
typedef bool (N64BlenderT::*AlphaCompare)(UINT8 alpha, const rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
typedef bool (N64BlenderT::*Blender1)(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
typedef bool (N64BlenderT::*Blender2)(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
|
||||
N64BlenderT();
|
||||
|
||||
@ -43,48 +41,40 @@ class N64BlenderT
|
||||
|
||||
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
|
||||
|
||||
INT32 min(const INT32 x, const INT32 min);
|
||||
|
||||
private:
|
||||
running_machine* m_machine;
|
||||
n64_rdp* m_rdp;
|
||||
|
||||
bool Blend1CycleNoBlendNoACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleNoBlendNoACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleNoBlendACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleNoBlendACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleBlendNoACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleBlendNoACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleBlendACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleBlendACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool alpha_reject(rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool test_for_reject(rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
void blend_pipe(const int cycle, const int special, int* r_out, int* g_out, int* b_out, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
void blend_with_partial_reject(INT32* r, INT32* g, INT32* b, INT32 cycle, INT32 partialreject, INT32 select, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
|
||||
bool Blend2CycleNoBlendNoACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleNoBlendNoACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleNoBlendACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleNoBlendACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleBlendNoACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleBlendNoACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleBlendACVGNoDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleBlendACVGDither(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, int acmode, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleNoBlendNoACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleNoBlendNoACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleNoBlendACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleNoBlendACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleBlendNoACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleBlendNoACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleBlendACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend1CycleBlendACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
|
||||
void BlendEquationCycle0NoForceNoSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
void BlendEquationCycle0NoForceSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
void BlendEquationCycle0ForceNoSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
void BlendEquationCycle0ForceSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleNoBlendNoACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleNoBlendNoACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleNoBlendACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleNoBlendACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleBlendNoACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleBlendNoACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleBlendACVGNoDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool Blend2CycleBlendACVGDither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
|
||||
void BlendEquationCycle1NoForceNoSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
void BlendEquationCycle1NoForceSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
void BlendEquationCycle1ForceNoSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
void BlendEquationCycle1ForceSpecial(INT32* r, INT32* g, INT32* b, rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
INT32 dither_alpha(INT32 alpha, INT32 dither);
|
||||
INT32 dither_color(INT32 color, INT32 dither);
|
||||
|
||||
BlendEquation cycle0[4];
|
||||
BlendEquation cycle1[4];
|
||||
AlphaCompare compare[4];
|
||||
|
||||
bool AlphaCompareNone(UINT8 alpha, const rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool AlphaCompareNoDither(UINT8 alpha, const rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
bool AlphaCompareDither(UINT8 alpha, const rdp_span_aux *userdata, const rdp_poly_state& object);
|
||||
|
||||
void DitherRGB(INT32* r, INT32* g, INT32* b, int dith);
|
||||
void DitherA(UINT8* a, int dith);
|
||||
UINT8 m_color_dither[256 * 8];
|
||||
UINT8 m_alpha_dither[256 * 8];
|
||||
};
|
||||
|
||||
#endif // _VIDEO_RDPBLEND_H_
|
||||
|
@ -132,7 +132,7 @@ void n64_rdp::RGBAZCorrectTriangle(INT32 offx, INT32 offy, INT32* r, INT32* g, I
|
||||
}
|
||||
}
|
||||
|
||||
inline void n64_rdp::write_pixel(UINT32 curpixel, UINT32 r, UINT32 g, UINT32 b, rdp_span_aux *userdata, const rdp_poly_state &object)
|
||||
inline void n64_rdp::write_pixel(UINT32 curpixel, INT32 r, INT32 g, INT32 b, rdp_span_aux *userdata, const rdp_poly_state &object)
|
||||
{
|
||||
if (object.MiscState.FBSize == 2) // 16-bit framebuffer
|
||||
{
|
||||
@ -277,7 +277,7 @@ inline void n64_rdp::read_pixel(UINT32 curpixel, rdp_span_aux *userdata, const r
|
||||
}
|
||||
}
|
||||
|
||||
inline void n64_rdp::copy_pixel(UINT32 curpixel, UINT32 r, UINT32 g, UINT32 b, int CurrentPixCvg, const rdp_poly_state &object)
|
||||
inline void n64_rdp::copy_pixel(UINT32 curpixel, INT32 r, INT32 g, INT32 b, int CurrentPixCvg, const rdp_poly_state &object)
|
||||
{
|
||||
if (object.MiscState.FBSize == 2) // 16-bit framebuffer
|
||||
{
|
||||
@ -348,7 +348,7 @@ void n64_rdp::SpanDraw1Cycle(INT32 scanline, const extent_t &extent, const rdp_p
|
||||
TexPipe.CalculateClampDiffs(tilenum, userdata, object, m_clamp_s_diff, m_clamp_t_diff);
|
||||
|
||||
const bool partialreject = (userdata->ColorInputs.blender2b_a[0] == &userdata->InvPixelColor.i.a && userdata->ColorInputs.blender1b_a[0] == &userdata->PixelColor.i.a);
|
||||
const int sel0 = (OtherModes.force_blend ? 2 : 0) | ((userdata->ColorInputs.blender2b_a[0] == &userdata->MemoryColor.i.a) ? 1 : 0);
|
||||
const int sel0 = (userdata->ColorInputs.blender2b_a[0] == &userdata->MemoryColor.i.a) ? 1 : 0;
|
||||
|
||||
int drinc, dginc, dbinc, dainc;
|
||||
int dzinc, dzpix;
|
||||
@ -389,7 +389,7 @@ void n64_rdp::SpanDraw1Cycle(INT32 scanline, const extent_t &extent, const rdp_p
|
||||
int x = xend;
|
||||
|
||||
const int length = flip ? (xstart - xend) : (xend - xstart);
|
||||
UINT32 fir, fig, fib;
|
||||
INT32 fir, fig, fib;
|
||||
|
||||
if(object.OtherModes.z_source_sel)
|
||||
{
|
||||
@ -407,7 +407,6 @@ void n64_rdp::SpanDraw1Cycle(INT32 scanline, const extent_t &extent, const rdp_p
|
||||
|
||||
const int blend_index = (object.OtherModes.alpha_cvg_select ? 2 : 0) | ((object.OtherModes.rgb_dither_sel < 3) ? 1 : 0);
|
||||
const int cycle0 = ((object.OtherModes.sample_type & 1) << 1) | (object.OtherModes.bi_lerp0 & 1);
|
||||
const int acmode = (object.OtherModes.alpha_compare_en ? 2 : 0) | (object.OtherModes.dither_alpha_en ? 1 : 0);
|
||||
|
||||
INT32 sss = 0;
|
||||
INT32 sst = 0;
|
||||
@ -465,7 +464,11 @@ void n64_rdp::SpanDraw1Cycle(INT32 scanline, const extent_t &extent, const rdp_p
|
||||
int adith = 0;
|
||||
GetDitherValues(scanline, j, &cdith, &adith, object);
|
||||
|
||||
bool rendered = ((&Blender)->*(Blender.blend1[(userdata->BlendEnable << 2) | blend_index]))(&fir, &fig, &fib, cdith, adith, partialreject, sel0, acmode, userdata, object);
|
||||
if (((userdata->BlendEnable << 2) | blend_index) != 5 && machine().input().code_pressed(KEYCODE_B))
|
||||
{
|
||||
printf("1:%d\n", (userdata->BlendEnable << 2) | blend_index);
|
||||
}
|
||||
bool rendered = ((&Blender)->*(Blender.blend1[(userdata->BlendEnable << 2) | blend_index]))(&fir, &fig, &fib, cdith, adith, partialreject, sel0, userdata, object);
|
||||
|
||||
if (rendered)
|
||||
{
|
||||
@ -535,8 +538,8 @@ void n64_rdp::SpanDraw2Cycle(INT32 scanline, const extent_t &extent, const rdp_p
|
||||
TexPipe.CalculateClampDiffs(tile1, userdata, object, m_clamp_s_diff, m_clamp_t_diff);
|
||||
|
||||
bool partialreject = (userdata->ColorInputs.blender2b_a[1] == &userdata->InvPixelColor.i.a && userdata->ColorInputs.blender1b_a[1] == &userdata->PixelColor.i.a);
|
||||
int sel0 = (OtherModes.force_blend ? 2 : 0) | ((userdata->ColorInputs.blender2b_a[0] == &userdata->MemoryColor.i.a) ? 1 : 0);
|
||||
int sel1 = (OtherModes.force_blend ? 2 : 0) | ((userdata->ColorInputs.blender2b_a[1] == &userdata->MemoryColor.i.a) ? 1 : 0);
|
||||
int sel0 = (userdata->ColorInputs.blender2b_a[0] == &userdata->MemoryColor.i.a) ? 1 : 0;
|
||||
int sel1 = (userdata->ColorInputs.blender2b_a[1] == &userdata->MemoryColor.i.a) ? 1 : 0;
|
||||
|
||||
int drinc, dginc, dbinc, dainc;
|
||||
int dzinc, dzpix;
|
||||
@ -580,7 +583,7 @@ void n64_rdp::SpanDraw2Cycle(INT32 scanline, const extent_t &extent, const rdp_p
|
||||
int x = xend;
|
||||
|
||||
const int length = flip ? (xstart - xend) : (xend - xstart);
|
||||
UINT32 fir, fig, fib;
|
||||
INT32 fir, fig, fib;
|
||||
|
||||
if(object.OtherModes.z_source_sel)
|
||||
{
|
||||
@ -599,7 +602,6 @@ void n64_rdp::SpanDraw2Cycle(INT32 scanline, const extent_t &extent, const rdp_p
|
||||
const int blend_index = (object.OtherModes.alpha_cvg_select ? 2 : 0) | ((object.OtherModes.rgb_dither_sel < 3) ? 1 : 0);
|
||||
const int cycle0 = ((object.OtherModes.sample_type & 1) << 1) | (object.OtherModes.bi_lerp0 & 1);
|
||||
const int cycle1 = ((object.OtherModes.sample_type & 1) << 1) | (object.OtherModes.bi_lerp1 & 1);
|
||||
const int acmode = (object.OtherModes.alpha_compare_en ? 2 : 0) | (object.OtherModes.dither_alpha_en ? 1 : 0);
|
||||
|
||||
INT32 sss = 0;
|
||||
INT32 sst = 0;
|
||||
@ -699,7 +701,11 @@ void n64_rdp::SpanDraw2Cycle(INT32 scanline, const extent_t &extent, const rdp_p
|
||||
{
|
||||
GetDitherValues(scanline, j, &cdith, &adith, object);
|
||||
|
||||
bool rendered = ((&Blender)->*(Blender.blend2[(userdata->BlendEnable << 2) | blend_index]))(&fir, &fig, &fib, cdith, adith, partialreject, sel0, sel1, acmode, userdata, object);
|
||||
if (((userdata->BlendEnable << 2) | blend_index) != 5 && machine().input().code_pressed(KEYCODE_B))
|
||||
{
|
||||
printf("2:%d\n", (userdata->BlendEnable << 2) | blend_index);
|
||||
}
|
||||
bool rendered = ((&Blender)->*(Blender.blend2[(userdata->BlendEnable << 2) | blend_index]))(&fir, &fig, &fib, cdith, adith, partialreject, sel0, sel1, userdata, object);
|
||||
|
||||
if (rendered)
|
||||
{
|
||||
@ -729,36 +735,33 @@ void n64_rdp::SpanDraw2Cycle(INT32 scanline, const extent_t &extent, const rdp_p
|
||||
|
||||
void n64_rdp::SpanDrawCopy(INT32 scanline, const extent_t &extent, const rdp_poly_state &object, int threadid)
|
||||
{
|
||||
assert(object.MiscState.FBSize >= 2 && object.MiscState.FBSize < 4);
|
||||
const int clipx1 = object.Scissor.m_xh;
|
||||
const int clipx2 = object.Scissor.m_xl;
|
||||
const int tilenum = object.tilenum;
|
||||
const bool flip = object.flip;
|
||||
|
||||
int clipx1 = object.Scissor.m_xh;
|
||||
int clipx2 = object.Scissor.m_xl;
|
||||
int tilenum = object.tilenum;
|
||||
bool flip = object.flip;
|
||||
rdp_span_aux *userdata = (rdp_span_aux*)extent.userdata;
|
||||
const int xstart = extent.startx;
|
||||
const int xend = userdata->m_unscissored_rx;
|
||||
const int xend_scissored = extent.stopx;
|
||||
const int xinc = flip ? 1 : -1;
|
||||
const int length = flip ? (xstart - xend) : (xend - xstart);
|
||||
|
||||
SpanParam s; s.w = extent.param[SPAN_S].start;
|
||||
SpanParam t; t.w = extent.param[SPAN_T].start;
|
||||
|
||||
int ds = object.SpanBase.m_span_ds / 4;
|
||||
int dt = object.SpanBase.m_span_dt / 4;
|
||||
int dsinc = flip ? (ds) : -ds;
|
||||
int dtinc = flip ? (dt) : -dt;
|
||||
int xinc = flip ? 1 : -1;
|
||||
const int ds = object.SpanBase.m_span_ds / 4;
|
||||
const int dt = object.SpanBase.m_span_dt / 4;
|
||||
const int dsinc = flip ? (ds) : -ds;
|
||||
const int dtinc = flip ? (dt) : -dt;
|
||||
|
||||
int fb_index = object.MiscState.FBWidth * scanline;
|
||||
|
||||
rdp_span_aux *userdata = (rdp_span_aux*)extent.userdata;
|
||||
int xstart = extent.startx;
|
||||
int xend = userdata->m_unscissored_rx;
|
||||
int xend_scissored = extent.stopx;
|
||||
const int fb_index = object.MiscState.FBWidth * scanline;
|
||||
|
||||
int x = xend;
|
||||
|
||||
int length = flip ? (xstart - xend) : (xend - xstart);
|
||||
|
||||
for (int j = 0; j <= length; j++)
|
||||
{
|
||||
bool valid_x = (flip) ? (x >= xend_scissored) : (x <= xend_scissored);
|
||||
const bool valid_x = (flip) ? (x >= xend_scissored) : (x <= xend_scissored);
|
||||
|
||||
if (x >= clipx1 && x < clipx2 && valid_x)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user