From 44c699949ac09459771304a8aec8f2fc622057fb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 11 Jul 2003 16:33:43 +0000 Subject: DOS updates from Daniel Borca --- docs/README.DJ | 11 +++++------ src/mesa/drivers/dos/video.c | 29 ++++++++++++++++------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/docs/README.DJ b/docs/README.DJ index 08ebd90cfc7..26fd9d05396 100644 --- a/docs/README.DJ +++ b/docs/README.DJ @@ -49,7 +49,7 @@ Available options: default = no HAVE_MMX=1 allow MMX specializations, provided your assembler supports MMX instruction set. However, the true CPU - capabilities are checked at run-time to avoid crashes. + capabilities are checked at run-time to avoid lockups. default = no HAVE_SSE=1 (see HAVE_MMX) default = no @@ -80,8 +80,7 @@ FAQ: 1. Compilation - Q) I tried to run `make' and it exits because `gcc' complains it cannot find - some stupid file. + Q) `make' barfs and exits because it cannot find some stupid file. A) You need LFN support. A) When compiling for Glide (FX=1), pay attention to Glide path. @@ -89,10 +88,10 @@ FAQ: compile some demo. A) Upgrade to DJGPP 2.04. A) Add `vsnprintf.c' to the CORE_SOURCES in `src/Makefile.DJ' (untested!). - A) The following hack should be safe in 90% of the cases, but if anything - goes wrong, don't come back to me crying. Anyway, patch `src/imports.c' - with the following line: + A) Patch `src/mesa/main/imports.c' with the following line: #define vsnprintf(buf, max, fmt, arg) vsprintf(buf, fmt, arg) + This hack should be safe in 90% of the cases, but if anything goes wrong, + don't come back to me crying. Q) `make' complains about DXE3 or something, yet it builds the libraries. A) DXE3 refers to the DJGPP dynamic modules. You'll need either the latest diff --git a/src/mesa/drivers/dos/video.c b/src/mesa/drivers/dos/video.c index 6c0f56f629d..35c643b4c9a 100644 --- a/src/mesa/drivers/dos/video.c +++ b/src/mesa/drivers/dos/video.c @@ -58,9 +58,9 @@ int vl_current_offset, vl_current_delta; /* These lookup tables are used to extract RGB values in [0,255] * from 15/16-bit pixel values. */ -static unsigned char pix15r[0x10000]; -static unsigned char pix15g[0x10000]; -static unsigned char pix15b[0x10000]; +static unsigned char pix15r[0x8000]; +static unsigned char pix15g[0x8000]; +static unsigned char pix15b[0x8000]; static unsigned char pix16r[0x10000]; static unsigned char pix16g[0x10000]; static unsigned char pix16b[0x10000]; @@ -226,6 +226,7 @@ static void v_getrgba15 (unsigned int offset, unsigned char rgba[4]) { word32 c = ((word16 *)vl_current_read_buffer)[offset]; #if HUGE_LOOKUP + c &= 0x7fff; rgba[0] = pix15r[c]; rgba[1] = pix15g[c]; rgba[2] = pix15b[c]; @@ -378,18 +379,20 @@ void v_init_pixeltables (void) for (pixel = 0; pixel <= 0xffff; pixel++) { unsigned int r, g, b; - /* 15bit */ - r = (pixel & 0x7c00) >> 8; - g = (pixel & 0x03E0) >> 3; - b = (pixel & 0x001F) << 2; + if (pixel <= 0x7fff) { + /* 15bit */ + r = (pixel & 0x7c00) >> 8; + g = (pixel & 0x03E0) >> 3; + b = (pixel & 0x001F) << 2; - r = (unsigned int)(((double)r * 255. / 0x7c) + 0.5); - g = (unsigned int)(((double)g * 255. / 0x7c) + 0.5); - b = (unsigned int)(((double)b * 255. / 0x7c) + 0.5); + r = (unsigned int)(((double)r * 255. / 0x7c) + 0.5); + g = (unsigned int)(((double)g * 255. / 0x7c) + 0.5); + b = (unsigned int)(((double)b * 255. / 0x7c) + 0.5); - pix15r[pixel] = r; - pix15g[pixel] = g; - pix15b[pixel] = b; + pix15r[pixel] = r; + pix15g[pixel] = g; + pix15b[pixel] = b; + } /* 16bit */ r = (pixel & 0xF800) >> 8; -- cgit v1.2.3