Use correct value for Y swap origin on Voodoo Banshee/3. Fixes issues

sometimes seen when running in low resolutions, ie below 640x480.
This commit is contained in:
SarahW 2021-06-07 19:51:30 +01:00
commit 84b9af3e05
4 changed files with 13 additions and 4 deletions

View file

@ -205,6 +205,9 @@ enum
#define VIDSERIAL_I2C_SCK_R (1 << 26)
#define VIDSERIAL_I2C_SDA_R (1 << 27)
#define MISCINIT0_Y_ORIGIN_SWAP_SHIFT (18)
#define MISCINIT0_Y_ORIGIN_SWAP_MASK (0xfff << MISCINIT0_Y_ORIGIN_SWAP_SHIFT)
static uint32_t banshee_status(banshee_t *banshee);
static void banshee_out(uint16_t addr, uint8_t val, void *p)
@ -550,6 +553,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p)
case Init_miscInit0:
banshee->miscInit0 = val;
voodoo->y_origin_swap = (val & MISCINIT0_Y_ORIGIN_SWAP_MASK) >> MISCINIT0_Y_ORIGIN_SWAP_SHIFT;
break;
case Init_miscInit1:
banshee->miscInit1 = val;

View file

@ -409,8 +409,10 @@ void voodoo_fastfill(voodoo_t *voodoo, voodoo_params_t *params)
if (params->fbzMode & (1 << 17))
{
high_y = voodoo->v_disp - params->clipLowY;
low_y = voodoo->v_disp - params->clipHighY;
int y_origin = (voodoo->type >= VOODOO_BANSHEE) ? (voodoo->y_origin_swap+1) : voodoo->v_disp;
high_y = y_origin - params->clipLowY;
low_y = y_origin - params->clipHighY;
}
else
{

View file

@ -456,6 +456,8 @@ typedef struct voodoo_t
uint32_t tile_base, tile_stride;
int tile_stride_shift, tile_x, tile_x_real;
int y_origin_swap;
int read_time, write_time, burst_time;
pc_timer_t wake_timer;

View file

@ -682,6 +682,7 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
uint8_t (*voodoo_draw)(voodoo_state_t *state, voodoo_params_t *params, int x, int real_y);
#endif
int y_diff = SLI_ENABLED ? 2 : 1;
int y_origin = (voodoo->type >= VOODOO_BANSHEE) ? voodoo->y_origin_swap : (voodoo->v_disp-1);
if ((params->textureMode[0] & TEXTUREMODE_MASK) == TEXTUREMODE_PASSTHROUGH ||
(params->textureMode[0] & TEXTUREMODE_LOCAL_MASK) == TEXTUREMODE_LOCAL)
@ -746,7 +747,7 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
int test_y;
if (params->fbzMode & (1 << 17))
test_y = (voodoo->v_disp-1) - state->y;
test_y = y_origin - state->y;
else
test_y = state->y;
@ -811,7 +812,7 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
x2 = (state->vertexBx << 12) + ((state->dxBC * (real_y - state->vertexBy)) >> 4);
if (params->fbzMode & (1 << 17))
real_y = (voodoo->v_disp-1) - (real_y >> 4);
real_y = y_origin - (real_y >> 4);
else
real_y >>= 4;