Implement Banshee tiled surfaces

This commit is contained in:
SarahW 2020-08-12 15:13:48 +01:00
commit 133f19fe39
9 changed files with 379 additions and 133 deletions

View file

@ -56,7 +56,7 @@ typedef struct voodoo_state_t
int64_t w;
int pixel_count, texel_count;
int x, x2;
int x, x2, x_tiled;
uint32_t w_depth;
@ -920,8 +920,14 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
}
else
{
state->fb_mem = fb_mem = (uint16_t *)&voodoo->fb_mem[params->draw_offset + (real_y * voodoo->row_width)];
state->aux_mem = aux_mem = (uint16_t *)&voodoo->fb_mem[(params->aux_offset + (real_y * voodoo->row_width)) & voodoo->fb_mask];
if (voodoo->col_tiled)
state->fb_mem = fb_mem = (uint16_t *)&voodoo->fb_mem[params->draw_offset + (real_y >> 5) * voodoo->row_width + (real_y & 31) * 128];
else
state->fb_mem = fb_mem = (uint16_t *)&voodoo->fb_mem[params->draw_offset + (real_y * voodoo->row_width)];
if (voodoo->aux_tiled)
state->aux_mem = aux_mem = (uint16_t *)&voodoo->fb_mem[(params->aux_offset + (real_y >> 5) * voodoo->aux_row_width + (real_y & 31) * 128) & voodoo->fb_mask];
else
state->aux_mem = aux_mem = (uint16_t *)&voodoo->fb_mem[(params->aux_offset + (real_y * voodoo->row_width)) & voodoo->fb_mask];
}
if (voodoo_output)
@ -940,6 +946,7 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
#endif
do
{
int x_tiled = (x & 63) | ((x >> 6) * 128*32/2);
start_x = x;
state->x = x;
voodoo->pixel_count[odd_even]++;
@ -985,12 +992,12 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
if (params->fbzMode & FBZ_DEPTH_ENABLE)
{
uint16_t old_depth = aux_mem[x];
uint16_t old_depth = voodoo->aux_tiled ? aux_mem[x_tiled] : aux_mem[x];
DEPTH_TEST((params->fbzMode & FBZ_DEPTH_SOURCE) ? (params->zaColor & 0xffff) : new_depth);
}
dat = fb_mem[x];
dat = voodoo->col_tiled ? fb_mem[x_tiled] : fb_mem[x];
dest_r = (dat >> 8) & 0xf8;
dest_g = (dat >> 3) & 0xfc;
dest_b = (dat << 3) & 0xf8;
@ -1303,10 +1310,19 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
}
if (params->fbzMode & FBZ_RGB_WMASK)
fb_mem[x] = src_b | (src_g << 5) | (src_r << 11);
{
if (voodoo->col_tiled)
fb_mem[x_tiled] = src_b | (src_g << 5) | (src_r << 11);
else
fb_mem[x] = src_b | (src_g << 5) | (src_r << 11);
}
if ((params->fbzMode & (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE)) == (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE))
aux_mem[x] = new_depth;
{
if (voodoo->aux_tiled)
aux_mem[x_tiled] = new_depth;
else
aux_mem[x] = new_depth;
}
}
}
voodoo_output &= ~2;