From 49ba35733e95e4ac1c95b9526c67c48b273a2f82 Mon Sep 17 00:00:00 2001 From: SarahW Date: Thu, 19 Nov 2020 19:38:34 +0000 Subject: [PATCH] Implement Banshee/V3 CLUT lookup on 16-bit RGB overlay. --- src/vid_voodoo_banshee.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/vid_voodoo_banshee.c b/src/vid_voodoo_banshee.c index 7bf2359..f3a7868 100644 --- a/src/vid_voodoo_banshee.c +++ b/src/vid_voodoo_banshee.c @@ -150,6 +150,8 @@ enum #define VIDPROCCFG_CURSOR_MODE (1 << 1) #define VIDPROCCFG_HALF_MODE (1 << 4) #define VIDPROCCFG_OVERLAY_ENABLE (1 << 8) +#define VIDPROCCFG_OVERLAY_CLUT_BYPASS (1 << 11) +#define VIDPROCCFG_OVERLAY_CLUT_SEL (1 << 13) #define VIDPROCCFG_H_SCALE_ENABLE (1 << 14) #define VIDPROCCFG_V_SCALE_ENABLE (1 << 15) #define VIDPROCCFG_FILTER_MODE_MASK (3 << 16) @@ -1641,7 +1643,12 @@ void banshee_hwcursor_draw(svga_t *svga, int displine) int g = (data >> 5) & 0x3f; \ int b = data >> 11; \ \ - buf[wp++] = (r << 3) | (g << 10) | (b << 19); \ + if (banshee->vidProcCfg & VIDPROCCFG_OVERLAY_CLUT_BYPASS) \ + buf[wp++] = (r << 3) | (g << 10) | (b << 19); \ + else \ + buf[wp++] = (clut[r << 3] & 0x0000ff) | \ + (clut[g << 2] & 0x00ff00) | \ + (clut[b << 3] & 0xff0000); \ src += 2; \ } \ } while (0) @@ -1660,7 +1667,12 @@ void banshee_hwcursor_draw(svga_t *svga, int displine) int g = (data >> 5) & 0x3f; \ int b = data >> 11; \ \ - buf[wp++] = (r << 3) | (g << 10) | (b << 19); \ + if (banshee->vidProcCfg & VIDPROCCFG_OVERLAY_CLUT_BYPASS) \ + buf[wp++] = (r << 3) | (g << 10) | (b << 19); \ + else \ + buf[wp++] = (clut[r << 3] & 0x0000ff) | \ + (clut[g << 2] & 0x00ff00) | \ + (clut[b << 3] & 0xff0000); \ } \ } while (0) @@ -1928,6 +1940,7 @@ static void banshee_overlay_draw(svga_t *svga, int displine) uint32_t src_x = 0; unsigned int y_coeff = (voodoo->overlay.src_y & 0xfffff) >> 4; int skip_filtering; + uint32_t *clut = &svga->pallook[(banshee->vidProcCfg & VIDPROCCFG_OVERLAY_CLUT_SEL) ? 256 : 0]; if (svga->render == svga_render_null && !svga->changedvram[src_addr >> 12] && !svga->changedvram[src_addr2 >> 12] &&