summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/glide/fxapi.c8
-rw-r--r--src/mesa/drivers/glide/fxdd.c138
-rw-r--r--src/mesa/drivers/glide/fxddspan.c20
-rw-r--r--src/mesa/drivers/glide/fxddtex.c11
-rw-r--r--src/mesa/drivers/glide/fxdrv.h8
-rw-r--r--src/mesa/drivers/glide/fxglidew.c8
-rw-r--r--src/mesa/drivers/glide/fxsetup.c33
7 files changed, 66 insertions, 160 deletions
diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c
index b726240cba..57d5034557 100644
--- a/src/mesa/drivers/glide/fxapi.c
+++ b/src/mesa/drivers/glide/fxapi.c
@@ -555,19 +555,19 @@ fxMesaCreateContext(GLuint win,
grGet(GR_MEMORY_TMU, 4, &result);
tmuRam = result / (1024 * 1024);
grGet(GR_MEMORY_FB, 4, &result);
- fbRam = result / 1024;
+ fbRam = result / (1024 * 1024);
}
END_BOARD_LOCK();
- sprintf(fxMesa->rendererString, "Mesa %s v0.51 %s %dkB FB, %dMB TM, %d TMU, %s",
+ sprintf(fxMesa->rendererString, "Mesa %s v0.51 %s %dMB FB, %dMB TM, %d TMU, %s",
grGetString(GR_RENDERER),
grGetString(GR_HARDWARE),
fbRam,
tmuRam * voodoo->nTexelfx,
voodoo->nTexelfx,
(voodoo->numChips > 1) ? "SLI" : "NOSLI");
-
- fxInitPixelTables(fxMesa, useBGR);
+
+ fxMesa->bgrOrder = useBGR;
/* screen */
fxMesa->screen_width = FX_grSstScreenWidth();
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index 895271fcba..8743148b49 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -58,13 +58,6 @@
-/* These lookup table are used to extract RGB values in [0,255] from
- * 16-bit pixel values.
- */
-GLubyte FX_PixelToR[0x10000];
-GLubyte FX_PixelToG[0x10000];
-GLubyte FX_PixelToB[0x10000];
-
/* lookup table for scaling 4 bit colors up to 8 bits */
GLuint FX_rgb_scale_4[16] = {
0, 17, 34, 51, 68, 85, 102, 119,
@@ -93,39 +86,6 @@ GLuint FX_rgb_scale_6[64] = {
/*
- * Initialize the FX_PixelTo{RGB} arrays.
- * Input: bgrOrder - if TRUE, pixels are in BGR order, else RGB order.
- */
-void
-fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder)
-{
- GLuint pixel;
-
- fxMesa->bgrOrder = bgrOrder;
- for (pixel = 0; pixel <= 0xffff; pixel++) {
- GLuint r, g, b;
- if (bgrOrder) {
- r = (pixel & 0x001F) << 3;
- g = (pixel & 0x07E0) >> 3;
- b = (pixel & 0xF800) >> 8;
- }
- else {
- r = (pixel & 0xF800) >> 8;
- g = (pixel & 0x07E0) >> 3;
- b = (pixel & 0x001F) << 3;
- }
- /* fill in low-order bits with proper rounding */
- r = (GLuint)(((double)r * 255. / 0xF8) + 0.5);
- g = (GLuint)(((double)g * 255. / 0xFC) + 0.5);
- b = (GLuint)(((double)b * 255. / 0xF8) + 0.5);
- FX_PixelToR[pixel] = r;
- FX_PixelToG[pixel] = g;
- FX_PixelToB[pixel] = b;
- }
-}
-
-
-/*
* Disable color by masking out R, G, B, A
*/
static void fxDisableColor (fxMesaContext fxMesa)
@@ -577,27 +537,13 @@ fxDDDrawBitmap2 (GLcontext *ctx, GLint px, GLint py,
GLint g = (GLint) (ctx->Current.RasterColor[GCOMP] * 255.0f);
GLint b = (GLint) (ctx->Current.RasterColor[BCOMP] * 255.0f);
GLint a = (GLint) (ctx->Current.RasterColor[ACOMP] * 255.0f);
-#if 0
- /* [dBorca]
- * who uses bgr, anyway? Expecting the V2 from HM... :D
- */
- if (fxMesa->bgrOrder)
- color = (FxU16)
- (((FxU16) 0xf8 & b) << (11 - 3)) |
- (((FxU16) 0xfc & g) << (5 - 3 + 1)) | (((FxU16) 0xf8 & r) >> 3);
- else
- color = (FxU16)
- (((FxU16) 0xf8 & r) << (11 - 3)) |
- (((FxU16) 0xfc & g) << (5 - 3 + 1)) | (((FxU16) 0xf8 & b) >> 3);
-#else
if (fxMesa->colDepth == 15) {
color = TDFXPACKCOLOR1555(b, g, r, a);
mode = GR_LFBWRITEMODE_1555;
} else {
- color = TDFXPACKCOLOR565(b, g, r);
+ color = fxMesa->bgrOrder ? TDFXPACKCOLOR565(r, g, b) : TDFXPACKCOLOR565(b, g, r);
mode = GR_LFBWRITEMODE_565;
}
-#endif
}
info.size = sizeof(info);
@@ -755,21 +701,7 @@ fxDDDrawBitmap4 (GLcontext *ctx, GLint px, GLint py,
GLint g = (GLint) (ctx->Current.RasterColor[GCOMP] * 255.0f);
GLint b = (GLint) (ctx->Current.RasterColor[BCOMP] * 255.0f);
GLint a = (GLint) (ctx->Current.RasterColor[ACOMP] * 255.0f);
-#if 0
- /* [dBorca]
- * who uses bgr, anyway? Expecting the V2 from HM... :D
- */
- if (fxMesa->bgrOrder)
- color = (FxU16)
- (((FxU16) 0xf8 & b) << (11 - 3)) |
- (((FxU16) 0xfc & g) << (5 - 3 + 1)) | (((FxU16) 0xf8 & r) >> 3);
- else
- color = (FxU16)
- (((FxU16) 0xf8 & r) << (11 - 3)) |
- (((FxU16) 0xfc & g) << (5 - 3 + 1)) | (((FxU16) 0xf8 & b) >> 3);
-#else
color = TDFXPACKCOLOR8888(b, g, r, a);
-#endif
}
info.size = sizeof(info);
@@ -889,20 +821,18 @@ fxDDReadPixels565 (GLcontext * ctx,
GLubyte *d = dst;
for (col = 0; col < halfWidth; col++) {
const GLuint pixel = ((const GLuint *) src)[col];
- const GLint pixel0 = pixel & 0xffff;
- const GLint pixel1 = pixel >> 16;
- *d++ = FX_PixelToR[pixel0];
- *d++ = FX_PixelToG[pixel0];
- *d++ = FX_PixelToB[pixel0];
- *d++ = FX_PixelToR[pixel1];
- *d++ = FX_PixelToG[pixel1];
- *d++ = FX_PixelToB[pixel1];
+ *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f];
+ *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f];
+ *d++ = FX_rgb_scale_5[ pixel & 0x1f];
+ *d++ = FX_rgb_scale_5[(pixel >> 27) & 0x1f];
+ *d++ = FX_rgb_scale_6[(pixel >> 21) & 0x3f];
+ *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f];
}
if (extraPixel) {
GLushort pixel = src[width - 1];
- *d++ = FX_PixelToR[pixel];
- *d++ = FX_PixelToG[pixel];
- *d++ = FX_PixelToB[pixel];
+ *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f];
+ *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f];
+ *d++ = FX_rgb_scale_5[ pixel & 0x1f];
}
dst += dstStride;
src -= srcStride;
@@ -917,22 +847,20 @@ fxDDReadPixels565 (GLcontext * ctx,
GLubyte *d = dst;
for (col = 0; col < halfWidth; col++) {
const GLuint pixel = ((const GLuint *) src)[col];
- const GLint pixel0 = pixel & 0xffff;
- const GLint pixel1 = pixel >> 16;
- *d++ = FX_PixelToR[pixel0];
- *d++ = FX_PixelToG[pixel0];
- *d++ = FX_PixelToB[pixel0];
+ *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f];
+ *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f];
+ *d++ = FX_rgb_scale_5[ pixel & 0x1f];
*d++ = 255;
- *d++ = FX_PixelToR[pixel1];
- *d++ = FX_PixelToG[pixel1];
- *d++ = FX_PixelToB[pixel1];
+ *d++ = FX_rgb_scale_5[(pixel >> 27) & 0x1f];
+ *d++ = FX_rgb_scale_6[(pixel >> 21) & 0x3f];
+ *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f];
*d++ = 255;
}
if (extraPixel) {
const GLushort pixel = src[width - 1];
- *d++ = FX_PixelToR[pixel];
- *d++ = FX_PixelToG[pixel];
- *d++ = FX_PixelToB[pixel];
+ *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f];
+ *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f];
+ *d++ = FX_rgb_scale_5[ pixel & 0x1f];
*d++ = 255;
}
dst += dstStride;
@@ -1005,18 +933,18 @@ fxDDReadPixels555 (GLcontext * ctx,
GLubyte *d = dst;
for (col = 0; col < halfWidth; col++) {
const GLuint pixel = ((const GLuint *) src)[col];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
*d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 21) & 0x1f];
+ *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
+ *d++ = FX_rgb_scale_5[ pixel & 0x1f];
*d++ = FX_rgb_scale_5[(pixel >> 26) & 0x1f];
+ *d++ = FX_rgb_scale_5[(pixel >> 21) & 0x1f];
+ *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f];
}
if (extraPixel) {
GLushort pixel = src[width - 1];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
*d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f];
+ *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
+ *d++ = FX_rgb_scale_5[ pixel & 0x1f];
}
dst += dstStride;
src -= srcStride;
@@ -1031,20 +959,20 @@ fxDDReadPixels555 (GLcontext * ctx,
GLubyte *d = dst;
for (col = 0; col < halfWidth; col++) {
const GLuint pixel = ((const GLuint *) src)[col];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
*d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f];
+ *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
+ *d++ = FX_rgb_scale_5[ pixel & 0x1f];
*d++ = (pixel & 0x8000) ? 255 : 0;
- *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 21) & 0x1f];
*d++ = FX_rgb_scale_5[(pixel >> 26) & 0x1f];
+ *d++ = FX_rgb_scale_5[(pixel >> 21) & 0x1f];
+ *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f];
*d++ = (pixel & 0x80000000) ? 255 : 0;
}
if (extraPixel) {
const GLushort pixel = src[width - 1];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
*d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f];
+ *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
+ *d++ = FX_rgb_scale_5[ pixel & 0x1f];
*d++ = (pixel & 0x8000) ? 255 : 0;
}
dst += dstStride;
@@ -1377,7 +1305,9 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
if (fxMesa->haveZBuffer)
grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
- grLfbWriteColorFormat(GR_COLORFORMAT_ABGR);
+ if (!fxMesa->bgrOrder) {
+ grLfbWriteColorFormat(GR_COLORFORMAT_ABGR);
+ }
fxMesa->textureAlign = FX_grGetInteger(GR_TEXTURE_ALIGN);
/* [koolsmoky] */
diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c
index 3e242f9bd7..158e34e08e 100644
--- a/src/mesa/drivers/glide/fxddspan.c
+++ b/src/mesa/drivers/glide/fxddspan.c
@@ -406,18 +406,6 @@ static void fxReadRGBASpan_RGB565 (const GLcontext * ctx,
for (i = j = 0; i < n; i += 2, j++) {
GLuint pixel = data32[j];
-#if 0
- GLuint pixel0 = pixel & 0xffff;
- GLuint pixel1 = pixel >> 16;
- rgba[i][RCOMP] = FX_PixelToR[pixel0];
- rgba[i][GCOMP] = FX_PixelToG[pixel0];
- rgba[i][BCOMP] = FX_PixelToB[pixel0];
- rgba[i][ACOMP] = 255;
- rgba[i + 1][RCOMP] = FX_PixelToR[pixel1];
- rgba[i + 1][GCOMP] = FX_PixelToG[pixel1];
- rgba[i + 1][BCOMP] = FX_PixelToB[pixel1];
- rgba[i + 1][ACOMP] = 255;
-#else
rgba[i][0] = FX_rgb_scale_5[(pixel >> 11) & 0x1F];
rgba[i][1] = FX_rgb_scale_6[(pixel >> 5) & 0x3F];
rgba[i][2] = FX_rgb_scale_5[ pixel & 0x1F];
@@ -426,21 +414,13 @@ static void fxReadRGBASpan_RGB565 (const GLcontext * ctx,
rgba[i+1][1] = FX_rgb_scale_6[(pixel >> 21) & 0x3F];
rgba[i+1][2] = FX_rgb_scale_5[(pixel >> 16) & 0x1F];
rgba[i+1][3] = 255;
-#endif
}
if (extraPixel) {
GLushort pixel = data16[n];
-#if 0
- rgba[n][RCOMP] = FX_PixelToR[pixel];
- rgba[n][GCOMP] = FX_PixelToG[pixel];
- rgba[n][BCOMP] = FX_PixelToB[pixel];
- rgba[n][ACOMP] = 255;
-#else
rgba[n][0] = FX_rgb_scale_5[(pixel >> 11) & 0x1F];
rgba[n][1] = FX_rgb_scale_6[(pixel >> 5) & 0x3F];
rgba[n][2] = FX_rgb_scale_5[ pixel & 0x1F];
rgba[n][3] = 255;
-#endif
}
grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
index c425549d9c..16710bd232 100644
--- a/src/mesa/drivers/glide/fxddtex.c
+++ b/src/mesa/drivers/glide/fxddtex.c
@@ -864,8 +864,8 @@ GLboolean fxDDIsCompressedFormat ( GLcontext *ctx, GLenum internalFormat )
/* [dBorca]
* we are handling differently the above formats from the generic
- * GL_COMPRESSED_RGB[A]. For this, we will always separately
- * check for the ones below!
+ * GL_COMPRESSED_RGB[A]. For this, we will always have to separately
+ * check the below formats...
*/
#if FX_TC_NCC || FX_TC_NAPALM
@@ -1495,7 +1495,7 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target,
/* choose the texture format */
assert(ctx->Driver.ChooseTextureFormat);
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, format, type);
+ internalFormat, -1/*format*/, -1/*type*/);
assert(texImage->TexFormat);
/* Determine the appropriate Glide texel format,
@@ -1542,11 +1542,12 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target,
}
#endif
+ ti->info.format = mml->glideFormat;
+ texImage->FetchTexel = fxFetchFunction(texImage->TexFormat->MesaFormat);
+
/* [dBorca] Hack alert:
* what about different size/texel? other anomalies? SW rescaling?
*/
- ti->info.format = mml->glideFormat;
- texImage->FetchTexel = fxFetchFunction(texImage->TexFormat->MesaFormat);
/* [dBorca]
* Hack alert: unsure...
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index 46b53574a9..c109f22f1e 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -409,13 +409,6 @@ tfxUnitsState;
_NEW_COLOR) \
-/* These lookup table are used to extract RGB values in [0,255] from
- * 16-bit pixel values.
- */
-extern GLubyte FX_PixelToR[0x10000];
-extern GLubyte FX_PixelToG[0x10000];
-extern GLubyte FX_PixelToB[0x10000];
-
/* lookup table for scaling y bit colors up to 8 bits */
extern GLuint FX_rgb_scale_4[16];
extern GLuint FX_rgb_scale_5[32];
@@ -688,7 +681,6 @@ extern void fxDDDestroyFxMesaContext(fxMesaContext fxMesa);
extern void fxSetScissorValues(GLcontext * ctx);
extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
struct gl_texture_object *tObj, GLint where);
-extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
extern void fxCheckIsInHardware(GLcontext *ctx);
diff --git a/src/mesa/drivers/glide/fxglidew.c b/src/mesa/drivers/glide/fxglidew.c
index ff4454d9a8..76df028693 100644
--- a/src/mesa/drivers/glide/fxglidew.c
+++ b/src/mesa/drivers/glide/fxglidew.c
@@ -194,7 +194,9 @@ FX_grSstQueryHardware(GrHwConfiguration * config)
grSstSelect(i);
extension = grGetString(GR_HARDWARE);
- if (strstr(extension, "Voodoo Banshee")) {
+ if (strstr(extension, "Voodoo2")) {
+ config->SSTs[i].type = GR_SSTTYPE_Voodoo2;
+ } else if (strstr(extension, "Voodoo Banshee")) {
config->SSTs[i].type = GR_SSTTYPE_Banshee;
} else if (strstr(extension, "Voodoo3")) {
config->SSTs[i].type = GR_SSTTYPE_Voodoo3;
@@ -202,8 +204,8 @@ FX_grSstQueryHardware(GrHwConfiguration * config)
config->SSTs[i].type = GR_SSTTYPE_Voodoo4;
} else if (strstr(extension, "Voodoo5")) {
config->SSTs[i].type = GR_SSTTYPE_Voodoo5;
- } else { /* Voodoo1,2,rush */
- /* ZZZ TO DO: Need to distinguish whether we have V1 or V2 or Rush. */
+ } else { /* Voodoo1,rush */
+ /* ZZZ TO DO: Need to distinguish whether we have V1 or Rush. */
config->SSTs[i].type = GR_SSTTYPE_VOODOO;
}
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c
index 6e929257db..22c34cecaf 100644
--- a/src/mesa/drivers/glide/fxsetup.c
+++ b/src/mesa/drivers/glide/fxsetup.c
@@ -803,33 +803,27 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
}
}
+ /* [dBorca] Hack alert:
+ * we put these in reverse order, so that if we can't
+ * do _REAL_ pointcast, the TMU0 table gets broadcasted
+ */
if (!fxMesa->haveGlobalPaletteTexture) {
/* pointcast */
- if (ti0->info.format == GR_TEXFMT_P_8) {
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: uploading texture palette for TMU0\n", __FUNCTION__);
- }
- fxMesa->Glide.grTexDownloadTableExt(ti0->whichTMU, ti0->paltype, &(ti0->palette));
- }
-#if 1
- else /* does anyone guess why is this here? :D */
-#endif
if (ti1->info.format == GR_TEXFMT_P_8) {
if (TDFX_DEBUG & VERBOSE_DRIVER) {
fprintf(stderr, "%s: uploading texture palette for TMU1\n", __FUNCTION__);
}
fxMesa->Glide.grTexDownloadTableExt(ti1->whichTMU, ti1->paltype, &(ti1->palette));
}
+ if (ti0->info.format == GR_TEXFMT_P_8) {
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s: uploading texture palette for TMU0\n", __FUNCTION__);
+ }
+ fxMesa->Glide.grTexDownloadTableExt(ti0->whichTMU, ti0->paltype, &(ti0->palette));
+ }
}
#if FX_TC_NCC
/* pointcast */
- if ((ti0->info.format == GR_TEXFMT_AYIQ_8422) ||
- (ti0->info.format == GR_TEXFMT_YIQ_422)) {
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: uploading NCC0 table for TMU0\n", __FUNCTION__);
- }
- fxMesa->Glide.grTexDownloadTableExt(ti0->whichTMU, GR_TEXTABLE_NCC0, &(ti0->palette));
- }
if ((ti1->info.format == GR_TEXFMT_AYIQ_8422) ||
(ti1->info.format == GR_TEXFMT_YIQ_422)) {
if (TDFX_DEBUG & VERBOSE_DRIVER) {
@@ -837,6 +831,13 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
}
fxMesa->Glide.grTexDownloadTableExt(ti1->whichTMU, GR_TEXTABLE_NCC0, &(ti1->palette));
}
+ if ((ti0->info.format == GR_TEXFMT_AYIQ_8422) ||
+ (ti0->info.format == GR_TEXFMT_YIQ_422)) {
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s: uploading NCC0 table for TMU0\n", __FUNCTION__);
+ }
+ fxMesa->Glide.grTexDownloadTableExt(ti0->whichTMU, GR_TEXTABLE_NCC0, &(ti0->palette));
+ }
#endif
grTexSource(tmu0, ti0->tm[tmu0]->startAddr,