From 19348f678f4a89ff492e062c971a63d021f1f19a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 9 Mar 2022 20:00:59 +0900 Subject: [PATCH] [win] Get the software renderer hobbling 16 and 32 bit rendering are disabled at the moment because there's a weird segfault I need to fix, but the 8-bit dynamic lights are doing weird things (for x11, too) when updating the light maps. --- libs/video/targets/vid_win.c | 1 + libs/video/targets/vid_win_sw.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/libs/video/targets/vid_win.c b/libs/video/targets/vid_win.c index 02b919f04..47e62ef29 100644 --- a/libs/video/targets/vid_win.c +++ b/libs/video/targets/vid_win.c @@ -152,6 +152,7 @@ VID_Init_Cvars (void) Win_Vulkan_Init_Cvars (); #endif Win_GL_Init_Cvars (); + Win_SW_Init_Cvars (); } void diff --git a/libs/video/targets/vid_win_sw.c b/libs/video/targets/vid_win_sw.c index 9ded596fb..69e099b08 100644 --- a/libs/video/targets/vid_win_sw.c +++ b/libs/video/targets/vid_win_sw.c @@ -50,6 +50,8 @@ static win_palette_t st2d_8to32table[256]; static byte current_palette[768]; static int palette_changed; +static cvar_t *vid_bitdepth; + static LPDIRECTDRAW dd_Object; static HINSTANCE hInstDDraw; static LPDIRECTDRAWSURFACE dd_frontbuffer; @@ -469,14 +471,32 @@ sw_ctx_t * Win_SW_Context (void) { sw_ctx_t *ctx = calloc (1, sizeof (sw_ctx_t)); + ctx->pixbytes = 1; ctx->set_palette = win_set_palette; ctx->choose_visual = win_choose_visual; ctx->create_context = win_create_context; ctx->update = win_sw_update; +#if 0 //FIXME need to figure out 16 and 32 bit buffers + switch (vid_bitdepth->int_val) { + case 8: + ctx->pixbytes = 1; + break; + case 16: + ctx->pixbytes = 2; + break; + case 32: + ctx->pixbytes = 4; + break; + default: + Sys_Error ("X11_SW32_Context: unsupported bit depth"); + } +#endif return ctx; } void Win_SW_Init_Cvars (void) { + vid_bitdepth = Cvar_Get ("vid_bitdepth", "8", CVAR_ROM, NULL, "Sets " + "display bitdepth (supported modes: 8 16 32)"); }