mirror of
https://github.com/holub/mame
synced 2025-07-01 16:19:38 +03:00
Fix graphical bugs with recent N64 opts, nw
This commit is contained in:
parent
438e563c64
commit
e9fe1e74c4
@ -372,6 +372,8 @@ struct rdp_span_aux
|
|||||||
INT32 m_dzpix_enc;
|
INT32 m_dzpix_enc;
|
||||||
UINT8* m_tmem; /* pointer to texture cache for this polygon */
|
UINT8* m_tmem; /* pointer to texture cache for this polygon */
|
||||||
bool m_start_span;
|
bool m_start_span;
|
||||||
|
INT32 m_clamp_s_diff[8];
|
||||||
|
INT32 m_clamp_t_diff[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rectangle_t
|
struct rectangle_t
|
||||||
|
@ -340,7 +340,7 @@ void n64_rdp::span_draw_1cycle(INT32 scanline, const extent_t &extent, const rdp
|
|||||||
#endif
|
#endif
|
||||||
rdp_span_aux* userdata = (rdp_span_aux*)extent.userdata;
|
rdp_span_aux* userdata = (rdp_span_aux*)extent.userdata;
|
||||||
|
|
||||||
m_tex_pipe.calculate_clamp_diffs(tilenum, object);
|
m_tex_pipe.calculate_clamp_diffs(tilenum, userdata, object);
|
||||||
|
|
||||||
const bool partialreject = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_inv_pixel_color.i.a && userdata->m_color_inputs.blender1b_a[0] == &userdata->m_pixel_color.i.a);
|
const bool partialreject = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_inv_pixel_color.i.a && userdata->m_color_inputs.blender1b_a[0] == &userdata->m_pixel_color.i.a);
|
||||||
const INT32 sel0 = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_memory_color.i.a) ? 1 : 0;
|
const INT32 sel0 = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_memory_color.i.a) ? 1 : 0;
|
||||||
@ -529,7 +529,7 @@ void n64_rdp::span_draw_2cycle(INT32 scanline, const extent_t &extent, const rdp
|
|||||||
#endif
|
#endif
|
||||||
rdp_span_aux* userdata = (rdp_span_aux*)extent.userdata;
|
rdp_span_aux* userdata = (rdp_span_aux*)extent.userdata;
|
||||||
|
|
||||||
m_tex_pipe.calculate_clamp_diffs(tile1, object);
|
m_tex_pipe.calculate_clamp_diffs(tile1, userdata, object);
|
||||||
|
|
||||||
bool partialreject = (userdata->m_color_inputs.blender2b_a[1] == &userdata->m_inv_pixel_color.i.a && userdata->m_color_inputs.blender1b_a[1] == &userdata->m_pixel_color.i.a);
|
bool partialreject = (userdata->m_color_inputs.blender2b_a[1] == &userdata->m_inv_pixel_color.i.a && userdata->m_color_inputs.blender1b_a[1] == &userdata->m_pixel_color.i.a);
|
||||||
INT32 sel0 = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_memory_color.i.a) ? 1 : 0;
|
INT32 sel0 = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_memory_color.i.a) ? 1 : 0;
|
||||||
|
@ -163,7 +163,7 @@ void n64_texture_pipe_t::shift_copy(INT32* S, INT32* T, const n64_tile_t& tile)
|
|||||||
*T = (INT32)(INT16)sst;
|
*T = (INT32)(INT16)sst;
|
||||||
}
|
}
|
||||||
|
|
||||||
void n64_texture_pipe_t::clamp_cycle(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile)
|
void n64_texture_pipe_t::clamp_cycle(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata)
|
||||||
{
|
{
|
||||||
if (tile.clamp_s)
|
if (tile.clamp_s)
|
||||||
{
|
{
|
||||||
@ -174,7 +174,7 @@ void n64_texture_pipe_t::clamp_cycle(INT32* S, INT32* T, INT32* SFRAC, INT32* TF
|
|||||||
}
|
}
|
||||||
else if (maxs)
|
else if (maxs)
|
||||||
{
|
{
|
||||||
*S = m_clamp_s_diff[tilenum];
|
*S = userdata->m_clamp_s_diff[tilenum];
|
||||||
*SFRAC = 0;
|
*SFRAC = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -196,7 +196,7 @@ void n64_texture_pipe_t::clamp_cycle(INT32* S, INT32* T, INT32* SFRAC, INT32* TF
|
|||||||
}
|
}
|
||||||
else if (maxt)
|
else if (maxt)
|
||||||
{
|
{
|
||||||
*T = m_clamp_t_diff[tilenum];
|
*T = userdata->m_clamp_t_diff[tilenum];
|
||||||
*TFRAC = 0;
|
*TFRAC = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -210,7 +210,7 @@ void n64_texture_pipe_t::clamp_cycle(INT32* S, INT32* T, INT32* SFRAC, INT32* TF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void n64_texture_pipe_t::clamp_cycle_light(INT32* S, INT32* T, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile)
|
void n64_texture_pipe_t::clamp_cycle_light(INT32* S, INT32* T, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata)
|
||||||
{
|
{
|
||||||
if (tile.clamp_s)
|
if (tile.clamp_s)
|
||||||
{
|
{
|
||||||
@ -220,7 +220,7 @@ void n64_texture_pipe_t::clamp_cycle_light(INT32* S, INT32* T, const bool maxs,
|
|||||||
}
|
}
|
||||||
else if (maxs)
|
else if (maxs)
|
||||||
{
|
{
|
||||||
*S = m_clamp_s_diff[tilenum];
|
*S = userdata->m_clamp_s_diff[tilenum];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -240,7 +240,7 @@ void n64_texture_pipe_t::clamp_cycle_light(INT32* S, INT32* T, const bool maxs,
|
|||||||
}
|
}
|
||||||
else if (maxt)
|
else if (maxt)
|
||||||
{
|
{
|
||||||
*T = m_clamp_t_diff[tilenum];
|
*T = userdata->m_clamp_t_diff[tilenum];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -267,7 +267,7 @@ void n64_texture_pipe_t::cycle_nearest(color_t* TEX, color_t* prev, INT32 SSS, I
|
|||||||
INT32 sss1 = SSS, sst1 = SST;
|
INT32 sss1 = SSS, sst1 = SST;
|
||||||
bool maxs, maxt;
|
bool maxs, maxt;
|
||||||
shift_cycle(&sss1, &sst1, &maxs, &maxt, tile);
|
shift_cycle(&sss1, &sst1, &maxs, &maxt, tile);
|
||||||
clamp_cycle_light(&sss1, &sst1, maxs, maxt, tilenum, tile);
|
clamp_cycle_light(&sss1, &sst1, maxs, maxt, tilenum, tile, userdata);
|
||||||
mask(&sss1, &sst1, tile);
|
mask(&sss1, &sst1, tile);
|
||||||
|
|
||||||
UINT32 tbase = tile.tmem + ((tile.line * sst1) & 0x1ff);
|
UINT32 tbase = tile.tmem + ((tile.line * sst1) & 0x1ff);
|
||||||
@ -313,7 +313,7 @@ void n64_texture_pipe_t::cycle_nearest_lerp(color_t* TEX, color_t* prev, INT32 S
|
|||||||
INT32 sss1 = SSS, sst1 = SST;
|
INT32 sss1 = SSS, sst1 = SST;
|
||||||
bool maxs, maxt;
|
bool maxs, maxt;
|
||||||
shift_cycle(&sss1, &sst1, &maxs, &maxt, tile);
|
shift_cycle(&sss1, &sst1, &maxs, &maxt, tile);
|
||||||
clamp_cycle_light(&sss1, &sst1, maxs, maxt, tilenum, tile);
|
clamp_cycle_light(&sss1, &sst1, maxs, maxt, tilenum, tile, userdata);
|
||||||
mask(&sss1, &sst1, tile);
|
mask(&sss1, &sst1, tile);
|
||||||
|
|
||||||
UINT32 tbase = tile.tmem + ((tile.line * sst1) & 0x1ff);
|
UINT32 tbase = tile.tmem + ((tile.line * sst1) & 0x1ff);
|
||||||
@ -336,7 +336,7 @@ void n64_texture_pipe_t::cycle_linear(color_t* TEX, color_t* prev, INT32 SSS, IN
|
|||||||
INT32 sfrac = sss1 & 0x1f;
|
INT32 sfrac = sss1 & 0x1f;
|
||||||
INT32 tfrac = sst1 & 0x1f;
|
INT32 tfrac = sst1 & 0x1f;
|
||||||
|
|
||||||
clamp_cycle(&sss1, &sst1, &sfrac, &tfrac, maxs, maxt, tilenum, tile);
|
clamp_cycle(&sss1, &sst1, &sfrac, &tfrac, maxs, maxt, tilenum, tile, userdata);
|
||||||
|
|
||||||
INT32 sss2 = sss1 + 1;
|
INT32 sss2 = sss1 + 1;
|
||||||
INT32 sst2 = sst1 + 1;
|
INT32 sst2 = sst1 + 1;
|
||||||
@ -401,7 +401,7 @@ void n64_texture_pipe_t::cycle_linear_lerp(color_t* TEX, color_t* prev, INT32 SS
|
|||||||
INT32 sfrac = sss1 & 0x1f;
|
INT32 sfrac = sss1 & 0x1f;
|
||||||
INT32 tfrac = sst1 & 0x1f;
|
INT32 tfrac = sst1 & 0x1f;
|
||||||
|
|
||||||
clamp_cycle(&sss1, &sst1, &sfrac, &tfrac, maxs, maxt, tilenum, tile);
|
clamp_cycle(&sss1, &sst1, &sfrac, &tfrac, maxs, maxt, tilenum, tile, userdata);
|
||||||
|
|
||||||
INT32 sss2 = sss1 + 1;
|
INT32 sss2 = sss1 + 1;
|
||||||
INT32 sst2 = sst1 + 1;
|
INT32 sst2 = sst1 + 1;
|
||||||
@ -742,7 +742,7 @@ void n64_texture_pipe_t::lod_2cycle_limited(INT32* sss, INT32* sst, const INT32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void n64_texture_pipe_t::calculate_clamp_diffs(UINT32 prim_tile, const rdp_poly_state& object)
|
void n64_texture_pipe_t::calculate_clamp_diffs(UINT32 prim_tile, rdp_span_aux* userdata, const rdp_poly_state& object)
|
||||||
{
|
{
|
||||||
const n64_tile_t* tiles = object.m_tiles;
|
const n64_tile_t* tiles = object.m_tiles;
|
||||||
if (object.m_other_modes.cycle_type == CYCLE_TYPE_2)
|
if (object.m_other_modes.cycle_type == CYCLE_TYPE_2)
|
||||||
@ -751,24 +751,24 @@ void n64_texture_pipe_t::calculate_clamp_diffs(UINT32 prim_tile, const rdp_poly_
|
|||||||
{
|
{
|
||||||
for (INT32 start = 0; start <= 7; start++)
|
for (INT32 start = 0; start <= 7; start++)
|
||||||
{
|
{
|
||||||
m_clamp_s_diff[start] = (tiles[start].sh >> 2) - (tiles[start].sl >> 2);
|
userdata->m_clamp_s_diff[start] = (tiles[start].sh >> 2) - (tiles[start].sl >> 2);
|
||||||
m_clamp_t_diff[start] = (tiles[start].th >> 2) - (tiles[start].tl >> 2);
|
userdata->m_clamp_t_diff[start] = (tiles[start].th >> 2) - (tiles[start].tl >> 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const INT32 start = prim_tile;
|
const INT32 start = prim_tile;
|
||||||
const INT32 end = (prim_tile + 1) & 7;
|
const INT32 end = (prim_tile + 1) & 7;
|
||||||
m_clamp_s_diff[start] = (tiles[start].sh >> 2) - (tiles[start].sl >> 2);
|
userdata->m_clamp_s_diff[start] = (tiles[start].sh >> 2) - (tiles[start].sl >> 2);
|
||||||
m_clamp_t_diff[start] = (tiles[start].th >> 2) - (tiles[start].tl >> 2);
|
userdata->m_clamp_t_diff[start] = (tiles[start].th >> 2) - (tiles[start].tl >> 2);
|
||||||
m_clamp_s_diff[end] = (tiles[end].sh >> 2) - (tiles[end].sl >> 2);
|
userdata->m_clamp_s_diff[end] = (tiles[end].sh >> 2) - (tiles[end].sl >> 2);
|
||||||
m_clamp_t_diff[end] = (tiles[end].th >> 2) - (tiles[end].tl >> 2);
|
userdata->m_clamp_t_diff[end] = (tiles[end].th >> 2) - (tiles[end].tl >> 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else//1-cycle or copy
|
else//1-cycle or copy
|
||||||
{
|
{
|
||||||
m_clamp_s_diff[prim_tile] = (tiles[prim_tile].sh >> 2) - (tiles[prim_tile].sl >> 2);
|
userdata->m_clamp_s_diff[prim_tile] = (tiles[prim_tile].sh >> 2) - (tiles[prim_tile].sl >> 2);
|
||||||
m_clamp_t_diff[prim_tile] = (tiles[prim_tile].th >> 2) - (tiles[prim_tile].tl >> 2);
|
userdata->m_clamp_t_diff[prim_tile] = (tiles[prim_tile].th >> 2) - (tiles[prim_tile].tl >> 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class n64_texture_pipe_t
|
|||||||
texel_cycler_t m_cycle[4];
|
texel_cycler_t m_cycle[4];
|
||||||
|
|
||||||
void copy(color_t* TEX, INT32 SSS, INT32 SST, UINT32 tilenum, const rdp_poly_state& object, rdp_span_aux* userdata);
|
void copy(color_t* TEX, INT32 SSS, INT32 SST, UINT32 tilenum, const rdp_poly_state& object, rdp_span_aux* userdata);
|
||||||
void calculate_clamp_diffs(UINT32 prim_tile, const rdp_poly_state& object);
|
void calculate_clamp_diffs(UINT32 prim_tile, rdp_span_aux* userdata, const rdp_poly_state& object);
|
||||||
void lod_1cycle(INT32* sss, INT32* sst, const INT32 s, const INT32 t, const INT32 w, const INT32 dsinc, const INT32 dtinc, const INT32 dwinc, rdp_span_aux* userdata, const rdp_poly_state& object);
|
void lod_1cycle(INT32* sss, INT32* sst, const INT32 s, const INT32 t, const INT32 w, const INT32 dsinc, const INT32 dtinc, const INT32 dwinc, rdp_span_aux* userdata, const rdp_poly_state& object);
|
||||||
void lod_2cycle(INT32* sss, INT32* sst, const INT32 s, const INT32 t, const INT32 w, const INT32 dsinc, const INT32 dtinc, const INT32 dwinc, const INT32 prim_tile, INT32* t1, INT32* t2, rdp_span_aux* userdata, const rdp_poly_state& object);
|
void lod_2cycle(INT32* sss, INT32* sst, const INT32 s, const INT32 t, const INT32 w, const INT32 dsinc, const INT32 dtinc, const INT32 dwinc, const INT32 prim_tile, INT32* t1, INT32* t2, rdp_span_aux* userdata, const rdp_poly_state& object);
|
||||||
void lod_2cycle_limited(INT32* sss, INT32* sst, const INT32 s, const INT32 t, INT32 w, const INT32 dsinc, const INT32 dtinc, const INT32 dwinc, const INT32 prim_tile, INT32* t1, const rdp_poly_state& object);
|
void lod_2cycle_limited(INT32* sss, INT32* sst, const INT32 s, const INT32 t, INT32 w, const INT32 dsinc, const INT32 dtinc, const INT32 dwinc, const INT32 prim_tile, INT32* t1, const rdp_poly_state& object);
|
||||||
@ -120,8 +120,8 @@ class n64_texture_pipe_t
|
|||||||
void shift_cycle(INT32* S, INT32* T, bool* maxs, bool* maxt, const n64_tile_t& tile);
|
void shift_cycle(INT32* S, INT32* T, bool* maxs, bool* maxt, const n64_tile_t& tile);
|
||||||
void shift_copy(INT32* S, INT32* T, const n64_tile_t& tile);
|
void shift_copy(INT32* S, INT32* T, const n64_tile_t& tile);
|
||||||
|
|
||||||
void clamp_cycle(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile);
|
void clamp_cycle(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata);
|
||||||
void clamp_cycle_light(INT32* S, INT32* T, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile);
|
void clamp_cycle_light(INT32* S, INT32* T, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata);
|
||||||
|
|
||||||
UINT32 fetch_nop(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata);
|
UINT32 fetch_nop(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata);
|
||||||
|
|
||||||
@ -165,8 +165,6 @@ class n64_texture_pipe_t
|
|||||||
INT32 m_maskbits_table[16];
|
INT32 m_maskbits_table[16];
|
||||||
UINT32 m_expand_16to32_table[0x10000];
|
UINT32 m_expand_16to32_table[0x10000];
|
||||||
UINT16 m_lod_lookup[0x80000];
|
UINT16 m_lod_lookup[0x80000];
|
||||||
INT32 m_clamp_s_diff[8];
|
|
||||||
INT32 m_clamp_t_diff[8];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _VIDEO_RDPTEXPIPE_H_
|
#endif // _VIDEO_RDPTEXPIPE_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user