mirror of
https://github.com/86Box/86Box.git
synced 2026-02-23 09:58:19 -07:00
Voodoo stippling support for 3D
This commit is contained in:
@@ -254,6 +254,19 @@ voodoo_fb_writew(uint32_t addr, uint16_t val, void *priv)
|
||||
int colbfog_g = 0;
|
||||
int colbfog_b = 0;
|
||||
|
||||
if (params->fbzMode & FBZ_STIPPLE) {
|
||||
if (params->fbzMode & FBZ_STIPPLE_PATT) {
|
||||
int index = ((y & 3) << 3) | (~x & 7);
|
||||
if (!(params->stipple & (1 << index)))
|
||||
goto skip_pixel;
|
||||
} else {
|
||||
voodoo->params.stipple = (voodoo->params.stipple << 1) | (voodoo->params.stipple >> 31);
|
||||
if (!(voodoo->params.stipple & 0x80000000)) {
|
||||
goto skip_pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (params->fbzMode & FBZ_DEPTH_ENABLE) {
|
||||
uint16_t old_depth = *(uint16_t *) (&voodoo->fb_mem[write_addr_aux & voodoo->fb_mask]);
|
||||
|
||||
@@ -449,6 +462,19 @@ voodoo_fb_writel(uint32_t addr, uint32_t val, void *priv)
|
||||
int colbfog_g = 0;
|
||||
int colbfog_b = 0;
|
||||
|
||||
if (params->fbzMode & FBZ_STIPPLE) {
|
||||
if (params->fbzMode & FBZ_STIPPLE_PATT) {
|
||||
int index = ((y & 3) << 3) | (~(x + c) & 7);
|
||||
if (!(params->stipple & (1 << index)))
|
||||
goto skip_pixel;
|
||||
} else {
|
||||
voodoo->params.stipple = (voodoo->params.stipple << 1) | (voodoo->params.stipple >> 31);
|
||||
if (!(voodoo->params.stipple & 0x80000000)) {
|
||||
goto skip_pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (params->fbzMode & FBZ_DEPTH_ENABLE) {
|
||||
uint16_t old_depth = *(uint16_t *) (&voodoo->fb_mem[write_addr_aux & voodoo->fb_mask]);
|
||||
|
||||
|
||||
@@ -88,6 +88,8 @@ typedef struct voodoo_state_t {
|
||||
uint32_t texBaseAddr;
|
||||
|
||||
int lod_frac[2];
|
||||
|
||||
int stipple;
|
||||
} voodoo_state_t;
|
||||
|
||||
#ifdef ENABLE_VOODOO_RENDER_LOG
|
||||
@@ -990,6 +992,20 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *
|
||||
w_depth = 0xffff;
|
||||
}
|
||||
|
||||
if (params->fbzMode & FBZ_STIPPLE) {
|
||||
if (params->fbzMode & FBZ_STIPPLE_PATT) {
|
||||
int index = ((real_y & 3) << 3) | (~x & 7);
|
||||
|
||||
if (!(state->stipple & (1 << index)))
|
||||
goto skip_pixel;
|
||||
} else {
|
||||
state->stipple = (state->stipple << 1) | (state->stipple >> 31);
|
||||
if (!(state->stipple & 0x80000000)) {
|
||||
goto skip_pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
w_depth = CLAMP16(w_depth);
|
||||
#endif
|
||||
@@ -1560,6 +1576,7 @@ voodoo_render_log("voodoo_triangle %i %i %i : vA %f, %f vB %f, %f vC %f, %f f
|
||||
if (lodbias & 0x20)
|
||||
lodbias |= ~0x3f;
|
||||
state.tmu[1].lod = LOD + (lodbias << 6);
|
||||
state.stipple = params->stipple;
|
||||
|
||||
voodoo_half_triangle(voodoo, params, &state, vertexAy_adjusted, vertexCy_adjusted, odd_even);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user