enable and clean-up of paletted texture code
This commit is contained in:
@@ -700,7 +700,7 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* now make the GL_RENDERER string */
|
/* now make the GL_RENDERER string */
|
||||||
sprintf(buffer, "Mesa DRI %s 20000420", hardware);
|
sprintf(buffer, "Mesa DRI %s 20000510", hardware);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
case GL_VENDOR:
|
case GL_VENDOR:
|
||||||
@@ -900,7 +900,6 @@ void fxDDInitExtensions( GLcontext *ctx )
|
|||||||
gl_extensions_disable(ctx, "GL_EXT_blend_minmax");
|
gl_extensions_disable(ctx, "GL_EXT_blend_minmax");
|
||||||
gl_extensions_disable(ctx, "GL_EXT_blend_subtract");
|
gl_extensions_disable(ctx, "GL_EXT_blend_subtract");
|
||||||
gl_extensions_disable(ctx, "GL_EXT_blend_color");
|
gl_extensions_disable(ctx, "GL_EXT_blend_color");
|
||||||
gl_extensions_disable(ctx, "GL_EXT_paletted_texture");
|
|
||||||
|
|
||||||
gl_extensions_add(ctx, DEFAULT_ON, "3DFX_set_global_palette", 0);
|
gl_extensions_add(ctx, DEFAULT_ON, "3DFX_set_global_palette", 0);
|
||||||
|
|
||||||
|
@@ -325,31 +325,31 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
|
|||||||
|
|
||||||
void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj)
|
void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj)
|
||||||
{
|
{
|
||||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||||
tfxTexInfo *ti=fxTMGetTexInfo(tObj);
|
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
|
||||||
|
|
||||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||||
fprintf(stderr,"fxmesa: fxDDTexDel(%d,%x)\n",tObj->Name,(GLuint)ti);
|
fprintf(stderr, "fxmesa: fxDDTexDel(%d,%p)\n", tObj->Name, ti);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ti)
|
if (!ti)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fxTMFreeTexture(fxMesa,tObj);
|
fxTMFreeTexture(fxMesa, tObj);
|
||||||
|
|
||||||
FREE(ti);
|
FREE(ti);
|
||||||
tObj->DriverData=NULL;
|
tObj->DriverData = NULL;
|
||||||
|
|
||||||
ctx->NewState|=NEW_TEXTURING;
|
ctx->NewState |= NEW_TEXTURING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert gl_color_table table to Glide's format.
|
* Convert a gl_color_table texture palette to Glide's format.
|
||||||
*/
|
*/
|
||||||
|
static void
|
||||||
static void convertPalette(FxU32 data[256], const struct gl_color_table *table)
|
convertPalette(FxU32 data[256], const struct gl_color_table *table)
|
||||||
{
|
{
|
||||||
const GLubyte *tableUB = (const GLubyte *) table->Table;
|
const GLubyte *tableUB = (const GLubyte *) table->Table;
|
||||||
GLint width = table->Size;
|
GLint width = table->Size;
|
||||||
@@ -415,28 +415,28 @@ static void convertPalette(FxU32 data[256], const struct gl_color_table *table)
|
|||||||
|
|
||||||
void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj)
|
void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj)
|
||||||
{
|
{
|
||||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||||
|
|
||||||
if (tObj) {
|
if (tObj) {
|
||||||
/* per-texture palette */
|
/* per-texture palette */
|
||||||
tfxTexInfo *ti;
|
tfxTexInfo *ti;
|
||||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||||
fprintf(stderr,"fxmesa: fxDDTexPalette(%d,%x)\n",
|
fprintf(stderr, "fxmesa: fxDDTexPalette(%d,%x)\n",
|
||||||
tObj->Name,(GLuint)tObj->DriverData);
|
tObj->Name, (GLuint) tObj->DriverData);
|
||||||
}
|
}
|
||||||
if (!tObj->DriverData)
|
if (!tObj->DriverData)
|
||||||
tObj->DriverData=fxAllocTexObjData(fxMesa);
|
tObj->DriverData = fxAllocTexObjData(fxMesa);
|
||||||
ti=fxTMGetTexInfo(tObj);
|
ti = fxTMGetTexInfo(tObj);
|
||||||
convertPalette(ti->palette.data, &tObj->Palette);
|
convertPalette(ti->palette.data, &tObj->Palette);
|
||||||
fxTexInvalidate(ctx,tObj);
|
fxTexInvalidate(ctx, tObj);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* global texture palette */
|
/* global texture palette */
|
||||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||||
fprintf(stderr,"fxmesa: fxDDTexPalette(global)\n");
|
fprintf(stderr, "fxmesa: fxDDTexPalette(global)\n");
|
||||||
}
|
}
|
||||||
convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette);
|
convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette);
|
||||||
fxMesa->new_state|=FX_NEW_TEXTURING;
|
fxMesa->new_state |= FX_NEW_TEXTURING;
|
||||||
ctx->Driver.RenderStart = fxSetupFXUnits;
|
ctx->Driver.RenderStart = fxSetupFXUnits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -444,33 +444,35 @@ void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj)
|
|||||||
|
|
||||||
void fxDDTexUseGlbPalette(GLcontext *ctx, GLboolean state)
|
void fxDDTexUseGlbPalette(GLcontext *ctx, GLboolean state)
|
||||||
{
|
{
|
||||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||||
|
|
||||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||||
fprintf(stderr,"fxmesa: fxDDTexUseGlbPalette(%d)\n",state);
|
fprintf(stderr,"fxmesa: fxDDTexUseGlbPalette(%d)\n",state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state) {
|
if (state) {
|
||||||
fxMesa->haveGlobalPaletteTexture=1;
|
fxMesa->haveGlobalPaletteTexture = 1;
|
||||||
|
|
||||||
FX_grTexDownloadTable(GR_TMU0,GR_TEXTABLE_PALETTE,&(fxMesa->glbPalette));
|
FX_grTexDownloadTable(GR_TMU0,GR_TEXTABLE_PALETTE, &(fxMesa->glbPalette));
|
||||||
if (fxMesa->haveTwoTMUs)
|
if (fxMesa->haveTwoTMUs)
|
||||||
FX_grTexDownloadTable(GR_TMU1,GR_TEXTABLE_PALETTE,&(fxMesa->glbPalette));
|
FX_grTexDownloadTable(GR_TMU1, GR_TEXTABLE_PALETTE, &(fxMesa->glbPalette));
|
||||||
} else {
|
}
|
||||||
fxMesa->haveGlobalPaletteTexture=0;
|
else {
|
||||||
|
fxMesa->haveGlobalPaletteTexture = 0;
|
||||||
|
|
||||||
if((ctx->Texture.Unit[0].Current==ctx->Texture.Unit[0].CurrentD[2]) &&
|
if ((ctx->Texture.Unit[0].Current == ctx->Texture.Unit[0].CurrentD[2]) &&
|
||||||
(ctx->Texture.Unit[0].Current!=NULL)) {
|
(ctx->Texture.Unit[0].Current != NULL)) {
|
||||||
struct gl_texture_object *tObj=ctx->Texture.Unit[0].Current;
|
struct gl_texture_object *tObj = ctx->Texture.Unit[0].Current;
|
||||||
|
|
||||||
if (!tObj->DriverData)
|
if (!tObj->DriverData)
|
||||||
tObj->DriverData=fxAllocTexObjData(fxMesa);
|
tObj->DriverData = fxAllocTexObjData(fxMesa);
|
||||||
|
|
||||||
fxTexInvalidate(ctx,tObj);
|
fxTexInvalidate(ctx, tObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int logbase2(int n)
|
static int logbase2(int n)
|
||||||
{
|
{
|
||||||
GLint i = 1;
|
GLint i = 1;
|
||||||
|
Reference in New Issue
Block a user