Voodoo: Emulation of dither subtraction (interpreter only)

This commit is contained in:
leilei- 2021-06-15 01:12:53 -04:00
commit 0322c0f936
6 changed files with 5183 additions and 0 deletions

View file

@ -952,6 +952,7 @@ void *voodoo_card_init()
memset(voodoo, 0, sizeof(voodoo_t));
voodoo->bilinear_enabled = device_get_config_int("bilinear");
voodoo->dithersub_enabled = device_get_config_int("dithersub");
voodoo->scrfilter = device_get_config_int("dacfilter");
voodoo->texture_size = device_get_config_int("texture_memory");
voodoo->texture_mask = (voodoo->texture_size << 20) - 1;
@ -1098,8 +1099,10 @@ void *voodoo_2d3d_card_init(int type)
memset(voodoo, 0, sizeof(voodoo_t));
voodoo->bilinear_enabled = device_get_config_int("bilinear");
voodoo->dithersub_enabled = device_get_config_int("dithersub");
voodoo->scrfilter = device_get_config_int("dacfilter");
voodoo->render_threads = device_get_config_int("render_threads");
voodoo->odd_even_mask = voodoo->render_threads - 1;
#ifndef NO_CODEGEN
voodoo->use_recompiler = device_get_config_int("recompiler");
@ -1407,6 +1410,12 @@ static device_config_t voodoo_config[] =
.type = CONFIG_BINARY,
.default_int = 1
},
{
.name = "dithersub",
.description = "Dither subtraction",
.type = CONFIG_BINARY,
.default_int = 1
},
{
.name = "dacfilter",
.description = "Screen Filter",

View file

@ -2474,6 +2474,12 @@ static device_config_t banshee_sgram_config[] =
.type = CONFIG_BINARY,
.default_int = 1
},
{
.name = "dithersub",
.description = "Dither subtraction",
.type = CONFIG_BINARY,
.default_int = 1
},
{
.name = "dacfilter",
.description = "Screen Filter",
@ -2525,6 +2531,12 @@ static device_config_t banshee_sdram_config[] =
.type = CONFIG_BINARY,
.default_int = 1
},
{
.name = "dithersub",
.description = "Dither subtraction",
.type = CONFIG_BINARY,
.default_int = 1
},
{
.name = "dacfilter",
.description = "Screen Filter",

View file

@ -283,6 +283,7 @@ typedef struct voodoo_t
int swap_pending;
int bilinear_enabled;
int dithersub_enabled;
int fb_size;
uint32_t fb_mask;

File diff suppressed because it is too large Load diff

View file

@ -370,6 +370,7 @@ enum
FBZ_DEPTH_BIAS = (1 << 16),
FBZ_DITHER_SUB = (1 << 19),
FBZ_DEPTH_SOURCE = (1 << 20),
FBZ_PARAM_ADJUST = (1 << 26)
@ -689,3 +690,5 @@ enum
#define depth_op ( (params->fbzMode >> 5) & 7)
#define dither ( params->fbzMode & FBZ_DITHER)
#define dither2x2 (params->fbzMode & FBZ_DITHER_2x2)
#define dithersub (params->fbzMode & FBZ_DITHER_SUB)

View file

@ -1281,7 +1281,21 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
ALPHA_TEST(src_a);
if (params->alphaMode & (1 << 4))
{
if (dithersub && !dither2x2 && voodoo->dithersub_enabled)
{
dest_r = dithersub_rb[dest_r][real_y & 3][x & 3];
dest_g = dithersub_g [dest_g][real_y & 3][x & 3];
dest_b = dithersub_rb[dest_b][real_y & 3][x & 3];
}
if (dithersub && dither2x2 && voodoo->dithersub_enabled)
{
dest_r = dithersub_rb2x2[dest_r][real_y & 1][x & 1];
dest_g = dithersub_g2x2 [dest_g][real_y & 1][x & 1];
dest_b = dithersub_rb2x2[dest_b][real_y & 1][x & 1];
}
ALPHA_BLEND(src_r, src_g, src_b, src_a);
}
if (update)
{