summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/glide
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/glide')
-rw-r--r--src/mesa/drivers/glide/fxapi.c28
-rw-r--r--src/mesa/drivers/glide/fxdd.c65
-rw-r--r--src/mesa/drivers/glide/fxddspan.c8
-rw-r--r--src/mesa/drivers/glide/fxddtex.c158
-rw-r--r--src/mesa/drivers/glide/fxdrv.h3
-rw-r--r--src/mesa/drivers/glide/fxg.c42
-rw-r--r--src/mesa/drivers/glide/fxglidew.c3
-rw-r--r--src/mesa/drivers/glide/fxglidew.h4
-rw-r--r--src/mesa/drivers/glide/fxopengl.def8
-rw-r--r--src/mesa/drivers/glide/fxsetup.c63
-rw-r--r--src/mesa/drivers/glide/fxsetup.h33
-rw-r--r--src/mesa/drivers/glide/fxtexman.c30
-rw-r--r--src/mesa/drivers/glide/fxtris.c206
-rw-r--r--src/mesa/drivers/glide/fxvb.c66
-rw-r--r--src/mesa/drivers/glide/fxvbtmp.h22
-rw-r--r--src/mesa/drivers/glide/fxwgl.c80
16 files changed, 570 insertions, 249 deletions
diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c
index 57d5034557..e928b156eb 100644
--- a/src/mesa/drivers/glide/fxapi.c
+++ b/src/mesa/drivers/glide/fxapi.c
@@ -158,7 +158,7 @@ gl3DfxSetPaletteEXT(GLuint * pal)
if (TDFX_DEBUG & VERBOSE_DRIVER) {
int i;
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "gl3DfxSetPaletteEXT(...)\n");
for (i = 0; i < 256; i++) {
fprintf(stderr, "\t%x\n", pal[i]);
@@ -245,7 +245,7 @@ fxMesaCreateContext(GLuint win,
GLboolean useBGR;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxMesaCreateContext(...)\n");
}
/* Okay, first process the user flags */
@@ -288,15 +288,15 @@ fxMesaCreateContext(GLuint win,
}
break;
default:
- fprintf(stderr, "%s: ERROR: wrong parameter (%d) passed\n", __FUNCTION__, attribList[i]);
+ fprintf(stderr, "fxMesaCreateContext: ERROR: wrong parameter (%d) passed\n", attribList[i]);
return NULL;
}
i++;
}
if (!fxQueryHardware()) {
- fprintf(stderr, "%s: ERROR: no Voodoo hardware!\n", __FUNCTION__);
- return NULL;
+ str = "no Voodoo hardware!";
+ goto errorhandler;
}
grSstSelect(glbCurrentBoard);
@@ -324,9 +324,11 @@ fxMesaCreateContext(GLuint win,
fxMesa->HaveCmbExt = voodoo->HaveCmbExt;
fxMesa->HaveMirExt = voodoo->HaveMirExt;
fxMesa->HaveTexUma = voodoo->HaveTexUma;
- fxMesa->HaveTexus2 = voodoo->HaveTexus2;
fxMesa->Glide = glbHWConfig.Glide;
Glide = &fxMesa->Glide;
+ fxMesa->HaveTexus2 = Glide->txImgQuantize &&
+ Glide->txMipQuantize &&
+ Glide->txPalToNcc;
/*
* Pixel tables are used during pixel read-back
@@ -689,7 +691,7 @@ errorhandler:
FREE(fxMesa);
}
- fprintf(stderr, "%s: ERROR: %s\n", __FUNCTION__, str);
+ fprintf(stderr, "fxMesaCreateContext: ERROR: %s\n", str);
return NULL;
}
@@ -712,7 +714,7 @@ void GLAPIENTRY
fxMesaDestroyContext(fxMesaContext fxMesa)
{
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxMesaDestroyContext(...)\n");
}
if (!fxMesa)
@@ -776,7 +778,7 @@ fxMesaMakeCurrent(fxMesaContext fxMesa)
fxMesaCurrentCtx = NULL;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(NULL)\n", __FUNCTION__);
+ fprintf(stderr, "fxMesaMakeCurrent(NULL)\n");
}
return;
@@ -786,14 +788,14 @@ fxMesaMakeCurrent(fxMesaContext fxMesa)
if (fxMesaCurrentCtx == fxMesa
&& fxMesaCurrentCtx->glCtx == _mesa_get_current_context()) {
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(fxMesaCurrentCtx==fxMesa)\n", __FUNCTION__);
+ fprintf(stderr, "fxMesaMakeCurrent(NOP)\n");
}
return;
}
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxMesaMakeCurrent(...)\n");
}
if (fxMesaCurrentCtx)
@@ -821,7 +823,7 @@ void GLAPIENTRY
fxMesaSwapBuffers(void)
{
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s()\n", __FUNCTION__);
+ fprintf(stderr, "fxMesaSwapBuffers()\n");
}
if (fxMesaCurrentCtx) {
@@ -855,7 +857,7 @@ fxMesaSwapBuffers(void)
GLboolean GLAPIENTRY fxQueryHardware (void)
{
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s()\n", __FUNCTION__);
+ fprintf(stderr, "fxQueryHardware()\n");
}
if (!glbGlideInitialized) {
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index 557c003864..9c889a062d 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -113,7 +113,7 @@ fxDDBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
fxMesaContext fxMesa = FX_CONTEXT(ctx);
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxDDBufferSize(...)\n");
}
*width = fxMesa->width;
@@ -130,8 +130,8 @@ fxDDClearColor(GLcontext * ctx, const GLfloat color[4])
GLubyte col[4];
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%f, %f, %f, %f)\n", __FUNCTION__,
- color[0], color[1], color[2], color[3]);
+ fprintf(stderr, "fxDDClearColor(%f, %f, %f, %f)\n",
+ color[0], color[1], color[2], color[3]);
}
CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
@@ -146,8 +146,8 @@ fxDDClearColor(GLcontext * ctx, const GLfloat color[4])
/* Clear the color and/or depth buffers */
static void fxDDClear( GLcontext *ctx,
- GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height )
+ GLbitfield mask, GLboolean all,
+ GLint x, GLint y, GLint width, GLint height )
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLbitfield softwareMask = mask & (DD_ACCUM_BIT);
@@ -162,8 +162,8 @@ static void fxDDClear( GLcontext *ctx,
*/
if ( TDFX_DEBUG & MESA_VERBOSE ) {
- fprintf( stderr, "%s( %d, %d, %d, %d )\n",
- __FUNCTION__, (int) x, (int) y, (int) width, (int) height );
+ fprintf( stderr, "fxDDClear( %d, %d, %d, %d )\n",
+ (int) x, (int) y, (int) width, (int) height );
}
/* Need this check to respond to glScissor and clipping updates */
@@ -429,7 +429,7 @@ fxDDSetDrawBuffer(GLcontext * ctx, GLenum mode)
fxMesaContext fxMesa = FX_CONTEXT(ctx);
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%x)\n", __FUNCTION__, (int)mode);
+ fprintf(stderr, "fxDDSetDrawBuffer(%x)\n", (int)mode);
}
if (mode == GL_FRONT_LEFT) {
@@ -1218,7 +1218,7 @@ fxDDGetString(GLcontext * ctx, GLenum name)
switch (name) {
case GL_RENDERER:
return (GLubyte *)fxMesa->rendererString;
-#if 0 /* hack to advertise vanilla extension names */
+#if __WIN32__ /* hack to advertise vanilla extension names */
case GL_EXTENSIONS:
if (ctx->Extensions.String == NULL) {
GLubyte *ext = _mesa_make_extension_string(ctx);
@@ -1226,9 +1226,16 @@ fxDDGetString(GLcontext * ctx, GLenum name)
ctx->Extensions.String = _mesa_malloc(strlen((char *)ext) + 256);
if (ctx->Extensions.String != NULL) {
strcpy((char *)ctx->Extensions.String, (char *)ext);
-#if 0 /* put any additional extension names here */
+ /* put any additional extension names here */
+#if 0
strcat((char *)ctx->Extensions.String, " 3DFX_set_global_palette");
#endif
+#if __WIN32__
+ strcat((char *)ctx->Extensions.String, " WGL_3DFX_gamma_control");
+ strcat((char *)ctx->Extensions.String, " WGL_EXT_swap_control");
+ strcat((char *)ctx->Extensions.String, " WGL_EXT_extensions_string WGL_ARB_extensions_string");
+#endif
+ /* put any additional extension names here */
_mesa_free(ext);
} else {
ctx->Extensions.String = ext;
@@ -1249,7 +1256,7 @@ static const struct tnl_pipeline_stage *fx_pipeline[] = {
/*&_tnl_fog_coordinate_stage,*/ /* TODO: Omit fog stage ZZZ ZZZ ZZZ */
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
- /*&_tnl_point_attenuation_stage,*/ /* TODO: For AA primitives ZZZ ZZZ ZZZ */
+ &_tnl_point_attenuation_stage,
&_tnl_render_stage,
0,
};
@@ -1453,12 +1460,14 @@ fxDDInitExtensions(GLcontext * ctx)
* to stash the NCC decompression table into the mipmap data and adjust
* CompressedSize accordingly!
*/
- _mesa_enable_extension(ctx, "GL_ARB_texture_compression");
+ if (fxMesa->HaveTexus2) {
+ _mesa_enable_extension(ctx, "GL_ARB_texture_compression");
- if (fxMesa->type >= GR_SSTTYPE_Voodoo4) {
- _mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
- _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
- _mesa_enable_extension(ctx, "GL_S3_s3tc");
+ if (fxMesa->type >= GR_SSTTYPE_Voodoo4) {
+ _mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
+ _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
+ _mesa_enable_extension(ctx, "GL_S3_s3tc");
+ }
}
if (fxMesa->HaveCmbExt) {
@@ -1502,12 +1511,9 @@ fx_check_IsInHardware(GLcontext * ctx)
if (ctx->Color.BlendEnabled) {
if (ctx->Color.BlendEquation != GL_FUNC_ADD_EXT) {
- if (fxMesa->HavePixExt) {
- if ((ctx->Color.BlendEquation != GL_FUNC_SUBTRACT_EXT) &&
- (ctx->Color.BlendEquation != GL_FUNC_REVERSE_SUBTRACT_EXT)) {
- return FX_FALLBACK_BLEND;
- }
- } else {
+ if (!fxMesa->HavePixExt ||
+ ((ctx->Color.BlendEquation != GL_FUNC_SUBTRACT_EXT) &&
+ (ctx->Color.BlendEquation != GL_FUNC_REVERSE_SUBTRACT_EXT))) {
return FX_FALLBACK_BLEND;
}
}
@@ -1521,12 +1527,9 @@ fx_check_IsInHardware(GLcontext * ctx)
return FX_FALLBACK_SPECULAR;
}
- if ((ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP])
- ||
- (ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP])
- ||
- (ctx->Color.ColorMask[BCOMP] != ctx->Color.ColorMask[ACOMP])
- ) {
+ if ((fxMesa->colDepth == 16) &&
+ ((ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP]) ||
+ (ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]))) {
return FX_FALLBACK_COLORMASK;
}
@@ -1562,7 +1565,7 @@ fx_check_IsInHardware(GLcontext * ctx)
}
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "%s: envmode is %s/%s\n", __FUNCTION__,
+ fprintf(stderr, "fx_check_IsInHardware: envmode is %s/%s\n",
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
@@ -1583,7 +1586,7 @@ fx_check_IsInHardware(GLcontext * ctx)
(ctx->Texture.Unit[0].EnvMode != GL_MODULATE) &&
(ctx->Texture.Unit[0].EnvMode != GL_REPLACE)) { /* q2, seems ok... */
if (TDFX_DEBUG & VERBOSE_DRIVER)
- fprintf(stderr, "%s: unsupported multitex env mode\n", __FUNCTION__);
+ fprintf(stderr, "fx_check_IsInHardware: unsupported multitex env mode\n");
return FX_FALLBACK_TEXTURE_MULTI;
}
}
@@ -1634,7 +1637,7 @@ fxSetupDDPointers(GLcontext * ctx)
TNLcontext *tnl = TNL_CONTEXT(ctx);
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s()\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupDDPointers()\n");
}
ctx->Driver.UpdateState = fxDDUpdateDDPointers;
diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c
index 158e34e08e..4b9b2123b4 100644
--- a/src/mesa/drivers/glide/fxddspan.c
+++ b/src/mesa/drivers/glide/fxddspan.c
@@ -461,7 +461,7 @@ fxReadDepthSpan_Z16(GLcontext * ctx,
GLuint i;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxReadDepthSpan_Z16(...)\n");
}
grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth16);
@@ -480,7 +480,7 @@ fxReadDepthSpan_Z24(GLcontext * ctx,
GLuint i;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxReadDepthSpan_Z24(...)\n");
}
grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth);
@@ -512,7 +512,7 @@ fxReadStencilSpan(GLcontext * ctx,
GLuint i;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxReadStencilSpan(...)\n");
}
grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, zs32);
@@ -554,7 +554,7 @@ fxDDSetBuffer(GLcontext * ctx, GLframebuffer * buffer, GLuint bufferBit)
(void) buffer;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%x)\n", __FUNCTION__, (int)bufferBit);
+ fprintf(stderr, "fxDDSetBuffer(%x)\n", (int)bufferBit);
}
if (bufferBit == FRONT_LEFT_BIT) {
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
index da1e73d029..3ad0f22ce0 100644
--- a/src/mesa/drivers/glide/fxddtex.c
+++ b/src/mesa/drivers/glide/fxddtex.c
@@ -105,7 +105,7 @@ fxAllocTexObjData(fxMesaContext fxMesa)
tfxTexInfo *ti;
if (!(ti = CALLOC(sizeof(tfxTexInfo)))) {
- fprintf(stderr, "%s: ERROR: out of memory !\n", __FUNCTION__);
+ fprintf(stderr, "fxAllocTexObjData: ERROR: out of memory !\n");
fxCloseHardware();
exit(-1);
}
@@ -137,8 +137,7 @@ fxDDTexBind(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj)
tfxTexInfo *ti;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%d, %x)\n", __FUNCTION__, tObj->Name,
- (GLuint) tObj->DriverData);
+ fprintf(stderr, "fxDDTexBind(%d, %x)\n", tObj->Name, (GLuint)tObj->DriverData);
}
if (target != GL_TEXTURE_2D)
@@ -164,9 +163,9 @@ fxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname,
if (TDFX_DEBUG & VERBOSE_DRIVER) {
if (param)
- fprintf(stderr, "%s(%x, %x)\n", __FUNCTION__, pname, (GLint) (*param));
+ fprintf(stderr, "fxDDTexEnv(%x, %x)\n", pname, (GLint) (*param));
else
- fprintf(stderr, "%s(%x)\n", __FUNCTION__, pname);
+ fprintf(stderr, "fxDDTexEnv(%x)\n", pname);
}
/* apply any lod biasing right now */
@@ -340,7 +339,7 @@ fxDDTexDel(GLcontext * ctx, struct gl_texture_object *tObj)
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%d, %p)\n", __FUNCTION__, tObj->Name, (void *) ti);
+ fprintf(stderr, "fxDDTexDel(%d, %p)\n", tObj->Name, (void *) ti);
}
if (!ti)
@@ -442,7 +441,7 @@ fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj)
/* per-texture palette */
tfxTexInfo *ti;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%d, %x)\n", __FUNCTION__,
+ fprintf(stderr, "fxDDTexPalette(%d, %x)\n",
tObj->Name, (GLuint) tObj->DriverData);
}
if (!tObj->DriverData)
@@ -454,10 +453,12 @@ fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj)
else {
/* global texture palette */
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(global)\n", __FUNCTION__);
+ fprintf(stderr, "fxDDTexPalette(global)\n");
}
fxMesa->glbPalType = convertPalette(fxMesa, fxMesa->glbPalette.data, &ctx->Texture.Palette);
fxMesa->new_state |= FX_NEW_TEXTURING;
+
+ grTexDownloadTable(fxMesa->glbPalType, &(fxMesa->glbPalette));
}
}
@@ -468,13 +469,11 @@ fxDDTexUseGlbPalette(GLcontext * ctx, GLboolean state)
fxMesaContext fxMesa = FX_CONTEXT(ctx);
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%d)\n", __FUNCTION__, state);
+ fprintf(stderr, "fxDDTexUseGlbPalette(%d)\n", state);
}
if (state) {
fxMesa->haveGlobalPaletteTexture = 1;
-
- grTexDownloadTable(fxMesa->glbPalType, &(fxMesa->glbPalette));
}
else {
fxMesa->haveGlobalPaletteTexture = 0;
@@ -619,8 +618,10 @@ fxIsTexSupported(GLenum target, GLint internalFormat,
if (target != GL_TEXTURE_2D)
return GL_FALSE;
+#if 0
if (!fxTexGetInfo(image->Width, image->Height, NULL, NULL, NULL, NULL, NULL, NULL))
return GL_FALSE;
+#endif
if (image->Border > 0)
return GL_FALSE;
@@ -979,6 +980,59 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
}
switch (internalFormat) {
+ case GL_COMPRESSED_RGB:
+#if 0 && FX_TC_NAPALM /* [koolsmoky] */
+ if (ctx->Extensions.TDFX_texture_compression_FXT1) {
+ return &_mesa_texformat_rgb_fxt1;
+ } else if (ctx->Extensions.EXT_texture_compression_s3tc) {
+ return &_mesa_texformat_rgb_dxt1;
+ }
+#endif
+ /* intentional fall through */
+ case 3:
+ case GL_RGB:
+ if ( srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5 ) {
+ return &_mesa_texformat_rgb565;
+ }
+ /* intentional fall through */
+ case GL_RGB8:
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ return (allow32bpt) ? &_mesa_texformat_argb8888
+ : &_mesa_texformat_rgb565;
+ case GL_RGBA2:
+ case GL_RGBA4:
+ return &_mesa_texformat_argb4444;
+ case GL_COMPRESSED_RGBA:
+#if 0 && FX_TC_NAPALM /* [koolsmoky] */
+ if (ctx->Extensions.TDFX_texture_compression_FXT1) {
+ return &_mesa_texformat_rgba_fxt1;
+ } else if (ctx->Extensions.EXT_texture_compression_s3tc) {
+ return &_mesa_texformat_rgba_dxt3;
+ }
+#endif
+ /* intentional fall through */
+ case 4:
+ case GL_RGBA:
+ if ( srcFormat == GL_BGRA ) {
+ if ( srcType == GL_UNSIGNED_INT_8_8_8_8_REV ) {
+ return &_mesa_texformat_argb8888;
+ }
+ else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
+ return &_mesa_texformat_argb4444;
+ }
+ else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
+ return &_mesa_texformat_argb1555;
+ }
+ }
+ /* intentional fall through */
+ case GL_RGBA8:
+ case GL_RGB10_A2:
+ case GL_RGBA12:
+ case GL_RGBA16:
+ return (allow32bpt) ? &_mesa_texformat_argb8888
+ : &_mesa_texformat_argb4444;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY8:
@@ -1023,46 +1077,10 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_RGB4:
case GL_RGB5:
return &_mesa_texformat_rgb565;
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- if ( srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5 ) {
- return &_mesa_texformat_rgb565;
- }
- /* intentional fall through */
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return (allow32bpt) ? &_mesa_texformat_argb8888
- : &_mesa_texformat_rgb565;
- case GL_RGBA2:
- case GL_RGBA4:
- return &_mesa_texformat_argb4444;
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- if ( srcFormat == GL_BGRA ) {
- if ( srcType == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- return &_mesa_texformat_argb8888;
- }
- else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
- }
- else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
- }
- }
- /* intentional fall through */
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return (allow32bpt) ? &_mesa_texformat_argb8888
- : &_mesa_texformat_argb4444;
case GL_RGB5_A1:
return &_mesa_texformat_argb1555;
/* GL_EXT_texture_compression_s3tc */
+ /* GL_S3_s3tc */
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
@@ -1212,6 +1230,40 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
mml->width = width * mml->wScale;
mml->height = height * mml->hScale;
+#if 0 && FX_COMPRESS_S3TC_AS_FXT1_HACK
+ /* [koolsmoky] substitute FXT1 for DXTn and Legacy S3TC */
+ /* [dborca] we should update texture's attribute, then,
+ * because if the application asks us to decompress, we
+ * have to know the REAL format! Also, DXT3/5 might not
+ * be correct, since it would mess with "compressedSize".
+ * Ditto for GL_RGBA[4]_S3TC, which is always mapped to DXT3.
+ */
+ if (texImage->IsCompressed) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ internalFormat = GL_COMPRESSED_RGB_FXT1_3DFX;
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ internalFormat = GL_COMPRESSED_RGBA_FXT1_3DFX;
+ }
+ }
+#endif
+#if 1 || FX_COMPRESS_DXT5_AS_DXT3_HACK
+ /* [dborca] either VSA is stupid at DXT5,
+ * or our compression tool is broken. See
+ * above for caveats.
+ */
+ if ((texImage->IsCompressed) &&
+ (internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)) {
+ internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
+ }
+#endif
/* choose the texture format */
assert(ctx->Driver.ChooseTextureFormat);
@@ -1278,14 +1330,14 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
_mesa_transfer_teximage(ctx, 2, texImage->Format,
_final_texImage_TexFormat,
tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
+ width, height, 1, 0, 0, 0, /* src */
+ width * texelBytes, /* dstRowStride */
0, /* dstImageStride */
format, type, pixels, packing);
_mesa_rescale_teximage2d(texelBytes,
mml->width * texelBytes, /* dst stride */
- width, height,
- mml->width, mml->height,
+ width, height, /* src */
+ mml->width, mml->height, /* dst */
tempImage /*src*/, _final_texImage_Data /*dst*/ );
FREE(tempImage);
}
@@ -1295,7 +1347,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
_mesa_transfer_teximage(ctx, 2, texImage->Format,
_final_texImage_TexFormat, _final_texImage_Data,
width, height, 1, 0, 0, 0,
- texImage->Width * texelBytes,
+ mml->width * texelBytes,
0, /* dstImageStride */
format, type, pixels, packing);
}
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index c109f22f1e..b4b44de6bb 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -102,7 +102,8 @@
#define SETUP_SNAP 0x8
#define SETUP_XYZW 0x10
#define SETUP_PTEX 0x20
-#define MAX_SETUP 0x40
+#define SETUP_PSIZ 0x40
+#define MAX_SETUP 0x80
#define FX_NUM_TMU 2
diff --git a/src/mesa/drivers/glide/fxg.c b/src/mesa/drivers/glide/fxg.c
index 9f24185100..6a06ee1461 100644
--- a/src/mesa/drivers/glide/fxg.c
+++ b/src/mesa/drivers/glide/fxg.c
@@ -34,18 +34,13 @@
#ifdef FX
#include <stdio.h>
+#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#define DEBUG_TRAP_internal
#include "fxg.h"
-/* texus.h */
-FX_ENTRY void FX_CALL txImgQuantize (char *dst, char *src, int w, int h, FxU32 format, FxU32 dither);
-FX_ENTRY void FX_CALL txMipQuantize (TxMip *pxMip, TxMip *txMip, int fmt, FxU32 d, FxU32 comp);
-FX_ENTRY void FX_CALL txPalToNcc (GuNccTable *ncc_table, const FxU32 *pal);
-/* texus.h */
-
/****************************************************************************\
@@ -852,6 +847,13 @@ void (FX_CALL *real_grColorMaskExt) (FxBool r, FxBool g, FxBool b, FxBool a);
void (FX_CALL *real_grAlphaBlendFunctionExt) (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendOp_t rgb_op, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df, GrAlphaBlendOp_t alpha_op);
void (FX_CALL *real_grTBufferWriteMaskExt) (FxU32 tmask);
+/*
+** texus
+*/
+void (FX_CALL *real_txImgQuantize) (char *dst, char *src, int w, int h, FxU32 format, FxU32 dither);
+void (FX_CALL *real_txMipQuantize) (TxMip *pxMip, TxMip *txMip, int fmt, FxU32 d, FxU32 comp);
+void (FX_CALL *real_txPalToNcc) (GuNccTable *ncc_table, const FxU32 *pal);
+
/****************************************************************************\
@@ -2167,7 +2169,8 @@ void FX_CALL trap_txImgQuantize (char *dst,
{
#define FN_NAME "txImgQuantize"
TRAP_LOG("%s(%p, %p, %d, %d, %s, %s)\n", FN_NAME, dst, src, w, h, TRP_TEXFMT(format), TRP_TXDITHER(dither));
- txImgQuantize(dst, src, w, h, format, dither);
+ assert(real_txImgQuantize);
+ (*real_txImgQuantize)(dst, src, w, h, format, dither);
#undef FN_NAME
}
@@ -2179,7 +2182,8 @@ void FX_CALL trap_txMipQuantize (TxMip *pxMip,
{
#define FN_NAME "txMipQuantize"
TRAP_LOG("%s(%p, %p, %s, %s, %s)\n", FN_NAME, (void *)pxMip, (void *)txMip, TRP_TEXFMT(fmt), TRP_TXDITHER(d), TRP_TXCOMPRESS(comp));
- txMipQuantize(pxMip, txMip, fmt, d, comp);
+ assert(real_txMipQuantize);
+ (*real_txMipQuantize)(pxMip, txMip, fmt, d, comp);
#undef FN_NAME
}
@@ -2188,7 +2192,8 @@ void FX_CALL trap_txPalToNcc (GuNccTable *ncc_table,
{
#define FN_NAME "txPalToNcc"
TRAP_LOG("%s(%p, %p)\n", FN_NAME, (void *)ncc_table, (void *)pal);
- txPalToNcc(ncc_table, pal);
+ assert(real_txPalToNcc);
+ (*real_txPalToNcc)(ncc_table, pal);
#undef FN_NAME
}
#endif
@@ -2196,8 +2201,13 @@ void FX_CALL trap_txPalToNcc (GuNccTable *ncc_table,
/****************************************************************************\
-* housekeeping (fake pointers)
+* housekeeping (fake pointers) *
\****************************************************************************/
+char *FX_CALL fake_grGetRegistryOrEnvironmentStringExt (char *theEntry)
+{
+ return getenv(theEntry);
+}
+
void FX_CALL fake_grTexDownloadTableExt (GrChipID_t tmu,
GrTexTable_t type,
void *data)
@@ -2223,24 +2233,22 @@ void FX_CALL fake_grTexNCCTableExt (GrChipID_t tmu,
/****************************************************************************\
-* interface
+* interface *
\****************************************************************************/
void tdfx_hook_glide (struct tdfx_glide *Glide)
{
#if DEBUG_TRAP
#define GET_EXT_ADDR(name) *(GrProc *)&real_##name = grGetProcAddress(#name), Glide->name = trap_##name
#define GET_EXT_FAKE(name) GET_EXT_ADDR(name); if (real_##name == NULL) real_##name = fake_##name
-#define GET_TXS_ADDR(name) Glide->name = trap_##name
#else /* DEBUG_TRAP */
#define GET_EXT_ADDR(name) *(GrProc *)&Glide->name = grGetProcAddress(#name)
#define GET_EXT_FAKE(name) GET_EXT_ADDR(name); if (Glide->name == NULL) Glide->name = fake_##name
-#define GET_TXS_ADDR(name) Glide->name = name
#endif /* DEBUG_TRAP */
/*
** glide extensions
*/
- GET_EXT_ADDR(grGetRegistryOrEnvironmentStringExt);
+ GET_EXT_FAKE(grGetRegistryOrEnvironmentStringExt);
GET_EXT_ADDR(grGetGammaTableExt);
GET_EXT_ADDR(grChromaRangeModeExt);
GET_EXT_ADDR(grChromaRangeExt);
@@ -2273,9 +2281,9 @@ void tdfx_hook_glide (struct tdfx_glide *Glide)
/*
** texus
*/
- GET_TXS_ADDR(txImgQuantize);
- GET_TXS_ADDR(txMipQuantize);
- GET_TXS_ADDR(txPalToNcc);
+ GET_EXT_ADDR(txImgQuantize);
+ GET_EXT_ADDR(txMipQuantize);
+ GET_EXT_ADDR(txPalToNcc);
#undef GET_EXT_ADDR
}
diff --git a/src/mesa/drivers/glide/fxglidew.c b/src/mesa/drivers/glide/fxglidew.c
index 76df028693..e386b0d825 100644
--- a/src/mesa/drivers/glide/fxglidew.c
+++ b/src/mesa/drivers/glide/fxglidew.c
@@ -55,7 +55,7 @@ FX_grGetInteger_NoLock(FxU32 pname)
}
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: wrong parameter (%lx)\n", __FUNCTION__, pname);
+ fprintf(stderr, "FX_grGetInteger_NoLock: wrong parameter (%lx)\n", pname);
}
return -1;
}
@@ -232,7 +232,6 @@ FX_grSstQueryHardware(GrHwConfiguration * config)
config->SSTs[i].HaveCmbExt = (strstr(extension, " COMBINE ") != NULL);
config->SSTs[i].HaveMirExt = (strstr(extension, " TEXMIRROR ") != NULL);
config->SSTs[i].HaveTexUma = (strstr(extension, " TEXUMA ") != NULL);
- config->SSTs[i].HaveTexus2 = GL_FALSE;
/* number of Voodoo chips */
grGet(GR_NUM_FB, 4, (void *) &numFB);
diff --git a/src/mesa/drivers/glide/fxglidew.h b/src/mesa/drivers/glide/fxglidew.h
index feacde8418..b3a6b0ba67 100644
--- a/src/mesa/drivers/glide/fxglidew.h
+++ b/src/mesa/drivers/glide/fxglidew.h
@@ -78,7 +78,6 @@ typedef struct {
FxBool HaveCmbExt; /* COMBINE */
FxBool HaveMirExt; /* TEXMIRROR */
FxBool HaveTexUma; /* TEXUMA */
- FxBool HaveTexus2; /* Texus 2 - FXT1 */
}
SSTs[MAX_NUM_SST]; /* configuration for each board */
struct tdfx_glide Glide;
@@ -120,7 +119,8 @@ typedef struct {
unsigned char pargb[4]; /* B, G, R, A [0..255] */
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
float fog; /* fog coordinate */
- long pad[16 - 12]; /* ensure 64b structure */
+ float psize; /* point size */
+ long pad[16 - 13]; /* ensure 64b structure */
} GrVertex;
#define GR_VERTEX_X_OFFSET 0
diff --git a/src/mesa/drivers/glide/fxopengl.def b/src/mesa/drivers/glide/fxopengl.def
index 897905b4b4..03ca66444e 100644
--- a/src/mesa/drivers/glide/fxopengl.def
+++ b/src/mesa/drivers/glide/fxopengl.def
@@ -913,16 +913,16 @@ EXPORTS
wglCreateContext
wglCreateLayerContext
wglDeleteContext
-;wglDescribeLayerPlane
+ wglDescribeLayerPlane
wglDescribePixelFormat
wglGetCurrentContext
wglGetCurrentDC
-;wglGetLayerPaletteEntries
+ wglGetLayerPaletteEntries
wglGetPixelFormat
wglGetProcAddress
wglMakeCurrent
-;wglRealizeLayerPalette
-;wglSetLayerPaletteEntries
+ wglRealizeLayerPalette
+ wglSetLayerPaletteEntries
wglSetPixelFormat
wglShareLists
wglSwapBuffers
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c
index 22c34cecaf..fad0d1ee65 100644
--- a/src/mesa/drivers/glide/fxsetup.c
+++ b/src/mesa/drivers/glide/fxsetup.c
@@ -52,13 +52,13 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
if (ti->validated) {
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: validated=GL_TRUE\n", __FUNCTION__);
+ fprintf(stderr, "fxTexValidate(NOP)\n");
}
return;
}
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
+ fprintf(stderr, "fxTexValidate(%p (%d))\n", (void *)tObj, tObj->Name);
}
ti->tObj = tObj;
@@ -271,7 +271,7 @@ fxGetTexSetConfiguration(GLcontext * ctx,
unitsmode |= (ifmt | envmode);
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fxPrintUnitsMode(__FUNCTION__, unitsmode);
+ fxPrintUnitsMode("fxGetTexSetConfiguration", unitsmode);
return unitsmode;
}
@@ -289,7 +289,7 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
int tmu;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
+ fprintf(stderr, "fxSetupSingleTMU_NoLock(%p (%d))\n", (void *)tObj, tObj->Name);
}
#if 1 /* [dBorca] Good... bad... I'm the guy with the gun! */
@@ -331,7 +331,7 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
if ((ti->info.format == GR_TEXFMT_P_8)
&& (!fxMesa->haveGlobalPaletteTexture)) {
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: uploading texture palette\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupSingleTMU_NoLock: uploading texture palette\n");
}
grTexDownloadTable(ti->paltype, &(ti->palette));
}
@@ -339,7 +339,7 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
if ((ti->info.format == GR_TEXFMT_AYIQ_8422) ||
(ti->info.format == GR_TEXFMT_YIQ_422)) {
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: uploading NCC table\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupSingleTMU_NoLock: uploading NCC table\n");
}
grTexDownloadTable(GR_TEXTABLE_NCC0, &(ti->palette));
}
@@ -367,7 +367,7 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
if ((ti->info.format == GR_TEXFMT_P_8)
&& (!fxMesa->haveGlobalPaletteTexture)) {
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: uploading texture palette\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupSingleTMU_NoLock: uploading texture palette\n");
}
fxMesa->Glide.grTexDownloadTableExt(tmu, ti->paltype, &(ti->palette));
}
@@ -375,7 +375,7 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
if ((ti->info.format == GR_TEXFMT_AYIQ_8422) ||
(ti->info.format == GR_TEXFMT_YIQ_422)) {
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: uploading NCC table\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupSingleTMU_NoLock: uploading NCC table\n");
}
fxMesa->Glide.grTexDownloadTableExt(tmu, GR_TEXTABLE_NCC0, &(ti->palette));
}
@@ -386,7 +386,7 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
* texture memory, so perhaps it's not a good idea.
*/
if (ti->LODblend && (TDFX_DEBUG & VERBOSE_DRIVER)) {
- fprintf(stderr, "%s: not blending texture - only one tmu\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupSingleTMU_NoLock: not blending texture - only one tmu\n");
}
grTexClampMode(tmu, ti->sClamp, ti->tClamp);
@@ -403,7 +403,7 @@ fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
struct tdfx_texcombine tex0, tex1;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%d, %d)\n", __FUNCTION__, tmu, LODblend);
+ fprintf(stderr, "fxSelectSingleTMUSrc_NoLock(%d, %d)\n", tmu, LODblend);
}
tex0.InvertRGB = FXFALSE;
@@ -488,7 +488,7 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
int tmu;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTextureSingleTMU_NoLock(%d)\n", textureset);
}
ti = fxTMGetTexInfo(tObj);
@@ -530,7 +530,7 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
localc = GR_COMBINE_LOCAL_CONSTANT;
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "%s: envmode is %s\n", __FUNCTION__,
+ fprintf(stderr, "fxSetupTextureSingleTMU_NoLock: envmode is %s\n",
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[textureset].EnvMode));
alphaComb.Local = locala;
@@ -602,10 +602,10 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
}
grConstantColorValue(
- ((GLuint)((ctx->Texture.Unit[textureset].EnvColor[0] * 255.0f)) ) |
- ((GLuint)((ctx->Texture.Unit[textureset].EnvColor[1] * 255.0f)) << 8) |
- ((GLuint)((ctx->Texture.Unit[textureset].EnvColor[2] * 255.0f)) << 16) |
- ((GLuint)((ctx->Texture.Unit[textureset].EnvColor[3] * 255.0f)) << 24));
+ (((GLuint)(ctx->Texture.Unit[textureset].EnvColor[0] * 255.0f)) ) |
+ (((GLuint)(ctx->Texture.Unit[textureset].EnvColor[1] * 255.0f)) << 8) |
+ (((GLuint)(ctx->Texture.Unit[textureset].EnvColor[2] * 255.0f)) << 16) |
+ (((GLuint)(ctx->Texture.Unit[textureset].EnvColor[3] * 255.0f)) << 24));
break;
case GL_REPLACE:
if ((ifmt == GL_RGB) || (ifmt == GL_LUMINANCE)) {
@@ -665,7 +665,7 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
break;
default:
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: %x Texture.EnvMode not yet supported\n", __FUNCTION__,
+ fprintf(stderr, "fxSetupTextureSingleTMU_NoLock: %x Texture.EnvMode not yet supported\n",
ctx->Texture.Unit[textureset].EnvMode);
}
return;
@@ -714,7 +714,7 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
int tmu0 = 0, tmu1 = 1;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupDoubleTMU_NoLock(...)\n");
}
/* We shouldn't need to do this. There is something wrong with
@@ -811,13 +811,13 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
/* pointcast */
if (ti1->info.format == GR_TEXFMT_P_8) {
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: uploading texture palette for TMU1\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupDoubleTMU_NoLock: uploading texture palette for TMU1\n");
}
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__);
+ fprintf(stderr, "fxSetupDoubleTMU_NoLock: uploading texture palette for TMU0\n");
}
fxMesa->Glide.grTexDownloadTableExt(ti0->whichTMU, ti0->paltype, &(ti0->palette));
}
@@ -827,14 +827,14 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
if ((ti1->info.format == GR_TEXFMT_AYIQ_8422) ||
(ti1->info.format == GR_TEXFMT_YIQ_422)) {
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: uploading NCC0 table for TMU1\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupDoubleTMU_NoLock: uploading NCC0 table for TMU1\n");
}
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__);
+ fprintf(stderr, "fxSetupDoubleTMU_NoLock: uploading NCC0 table for TMU0\n");
}
fxMesa->Glide.grTexDownloadTableExt(ti0->whichTMU, GR_TEXTABLE_NCC0, &(ti0->palette));
}
@@ -874,7 +874,7 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
int tmu0 = 0, tmu1 = 1;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTextureDoubleTMU_NoLock(...)\n");
}
ti0 = fxTMGetTexInfo(tObj0);
@@ -910,7 +910,7 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "%s: envmode is %s/%s\n", __FUNCTION__,
+ fprintf(stderr, "fxSetupTextureDoubleTMU_NoLock: envmode is %s/%s\n",
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
@@ -1088,7 +1088,7 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
break;
}
default:
- fprintf(stderr, "%s: Unexpected dual texture mode encountered\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTextureDoubleTMU_NoLock: Unexpected dual texture mode encountered\n");
return;
}
@@ -1127,7 +1127,7 @@ fxSetupTextureNone_NoLock(GLcontext * ctx)
GrCombineLocal_t localc, locala;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTextureNone_NoLock(...)\n");
}
if ((ctx->Light.ShadeModel == GL_SMOOTH) || 1 ||
@@ -1169,7 +1169,7 @@ fxSetupTexture_NoLock(GLcontext * ctx)
fxMesaContext fxMesa = FX_CONTEXT(ctx);
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTexture_NoLock(...)\n");
}
if (fxMesa->HaveCmbExt) {
@@ -1855,7 +1855,7 @@ fxSetupCull(GLcontext * ctx)
fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrCullMode_t mode = GR_CULL_DISABLE;
- if (ctx->Polygon.CullFlag) {
+ if (ctx->Polygon.CullFlag && (fxMesa->raster_primitive == GL_TRIANGLES)) {
switch (ctx->Polygon.CullFaceMode) {
case GL_BACK:
if (ctx->Polygon.FrontFace == GL_CCW)
@@ -1878,9 +1878,6 @@ fxSetupCull(GLcontext * ctx)
}
}
- /* KW: don't need to check raster_primitive here as we don't
- * attempt to draw lines or points with triangles.
- */
if (fxMesa->cullMode != mode) {
fxMesa->cullMode = mode;
grCullMode(mode);
@@ -1899,7 +1896,7 @@ fxDDEnable(GLcontext * ctx, GLenum cap, GLboolean state)
tfxUnitsState *us = &fxMesa->unitsState;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%s)\n", state ? __FUNCTION__ : "fxDDDisable",
+ fprintf(stderr, "%s(%s)\n", state ? "fxDDEnable" : "fxDDDisable",
_mesa_lookup_enum_by_nr(cap));
}
@@ -2005,7 +2002,7 @@ fxSetupFXUnits(GLcontext * ctx)
GLuint newstate = fxMesa->new_state;
if (TDFX_DEBUG & VERBOSE_DRIVER)
- fx_print_state_flags(__FUNCTION__, newstate);
+ fx_print_state_flags("fxSetupFXUnits", newstate);
if (newstate) {
if (newstate & FX_NEW_TEXTURING)
diff --git a/src/mesa/drivers/glide/fxsetup.h b/src/mesa/drivers/glide/fxsetup.h
index 9f028fb999..f4435bf0de 100644
--- a/src/mesa/drivers/glide/fxsetup.h
+++ b/src/mesa/drivers/glide/fxsetup.h
@@ -172,7 +172,8 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G
struct gl_texture_object *tObj = texUnit->Current2D;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTextureEnvNapalm_NoLock(unit %u, TMU %u, iterated %d)\n",
+ textureset, tmu, iterated);
}
ti = fxTMGetTexInfo(tObj);
@@ -289,10 +290,10 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G
}
fxMesa->Glide.grConstantColorValueExt(tmu,
- ((GLuint)((envColor[0] * 255.0f)) ) |
- ((GLuint)((envColor[1] * 255.0f)) << 8) |
- ((GLuint)((envColor[2] * 255.0f)) << 16) |
- ((GLuint)((envColor[3] * 255.0f)) << 24));
+ (((GLuint)(envColor[0] * 255.0f)) ) |
+ (((GLuint)(envColor[1] * 255.0f)) << 8) |
+ (((GLuint)(envColor[2] * 255.0f)) << 16) |
+ (((GLuint)(envColor[3] * 255.0f)) << 24));
break;
case GL_REPLACE:
if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) {
@@ -439,10 +440,10 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G
}
fxMesa->Glide.grConstantColorValueExt(tmu,
- ((GLuint)((envColor[0] * 255.0f)) ) |
- ((GLuint)((envColor[1] * 255.0f)) << 8) |
- ((GLuint)((envColor[2] * 255.0f)) << 16) |
- ((GLuint)((envColor[3] * 255.0f)) << 24));
+ (((GLuint)(envColor[0] * 255.0f)) ) |
+ (((GLuint)(envColor[1] * 255.0f)) << 8) |
+ (((GLuint)(envColor[2] * 255.0f)) << 16) |
+ (((GLuint)(envColor[3] * 255.0f)) << 24));
break;
#if 0
{
@@ -841,7 +842,7 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G
#endif
default:
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s: %x Texture.EnvMode not yet supported\n", __FUNCTION__,
+ fprintf(stderr, "fxSetupTextureEnvNapalm_NoLock: %x Texture.EnvMode not yet supported\n",
texUnit->EnvMode);
}
return;
@@ -901,7 +902,7 @@ static void
fxSelectSingleTMUSrcNapalm_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
{
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%d, %d)\n", __FUNCTION__, tmu, LODblend);
+ fprintf(stderr, "fxSelectSingleTMUSrcNapalm_NoLock(%d, %d)\n", tmu, LODblend);
}
if (LODblend) {
@@ -989,7 +990,7 @@ fxSetupTextureSingleTMUNapalm_NoLock(GLcontext * ctx, GLuint textureset)
int tmu;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%d)\n", __FUNCTION__, textureset);
+ fprintf(stderr, "fxSetupTextureSingleTMUNapalm_NoLock(%d)\n", textureset);
}
ti = fxTMGetTexInfo(tObj);
@@ -1019,7 +1020,7 @@ fxSetupTextureSingleTMUNapalm_NoLock(GLcontext * ctx, GLuint textureset)
FX_grHints_NoLock(GR_HINT_STWHINT, 0);
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "%s: envmode is %s\n", __FUNCTION__,
+ fprintf(stderr, "fxSetupTextureSingleTMUNapalm_NoLock: envmode is %s\n",
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[textureset].EnvMode));
/* [dBorca] Hack alert:
@@ -1042,7 +1043,7 @@ fxSetupTextureDoubleTMUNapalm_NoLock(GLcontext * ctx)
int tmu0 = 0, tmu1 = 1;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTextureDoubleTMUNapalm_NoLock(...)\n");
}
ti0 = fxTMGetTexInfo(tObj0);
@@ -1064,7 +1065,7 @@ fxSetupTextureDoubleTMUNapalm_NoLock(GLcontext * ctx)
FX_grHints_NoLock(GR_HINT_STWHINT, fxMesa->stw_hint_state);
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "%s: envmode is %s/%s\n", __FUNCTION__,
+ fprintf(stderr, "fxSetupTextureDoubleTMUNapalm_NoLock: envmode is %s/%s\n",
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
@@ -1091,7 +1092,7 @@ fxSetupTextureNoneNapalm_NoLock(GLcontext * ctx)
fxMesaContext fxMesa = FX_CONTEXT(ctx);
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTextureNoneNapalm_NoLock(...)\n");
}
/* the combiner formula is: (A + B) * C + D
diff --git a/src/mesa/drivers/glide/fxtexman.c b/src/mesa/drivers/glide/fxtexman.c
index 90704e3479..f891657d92 100644
--- a/src/mesa/drivers/glide/fxtexman.c
+++ b/src/mesa/drivers/glide/fxtexman.c
@@ -115,7 +115,7 @@ fxTMNewRangeNode(fxMesaContext fxMesa, FxU32 start, FxU32 end)
}
else {
if (!(result = MALLOC(sizeof(MemRange)))) {
- fprintf(stderr, "%s: ERROR: out of memory!\n", __FUNCTION__);
+ fprintf(stderr, "fxTMNewRangeNode: ERROR: out of memory!\n");
fxCloseHardware();
exit(-1);
}
@@ -225,11 +225,11 @@ fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, int size)
}
/* No free space. Discard oldest */
if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "%s: No free space. Discard oldest\n", __FUNCTION__);
+ fprintf(stderr, "fxTMFindStartAddr: No free space. Discard oldest\n");
}
obj = fxTMFindOldestObject(fxMesa, tmu);
if (!obj) {
- fprintf(stderr, "%s: ERROR: No space for texture\n", __FUNCTION__);
+ fprintf(stderr, "fxTMFindStartAddr: ERROR: No space for texture\n");
return -1;
}
fxTMMoveOutTM(fxMesa, obj);
@@ -397,13 +397,13 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
int texmemsize;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%d)\n", __FUNCTION__, tObj->Name);
+ fprintf(stderr, "fxTMMoveInTM_NoLock(%d)\n", tObj->Name);
}
fxMesa->stats.reqTexUpload++;
if (!ti->validated) {
- fprintf(stderr, "%s: INTERNAL ERROR: not validated\n", __FUNCTION__);
+ fprintf(stderr, "fxTMMoveInTM_NoLock: INTERNAL ERROR: not validated\n");
fxCloseHardware();
exit(-1);
}
@@ -421,8 +421,8 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
}
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) {
- fprintf(stderr, "%s: downloading %p (%d) in texture memory in %d\n",
- __FUNCTION__, (void *)tObj, tObj->Name, where);
+ fprintf(stderr, "fxTMMoveInTM_NoLock: downloading %p (%d) in texture memory in %d\n",
+ (void *)tObj, tObj->Name, where);
}
ti->whichTMU = (FxU32) where;
@@ -511,7 +511,7 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
}
break;
default:
- fprintf(stderr, "%s: INTERNAL ERROR: wrong tmu (%d)\n", __FUNCTION__, where);
+ fprintf(stderr, "fxTMMoveInTM_NoLock: INTERNAL ERROR: wrong tmu (%d)\n", where);
fxCloseHardware();
exit(-1);
}
@@ -552,7 +552,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
assert(mml->glideFormat > 0);
if (!ti->validated) {
- fprintf(stderr, "%s: INTERNAL ERROR: not validated\n", __FUNCTION__);
+ fprintf(stderr, "fxTMReloadMipMapLevel: INTERNAL ERROR: not validated\n");
fxCloseHardware();
exit(-1);
}
@@ -619,7 +619,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
break;
default:
- fprintf(stderr, "%s: INTERNAL ERROR: wrong tmu (%d)\n", __FUNCTION__, tmu);
+ fprintf(stderr, "fxTMReloadMipMapLevel: INTERNAL ERROR: wrong tmu (%d)\n", tmu);
fxCloseHardware();
exit(-1);
}
@@ -640,7 +640,7 @@ fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
assert(mml);
if (!ti->validated) {
- fprintf(stderr, "%s: INTERNAL ERROR: not validated\n", __FUNCTION__);
+ fprintf(stderr, "fxTMReloadSubMipMapLevel: INTERNAL ERROR: not validated\n");
fxCloseHardware();
exit(-1);
}
@@ -714,7 +714,7 @@ fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
yoffset, yoffset + height - 1);
break;
default:
- fprintf(stderr, "%s: INTERNAL ERROR: wrong tmu (%d)\n", __FUNCTION__, tmu);
+ fprintf(stderr, "fxTMReloadSubMipMapLevel: INTERNAL ERROR: wrong tmu (%d)\n", tmu);
fxCloseHardware();
exit(-1);
}
@@ -726,7 +726,7 @@ fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
+ fprintf(stderr, "fxTMMoveOutTM(%p (%d))\n", (void *)tObj, tObj->Name);
}
if (!ti->isInTM)
@@ -743,7 +743,7 @@ fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
fxTMRemoveRange(fxMesa, FX_TMU1, ti->tm[FX_TMU1]);
break;
default:
- fprintf(stderr, "%s: INTERNAL ERROR: bad TMU (%ld)\n", __FUNCTION__, ti->whichTMU);
+ fprintf(stderr, "fxTMMoveOutTM: INTERNAL ERROR: bad TMU (%ld)\n", ti->whichTMU);
fxCloseHardware();
exit(-1);
}
@@ -759,7 +759,7 @@ fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
int i;
if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
+ fprintf(stderr, "fxTMFreeTexture(%p (%d))\n", (void *)tObj, tObj->Name);
}
fxTMMoveOutTM(fxMesa, tObj);
diff --git a/src/mesa/drivers/glide/fxtris.c b/src/mesa/drivers/glide/fxtris.c
index 209a29e766..9be2e1a88f 100644
--- a/src/mesa/drivers/glide/fxtris.c
+++ b/src/mesa/drivers/glide/fxtris.c
@@ -31,6 +31,7 @@
#ifdef FX
+#include "imports.h"
#include "mtypes.h"
#include "macros.h"
#include "colormac.h"
@@ -76,8 +77,14 @@ do { \
fxMesa->draw_tri( fxMesa, a, b, d ); \
fxMesa->draw_tri( fxMesa, b, c, d ); \
} else { \
- grDrawTriangle( a, b, d ); \
- grDrawTriangle( b, c, d ); \
+ GrVertex *_v_[4]; \
+ _v_[0] = d; \
+ _v_[1] = a; \
+ _v_[2] = b; \
+ _v_[3] = c; \
+ grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);\
+ /*grDrawTriangle( a, b, d );*/ \
+ /*grDrawTriangle( b, c, d );*/ \
} \
} while (0)
@@ -158,7 +165,7 @@ fx_translate_vertex( GLcontext *ctx, const GrVertex *src, SWvertex *dst)
dst->texcoord[ts1][3] = 1.0;
}
- dst->pointSize = ctx->Point._Size;
+ dst->pointSize = src->psize;
}
@@ -207,7 +214,7 @@ fx_fallback_point( fxMesaContext fxMesa,
static void fx_print_vertex( GLcontext *ctx, const GrVertex *v )
{
- fprintf(stderr, "%s:\n", __FUNCTION__);
+ fprintf(stderr, "fx_print_vertex:\n");
fprintf(stderr, "\tvertex at %p\n", (void *) v);
@@ -265,11 +272,87 @@ static void fx_draw_point( fxMesaContext fxMesa,
END_CLIP_LOOP();
}
+#ifndef M_2PI
+#define M_2PI 6.28318530717958647692528676655901
+#endif
+#define __GL_COSF cos
+#define __GL_SINF sin
+static void fx_draw_point_wide ( fxMesaContext fxMesa,
+ GrVertex *v0 )
+{
+ GLint i, n;
+ GLfloat ang, radius, oon;
+ GrVertex vtxB, vtxC;
+ GrVertex *_v_[3];
+
+ _v_[0] = v0;
+ _v_[1] = &vtxB;
+ _v_[2] = &vtxC;
+
+ radius = v0->psize / 2.;
+ n = IROUND(v0->psize * 2); /* radius x 4 */
+ if (n < 4) n = 4;
+ oon = 1.0 / (GLfloat)n;
+
+ /* CLIP_LOOP ?!? */
+ /* point coverage? */
+ /* we don't care about culling here (see fxSetupCull) */
+
+ vtxB = *v0;
+ vtxC = *v0;
+
+ vtxB.x += radius;
+ ang = M_2PI * oon;
+ vtxC.x += radius * __GL_COSF(ang);
+ vtxC.y += radius * __GL_SINF(ang);
+ grDrawVertexArray(GR_TRIANGLE_FAN, 3, _v_);
+ for (i = 2; i <= n; i++) {
+ ang = M_2PI * i * oon;
+ vtxC.x = v0->x + radius * __GL_COSF(ang);
+ vtxC.y = v0->y + radius * __GL_SINF(ang);
+ grDrawVertexArray(GR_TRIANGLE_FAN_CONTINUE, 1, &_v_[2]);
+ }
+}
+
+static void fx_draw_point_wide_aa ( fxMesaContext fxMesa,
+ GrVertex *v0 )
+{
+ GLint i, n;
+ GLfloat ang, radius, oon;
+ GrVertex vtxB, vtxC;
+
+ radius = v0->psize / 2.;
+ n = IROUND(v0->psize * 2); /* radius x 4 */
+ if (n < 4) n = 4;
+ oon = 1.0 / (GLfloat)n;
+
+ /* CLIP_LOOP ?!? */
+ /* point coverage? */
+ /* we don't care about culling here (see fxSetupCull) */
+
+ vtxB = *v0;
+ vtxC = *v0;
+
+ vtxB.x += radius;
+ for (i = 1; i <= n; i++) {
+ ang = M_2PI * i * oon;
+ vtxC.x = v0->x + radius * __GL_COSF(ang);
+ vtxC.y = v0->y + radius * __GL_SINF(ang);
+ grAADrawTriangle( v0, &vtxB, &vtxC, FXFALSE, FXTRUE, FXFALSE);
+ /*grDrawTriangle( v0, &vtxB, &vtxC);*/
+ vtxB.x = vtxC.x;
+ vtxB.y = vtxC.y;
+ }
+}
+#undef __GLCOSF
+#undef __GLSINF
+#undef M_2PI
+
#undef DO_FALLBACK
#define FX_UNFILLED_BIT 0x1
-#define FX_OFFSET_BIT 0x2
+#define FX_OFFSET_BIT 0x2
#define FX_TWOSIDE_BIT 0x4
#define FX_FLAT_BIT 0x8
#define FX_FALLBACK_BIT 0x10
@@ -306,15 +389,15 @@ static struct {
#define VERT_X(_v) _v->x
#define VERT_Y(_v) _v->y
#define VERT_Z(_v) _v->ooz
-#define AREA_IS_CCW( a ) (a < 0)
+#define AREA_IS_CCW( a ) IS_NEGATIVE(a) /*(a < 0)*/
#define GET_VERTEX(e) (fxMesa->verts + e)
-#define VERT_SET_RGBA( dst, f ) \
+#define VERT_SET_RGBA( dst, f ) \
do { \
- dst->pargb[2] = f[0] * 255.; \
- dst->pargb[1] = f[1] * 255.; \
- dst->pargb[0] = f[2] * 255.; \
- dst->pargb[3] = f[3] * 255.; \
+ UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[2], f[0]);\
+ UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[1], f[1]);\
+ UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[0], f[2]);\
+ UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[3], f[3]);\
} while (0)
#define VERT_COPY_RGBA( v0, v1 ) \
@@ -328,9 +411,9 @@ do { \
*(GLuint *)&v[idx]->pargb = *(GLuint *)&color[idx]
-#define LOCAL_VARS(n) \
- fxMesaContext fxMesa = FX_CONTEXT(ctx); \
- GLubyte color[n][4]; \
+#define LOCAL_VARS(n) \
+ fxMesaContext fxMesa = FX_CONTEXT(ctx); \
+ GLubyte color[n][4]; \
(void) color;
@@ -344,7 +427,7 @@ do { \
#define RENDER_PRIMITIVE fxMesa->render_primitive
#define IND FX_FALLBACK_BIT
#define TAG(x) x
-#include "../../tnl_dd/t_dd_unfilled.h"
+#include "tnl_dd/t_dd_unfilled.h"
#undef IND
/***********************************************************************
@@ -353,136 +436,136 @@ do { \
#define IND (0)
#define TAG(x) x
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_OFFSET_BIT)
#define TAG(x) x##_offset
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT)
#define TAG(x) x##_twoside
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT)
#define TAG(x) x##_twoside_offset
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_UNFILLED_BIT)
#define TAG(x) x##_unfilled
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT)
#define TAG(x) x##_offset_unfilled
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT)
#define TAG(x) x##_twoside_unfilled
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT)
#define TAG(x) x##_twoside_offset_unfilled
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_FALLBACK_BIT)
#define TAG(x) x##_fallback
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT)
#define TAG(x) x##_offset_fallback
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT)
#define TAG(x) x##_twoside_fallback
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT)
#define TAG(x) x##_twoside_offset_fallback
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT)
#define TAG(x) x##_unfilled_fallback
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT)
#define TAG(x) x##_offset_unfilled_fallback
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT)
#define TAG(x) x##_twoside_unfilled_fallback
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \
FX_FALLBACK_BIT)
#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
/* Fx doesn't support provoking-vertex flat-shading?
*/
#define IND (FX_FLAT_BIT)
#define TAG(x) x##_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_OFFSET_BIT|FX_FLAT_BIT)
#define TAG(x) x##_offset_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_FLAT_BIT)
#define TAG(x) x##_twoside_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FLAT_BIT)
#define TAG(x) x##_twoside_offset_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_UNFILLED_BIT|FX_FLAT_BIT)
#define TAG(x) x##_unfilled_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT)
#define TAG(x) x##_offset_unfilled_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT)
#define TAG(x) x##_twoside_unfilled_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT)
#define TAG(x) x##_twoside_offset_unfilled_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_FALLBACK_BIT|FX_FLAT_BIT)
#define TAG(x) x##_fallback_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
#define TAG(x) x##_offset_fallback_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
#define TAG(x) x##_twoside_fallback_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
#define TAG(x) x##_twoside_offset_fallback_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
#define TAG(x) x##_unfilled_fallback_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
#define TAG(x) x##_offset_unfilled_fallback_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
#define TAG(x) x##_twoside_unfilled_fallback_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \
FX_FALLBACK_BIT|FX_FLAT_BIT)
#define TAG(x) x##_twoside_offset_unfilled_fallback_flat
-#include "../../tnl_dd/t_dd_tritmp.h"
+#include "tnl_dd/t_dd_tritmp.h"
static void init_rast_tab( void )
@@ -768,8 +851,14 @@ static void fx_render_vb_quads( GLcontext *ctx,
for (i = start ; i < count-3 ; i += 4 ) {
#define VERT(x) (fxVB + (x))
- grDrawTriangle( VERT(i), VERT(i+1), VERT(i+3) );
- grDrawTriangle( VERT(i+1), VERT(i+2), VERT(i+3) );
+ GrVertex *_v_[4];
+ _v_[0] = VERT(i+3);
+ _v_[1] = VERT(i+0);
+ _v_[2] = VERT(i+1);
+ _v_[3] = VERT(i+2);
+ grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);
+ /*grDrawTriangle( VERT(i), VERT(i+1), VERT(i+3) );*/
+ /*grDrawTriangle( VERT(i+1), VERT(i+2), VERT(i+3) );*/
#undef VERT
}
}
@@ -881,7 +970,7 @@ static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *,
#undef TAG
#define TAG(x) fx_##x##_elts
#define ELT(x) elt[x]
-#include "../../tnl_dd/t_dd_rendertmp.h"
+#include "tnl_dd/t_dd_rendertmp.h"
/* Verts, no clipping.
*/
@@ -889,7 +978,7 @@ static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *,
#undef TAG
#define TAG(x) fx_##x##_verts
#define ELT(x) x
-/*#include "../../tnl_dd/t_dd_rendertmp.h"*/ /* we have fx_render_vb_* now */
+/*#include "tnl_dd/t_dd_rendertmp.h"*/ /* we have fx_render_vb_* now */
@@ -1012,6 +1101,21 @@ void fxDDChooseRenderState(GLcontext *ctx)
}
fxMesa->render_index = index;
+
+ /* [dBorca] Hack alert: more a trick than a real plug-in!!!
+ * FX_FALLBACK_BIT is for total rasterization fallbacks; since
+ * this is not the case, we don't alter "fxMesa->render_index".
+ * But we still need to go through "rast_tab", to make sure
+ * "POINT" calls "fxMesa->draw_point" instead of "grDrawPoint"
+ */
+ if (flags & (DD_POINT_SIZE | DD_POINT_ATTEN)) {
+ if (flags & DD_POINT_SMOOTH) {
+ fxMesa->draw_point = fx_draw_point_wide_aa;
+ } else {
+ fxMesa->draw_point = fx_draw_point_wide;
+ }
+ tnl->Driver.Render.Points = rast_tab[FX_FALLBACK_BIT].points;
+ }
}
diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c
index 03cefef082..1b3eaea3ca 100644
--- a/src/mesa/drivers/glide/fxvb.c
+++ b/src/mesa/drivers/glide/fxvb.c
@@ -112,7 +112,7 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
GET_COLOR(VB->ColorPtr[1], src) );
#if 1 /* [dBorca] GL_EXT_separate_specular_color */
if (VB->SecondaryColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->SecondaryColorPtr[1], dst),
+ COPY_3FV( GET_COLOR(VB->SecondaryColorPtr[1], dst),
GET_COLOR(VB->SecondaryColorPtr[1], src) );
}
#endif
@@ -143,6 +143,27 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
#define TAG(x) x##_wgpt0t1
#include "fxvbtmp.h"
+#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_PSIZ)
+#define TAG(x) x##_wga
+#include "fxvbtmp.h"
+
+#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ)
+#define TAG(x) x##_wgt0a
+#include "fxvbtmp.h"
+
+#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|SETUP_PSIZ)
+#define TAG(x) x##_wgt0t1a
+#include "fxvbtmp.h"
+
+#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PTEX|SETUP_PSIZ)
+#define TAG(x) x##_wgpt0a
+#include "fxvbtmp.h"
+
+#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|\
+ SETUP_PTEX|SETUP_PSIZ)
+#define TAG(x) x##_wgpt0t1a
+#include "fxvbtmp.h"
+
/* Snapping for voodoo-1
*/
@@ -169,6 +190,29 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
#define TAG(x) x##_wsgpt0t1
#include "fxvbtmp.h"
+#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_PSIZ)
+#define TAG(x) x##_wsga
+#include "fxvbtmp.h"
+
+#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ)
+#define TAG(x) x##_wsgt0a
+#include "fxvbtmp.h"
+
+#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
+ SETUP_TMU1|SETUP_PSIZ)
+#define TAG(x) x##_wsgt0t1a
+#include "fxvbtmp.h"
+
+#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
+ SETUP_PTEX|SETUP_PSIZ)
+#define TAG(x) x##_wsgpt0a
+#include "fxvbtmp.h"
+
+#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
+ SETUP_TMU1|SETUP_PTEX|SETUP_PSIZ)
+#define TAG(x) x##_wsgpt0t1a
+#include "fxvbtmp.h"
+
/* Vertex repair (multipass rendering)
*/
@@ -201,12 +245,22 @@ static void init_setup_tab( void )
init_wgt0t1();
init_wgpt0();
init_wgpt0t1();
+ init_wga();
+ init_wgt0a();
+ init_wgt0t1a();
+ init_wgpt0a();
+ init_wgpt0t1a();
init_wsg();
init_wsgt0();
init_wsgt0t1();
init_wsgpt0();
init_wsgpt0t1();
+ init_wsga();
+ init_wsgt0a();
+ init_wsgt0t1a();
+ init_wsgpt0a();
+ init_wsgpt0t1a();
init_g();
init_t0();
@@ -273,6 +327,10 @@ void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
} else {
GLuint ind = 0;
+ /* [dBorca] masked by VERT_BIT_POS ?!?
+ if (newinputs & VERT_BIT_POINT_SIZE)
+ ind |= SETUP_PSIZ;*/
+
if (newinputs & VERT_BIT_COLOR0)
ind |= SETUP_RGBA;
@@ -319,7 +377,11 @@ void fxChooseVertexState( GLcontext *ctx )
else if (ctx->Texture._EnabledUnits & 0x1) {
ind |= SETUP_TMU0;
}
-
+
+ if (ctx->_TriangleCaps & (DD_POINT_SIZE|DD_POINT_ATTEN)) {
+ ind |= SETUP_PSIZ;
+ }
+
fxMesa->SetupIndex = ind;
if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h
index e0af9bdb4f..9028cd17a0 100644
--- a/src/mesa/drivers/glide/fxvbtmp.h
+++ b/src/mesa/drivers/glide/fxvbtmp.h
@@ -46,12 +46,18 @@ static void TAG(emit)( GLcontext *ctx,
GLuint tc0_size, tc1_size;
GLfloat (*proj)[4] = VB->NdcPtr->data;
GLuint proj_stride = VB->NdcPtr->stride;
+ GLfloat (*psize)[4];
+ GLuint psize_stride;
GrVertex *v = (GrVertex *)dest;
GLfloat u0scale,v0scale,u1scale,v1scale;
const GLubyte *mask = VB->ClipMask;
const GLfloat *const s = ctx->Viewport._WindowMap.m;
int i;
+ if (IND & SETUP_PSIZ) {
+ psize = VB->PointSizePtr->data;
+ psize_stride = VB->PointSizePtr->stride;
+ }
if (IND & SETUP_TMU0) {
tc0 = VB->TexCoordPtr[tmu0_source]->data;
@@ -78,6 +84,9 @@ static void TAG(emit)( GLcontext *ctx,
if (start) {
proj = (GLfloat (*)[4])((GLubyte *)proj + start * proj_stride);
+ if (IND & SETUP_PSIZ) {
+ psize = (GLfloat (*)[4])((GLubyte *)psize + start * psize_stride);
+ }
if (IND & SETUP_TMU0)
tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + start * tc0_stride);
if (IND & SETUP_TMU1)
@@ -87,6 +96,11 @@ static void TAG(emit)( GLcontext *ctx,
}
for (i=start; i < end; i++, v++) {
+ if (IND & SETUP_PSIZ) {
+ v->psize = psize[0][0];
+ psize = (GLfloat (*)[4])((GLubyte *)psize + psize_stride);
+ }
+
if (IND & SETUP_XYZW) {
if (mask[i] == 0) {
/* unclipped */
@@ -115,10 +129,10 @@ static void TAG(emit)( GLcontext *ctx,
proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride);
}
if (IND & SETUP_RGBA) {
- v->pargb[2] = col[0][0] * 255.;
- v->pargb[1] = col[0][1] * 255.;
- v->pargb[0] = col[0][2] * 255.;
- v->pargb[3] = col[0][3] * 255.;
+ UNCLAMPED_FLOAT_TO_UBYTE(v->pargb[2], col[0][0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(v->pargb[1], col[0][1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(v->pargb[0], col[0][2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(v->pargb[3], col[0][3]);
STRIDE_4F(col, col_stride);
}
if (IND & SETUP_TMU0) {
diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c
index 4609880f8d..2de4e1a0d7 100644
--- a/src/mesa/drivers/glide/fxwgl.c
+++ b/src/mesa/drivers/glide/fxwgl.c
@@ -26,6 +26,8 @@
* David Bucciarelli
* Brian Paul
* Keith Whitwell
+ * Hiroshi Morii
+ * Daniel Borca
*/
/* fxwgl.c - Microsoft wgl functions emulation for
@@ -400,14 +402,83 @@ wglGetCurrentDC(VOID)
return (NULL);
}
+GLAPI BOOL GLAPIENTRY
+wglSwapIntervalEXT (int interval)
+{
+ if (ctx == NULL) {
+ return FALSE;
+ }
+ if (interval < 0) {
+ interval = 0;
+ } else if (interval > 3) {
+ interval = 3;
+ }
+ ctx->swapInterval = interval;
+ return TRUE;
+}
+
+GLAPI int GLAPIENTRY
+wglGetSwapIntervalEXT (void)
+{
+ return (ctx == NULL) ? -1 : ctx->swapInterval;
+}
+
+GLAPI BOOL GLAPIENTRY
+wglGetDeviceGammaRampEXT (unsigned char *r, unsigned char *g, unsigned char *b)
+{
+ return TRUE;
+}
+
+GLAPI BOOL GLAPIENTRY
+wglSetDeviceGammaRampEXT (const unsigned char *r, const unsigned char *g, const unsigned char *b)
+{
+ return TRUE;
+}
+
+GLAPI const char * GLAPIENTRY
+wglGetExtensionsStringEXT (void)
+{
+ return "WGL_3DFX_gamma_control "
+ "WGL_EXT_swap_control "
+ "WGL_EXT_extensions_string WGL_ARB_extensions_string";
+}
+
+GLAPI const char * GLAPIENTRY
+wglGetExtensionsStringARB (HDC hdc)
+{
+ return wglGetExtensionsStringEXT();
+}
+
+static struct {
+ const char *name;
+ PROC func;
+} wgl_ext[] = {
+ {"wglGetExtensionsStringARB", wglGetExtensionsStringARB},
+ {"wglGetExtensionsStringEXT", wglGetExtensionsStringEXT},
+ {"wglSwapIntervalEXT", wglSwapIntervalEXT},
+ {"wglGetSwapIntervalEXT", wglGetSwapIntervalEXT},
+ {"wglGetDeviceGammaRampEXT", wglGetDeviceGammaRampEXT},
+ {"wglGetDeviceGammaRamp3DFX", wglGetDeviceGammaRampEXT},
+ {"wglSetDeviceGammaRampEXT", wglSetDeviceGammaRampEXT},
+ {"wglSetDeviceGammaRamp3DFX", wglSetDeviceGammaRampEXT},
+ {NULL, NULL}
+};
+
GLAPI PROC GLAPIENTRY
wglGetProcAddress(LPCSTR lpszProc)
{
+ int i;
PROC p = (PROC) _glapi_get_proc_address((const char *) lpszProc);
-
+
if (p)
return p;
+ for (i = 0; wgl_ext[i].name; i++) {
+ if (!strcmp(lpszProc, wgl_ext[i].name)) {
+ return wgl_ext[i].func;
+ }
+ }
+
SetLastError(0);
return (NULL);
}
@@ -612,6 +683,13 @@ wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR * ppfd)
fclose(pix_file);
#endif
+#if 1 || QUAKE2
+ if (ppfd->cColorBits == 24 && ppfd->cDepthBits == 32) {
+ ppfd->cColorBits = 16;
+ ppfd->cDepthBits = 16;
+ }
+#endif
+
qt_valid_pix = qt_pix;
if (ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR) || ppfd->nVersion != 1) {