Tested on:
CPU: AMD Athlon XP 1800+
- Mainboard: EP-8KTA3 w/ 128 MB SDRAM
- Video card: Voodoo5 5500 AGP w/ 64 MB SDRAM
- DJGPP: djdev 2.04 + gcc v3.2.2 + make v3.80
+ Mainboard: GA-7VTXE w/ 256 MB DDRAM
+ Video card: Voodoo5 6000 AGP w/ 128 MB SDRAM
+ DJGPP: djdev 2.04 + gcc v3.3.2 + make v3.80
OS: DOS and Win98SE
* revamped GLUT
* switched to DXE3
-v1.4 (nov-2003)
+v1.4 (dec-2003)
+ enabled GLUT fonts with DXE
+ truly added multi-window support in GLUT (for Adrian Woodward)
* accomodated makefiles with the new sourcetree
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]);
GLboolean useBGR;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxMesaCreateContext(...)\n");
}
/* Okay, first process the user flags */
}
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);
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
FREE(fxMesa);
}
- fprintf(stderr, "%s: ERROR: %s\n", __FUNCTION__, str);
+ fprintf(stderr, "fxMesaCreateContext: ERROR: %s\n", str);
return NULL;
}
fxMesaDestroyContext(fxMesaContext fxMesa)
{
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxMesaDestroyContext(...)\n");
}
if (!fxMesa)
fxMesaCurrentCtx = NULL;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(NULL)\n", __FUNCTION__);
+ fprintf(stderr, "fxMesaMakeCurrent(NULL)\n");
}
return;
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)
fxMesaSwapBuffers(void)
{
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s()\n", __FUNCTION__);
+ fprintf(stderr, "fxMesaSwapBuffers()\n");
}
if (fxMesaCurrentCtx) {
GLboolean GLAPIENTRY fxQueryHardware (void)
{
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s()\n", __FUNCTION__);
+ fprintf(stderr, "fxQueryHardware()\n");
}
if (!glbGlideInitialized) {
fxMesaContext fxMesa = FX_CONTEXT(ctx);
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxDDBufferSize(...)\n");
}
*width = fxMesa->width;
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]);
/* 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);
*/
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 */
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) {
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);
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;
/*&_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,
};
* 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) {
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;
}
}
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;
}
}
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));
(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;
}
}
TNLcontext *tnl = TNL_CONTEXT(ctx);
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s()\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupDDPointers()\n");
}
ctx->Driver.UpdateState = fxDDUpdateDDPointers;
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);
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);
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);
(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) {
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);
}
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)
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 */
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)
/* 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)
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));
}
}
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;
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;
}
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:
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:
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);
_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);
}
_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);
}
#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
#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 */
-
/****************************************************************************\
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);
+
/****************************************************************************\
{
#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
}
{
#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
}
{
#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
/****************************************************************************\
-* 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)
/****************************************************************************\
-* 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);
/*
** 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
}
}
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;
}
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);
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;
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
wglCreateContext
wglCreateLayerContext
wglDeleteContext
-;wglDescribeLayerPlane
+ wglDescribeLayerPlane
wglDescribePixelFormat
wglGetCurrentContext
wglGetCurrentDC
-;wglGetLayerPaletteEntries
+ wglGetLayerPaletteEntries
wglGetPixelFormat
wglGetProcAddress
wglMakeCurrent
-;wglRealizeLayerPalette
-;wglSetLayerPaletteEntries
+ wglRealizeLayerPalette
+ wglSetLayerPaletteEntries
wglSetPixelFormat
wglShareLists
wglSwapBuffers
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;
unitsmode |= (ifmt | envmode);
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fxPrintUnitsMode(__FUNCTION__, unitsmode);
+ fxPrintUnitsMode("fxGetTexSetConfiguration", unitsmode);
return unitsmode;
}
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! */
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));
}
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));
}
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));
}
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));
}
* 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);
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;
int tmu;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTextureSingleTMU_NoLock(%d)\n", textureset);
}
ti = fxTMGetTexInfo(tObj);
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;
}
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)) {
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;
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
/* 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));
}
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));
}
int tmu0 = 0, tmu1 = 1;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTextureDoubleTMU_NoLock(...)\n");
}
ti0 = fxTMGetTexInfo(tObj0);
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));
break;
}
default:
- fprintf(stderr, "%s: Unexpected dual texture mode encountered\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTextureDoubleTMU_NoLock: Unexpected dual texture mode encountered\n");
return;
}
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 ||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTexture_NoLock(...)\n");
}
if (fxMesa->HaveCmbExt) {
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)
}
}
- /* 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);
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));
}
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)
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);
}
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) {
}
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
{
#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;
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) {
int tmu;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%d)\n", __FUNCTION__, textureset);
+ fprintf(stderr, "fxSetupTextureSingleTMUNapalm_NoLock(%d)\n", textureset);
}
ti = fxTMGetTexInfo(tObj);
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:
int tmu0 = 0, tmu1 = 1;
if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ fprintf(stderr, "fxSetupTextureDoubleTMUNapalm_NoLock(...)\n");
}
ti0 = fxTMGetTexInfo(tObj0);
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));
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
}
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);
}
}
/* 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);
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);
}
}
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;
}
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);
}
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);
}
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);
}
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);
}
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);
}
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)
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);
}
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);
#ifdef FX
+#include "imports.h"
#include "mtypes.h"
#include "macros.h"
#include "colormac.h"
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)
dst->texcoord[ts1][3] = 1.0;
}
- dst->pointSize = ctx->Point._Size;
+ dst->pointSize = src->psize;
}
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);
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
#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 ) \
*(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;
#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
/***********************************************************************
#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 )
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
}
}
#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.
*/
#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 */
}
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;
+ }
}
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
#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
*/
#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)
*/
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();
} 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;
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)) {
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;
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)
}
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 */
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) {
* David Bucciarelli
* Brian Paul
* Keith Whitwell
+ * Hiroshi Morii
+ * Daniel Borca
*/
/* fxwgl.c - Microsoft wgl functions emulation for
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);
}
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) {