summaryrefslogtreecommitdiffstats
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.c434
-rw-r--r--src/mesa/drivers/glide/fxdd.c181
-rw-r--r--src/mesa/drivers/glide/fxdrv.h33
3 files changed, 320 insertions, 328 deletions
diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c
index 2d16048e49d..5d0d36ecc3d 100644
--- a/src/mesa/drivers/glide/fxapi.c
+++ b/src/mesa/drivers/glide/fxapi.c
@@ -824,328 +824,196 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,GrScreenResolution_t res
GrScreenRefresh_t ref,
const GLint attribList[])
{
- fxMesaContext fxMesa = NULL;
- int i,type;
- int aux;
- GLboolean doubleBuffer=GL_FALSE;
- GLboolean alphaBuffer=GL_FALSE;
- GLboolean verbose=GL_FALSE;
- GLint depthSize=0;
- GLint stencilSize=0;
- GLint accumSize=0;
- GLcontext *shareCtx = NULL;
- GLcontext *ctx = 0;
- FX_GrContext_t glideContext = 0;
- char *errorstr;
-
- if (MESA_VERBOSE&VERBOSE_DRIVER) {
- fprintf(stderr,"fxmesa: fxMesaCreateContext() Start\n");
- }
-
- if(getenv("MESA_FX_INFO"))
- verbose=GL_TRUE;
+ fxMesaContext fxMesa = NULL;
+ int i,type;
+ int aux;
+ GLboolean doubleBuffer=GL_FALSE;
+ GLboolean alphaBuffer=GL_FALSE;
+ GLboolean verbose=GL_FALSE;
+ GLint depthSize=0;
+ GLint stencilSize=0;
+ GLint accumSize=0;
+ GLcontext *shareCtx = NULL;
+ GLcontext *ctx = 0;
+ FX_GrContext_t glideContext = 0;
+ char *errorstr;
+
+ if (MESA_VERBOSE&VERBOSE_DRIVER) {
+ fprintf(stderr,"fxmesa: fxMesaCreateContext() Start\n");
+ }
- aux=0;
- i=0;
- while(attribList[i]!=FXMESA_NONE) {
- switch (attribList[i]) {
- case FXMESA_DOUBLEBUFFER:
- doubleBuffer=GL_TRUE;
- break;
- case FXMESA_ALPHA_SIZE:
- i++;
- alphaBuffer=attribList[i]>0;
- if(alphaBuffer)
- aux=1;
- break;
- case FXMESA_DEPTH_SIZE:
- i++;
- depthSize=attribList[i];
- if(depthSize)
- aux=1;
- break;
- case FXMESA_STENCIL_SIZE:
- i++;
- stencilSize=attribList[i];
- break;
- case FXMESA_ACCUM_SIZE:
- i++;
- accumSize=attribList[i];
- break;
- /* XXX ugly hack here for sharing display lists */
+ if(getenv("MESA_FX_INFO"))
+ verbose=GL_TRUE;
+
+ aux=0;
+ i=0;
+ while(attribList[i]!=FXMESA_NONE) {
+ switch (attribList[i]) {
+ case FXMESA_DOUBLEBUFFER:
+ doubleBuffer=GL_TRUE;
+ break;
+ case FXMESA_ALPHA_SIZE:
+ i++;
+ alphaBuffer=attribList[i]>0;
+ if(alphaBuffer)
+ aux=1;
+ break;
+ case FXMESA_DEPTH_SIZE:
+ i++;
+ depthSize=attribList[i];
+ if(depthSize)
+ aux=1;
+ break;
+ case FXMESA_STENCIL_SIZE:
+ i++;
+ stencilSize=attribList[i];
+ break;
+ case FXMESA_ACCUM_SIZE:
+ i++;
+ accumSize=attribList[i];
+ break;
+ /* XXX ugly hack here for sharing display lists */
#define FXMESA_SHARE_CONTEXT 990099 /* keep in sync with xmesa1.c! */
- case FXMESA_SHARE_CONTEXT:
- i++;
- {
- const void *vPtr = &attribList[i];
- GLcontext **ctx = (GLcontext **) vPtr;
- shareCtx = *ctx;
- }
- break;
- default:
- if (MESA_VERBOSE&VERBOSE_DRIVER) {
- fprintf(stderr,"fxmesa: fxMesaCreateContext() End (defualt)\n");
+ case FXMESA_SHARE_CONTEXT:
+ i++;
+ {
+ const void *vPtr = &attribList[i];
+ GLcontext **ctx = (GLcontext **) vPtr;
+ shareCtx = *ctx;
+ }
+ break;
+ default:
+ if (MESA_VERBOSE&VERBOSE_DRIVER) {
+ fprintf(stderr,"fxmesa: fxMesaCreateContext() End (defualt)\n");
+ }
+ return NULL;
}
- return NULL;
- }
- i++;
- }
+ i++;
+ }
- /* A workaround for Linux GLQuake */
- if(depthSize && alphaBuffer)
- alphaBuffer=0;
+ /* A workaround for Linux GLQuake */
+ if(depthSize && alphaBuffer)
+ alphaBuffer=0;
- if(verbose)
- fprintf(stderr,"Mesa fx Voodoo Device Driver v0.30\nWritten by David Bucciarelli ([email protected])\n");
+ if(verbose)
+ fprintf(stderr,"Mesa fx Voodoo Device Driver v0.30\nWritten by David Bucciarelli ([email protected])\n");
- if((type=fxQueryHardware()) >= 0) {
- if(type==GR_SSTTYPE_VOODOO)
- win=0;
+ if((type=fxQueryHardware()) < 0) {
+ fprintf(stderr,"fx Driver: ERROR no Voodoo1/2 Graphics or Voodoo Rush !\n");
+ return NULL;
+ }
- grSstSelect(glbCurrentBoard);
+ if(type==GR_SSTTYPE_VOODOO)
+ win=0;
-#if FXMESA_USE_ARGB
- glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
- GR_COLORFORMAT_ARGB,GR_ORIGIN_LOWER_LEFT,2,aux);
+ grSstSelect(glbCurrentBoard);
-#else
- glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
- GR_COLORFORMAT_ABGR,GR_ORIGIN_LOWER_LEFT,2,aux);
-#endif
- if (!glideContext){
- errorstr = "grSstWinOpen";
+ fxMesa=(fxMesaContext)calloc(1,sizeof(struct tfxMesaContext));
+ if(!fxMesa) {
+ errorstr = "malloc";
goto errorhandler;
- }
+ }
- if(verbose)
+ if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO)
+ fxMesa->haveTwoTMUs=(glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx > 1);
+ else if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96)
+ fxMesa->haveTwoTMUs=(glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.nTexelfx > 1);
+ else
+ fxMesa->haveTwoTMUs=GL_FALSE;
+
+ fxMesa->haveDoubleBuffer=doubleBuffer;
+ fxMesa->haveAlphaBuffer=alphaBuffer;
+ fxMesa->haveGlobalPaletteTexture=GL_FALSE;
+ fxMesa->haveZBuffer=depthSize ? 1 : 0;
+ fxMesa->verbose=verbose;
+ fxMesa->width=FX_grSstScreenWidth();
+ fxMesa->height=FX_grSstScreenHeight();
+ fxMesa->board=glbCurrentBoard;
+
+ if(verbose)
fprintf(stderr,"Glide screen size: %dx%d\n",
(int)FX_grSstScreenWidth(),(int)FX_grSstScreenHeight());
- } else {
- fprintf(stderr,"fx Driver: ERROR no Voodoo1/2 Graphics or Voodoo Rush !\n");
- return NULL;
- }
- fxMesa=(fxMesaContext)calloc(1,sizeof(struct tfxMesaContext));
- if(!fxMesa) {
- errorstr = "malloc";
- goto errorhandler;
- }
-
- FX_setupGrVertexLayout();
-
- fxMesa->glideContext = glideContext;
- fxMesa->board=glbCurrentBoard;
- fxMesa->width=FX_grSstScreenWidth();
- fxMesa->height=FX_grSstScreenHeight();
-
- fxMesa->verbose=verbose;
-
- if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO)
- fxMesa->haveTwoTMUs=(glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx > 1);
- else if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96)
- fxMesa->haveTwoTMUs=(glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.nTexelfx > 1);
- else
- fxMesa->haveTwoTMUs=GL_FALSE;
-
- if (getenv("FX_EMULATE_SINGLE_TMU")) {
- if (MESA_VERBOSE&VERBOSE_DRIVER)
- fprintf(stderr, "\n\nEmulating single tmu\n\n");
- fxMesa->haveTwoTMUs = GL_FALSE;
- }
-
- fxMesa->emulateTwoTMUs = fxMesa->haveTwoTMUs;
-
- if (!getenv("FX_DONT_FAKE_MULTITEX")) {
- if (MESA_VERBOSE&VERBOSE_DRIVER) {
- if (!fxMesa->haveTwoTMUs)
- fprintf(stderr, "\n\nEmulating multitexture\n\n");
- }
- fxMesa->emulateTwoTMUs = GL_TRUE;
- }
-
-
- fxMesa->haveDoubleBuffer=doubleBuffer;
- fxMesa->haveAlphaBuffer=alphaBuffer;
- fxMesa->haveGlobalPaletteTexture=GL_FALSE;
-
- if(getenv("FX_GLIDE_SWAPINTERVAL"))
- fxMesa->swapInterval=atoi(getenv("FX_GLIDE_SWAPINTERVAL"));
- else
- fxMesa->swapInterval=1;
-
- if(getenv("MESA_FX_SWAP_PENDING"))
- fxMesa->maxPendingSwapBuffers=atoi(getenv("MESA_FX_SWAP_PENDING"));
- else
- fxMesa->maxPendingSwapBuffers=2;
-
- fxMesa->color=0xffffffff;
- fxMesa->clearC=0;
- fxMesa->clearA=0;
-
- fxMesa->stats.swapBuffer=0;
- fxMesa->stats.reqTexUpload=0;
- fxMesa->stats.texUpload=0;
- fxMesa->stats.memTexUpload=0;
-
- fxMesa->tmuSrc=FX_TMU_NONE;
- fxMesa->lastUnitsMode=FX_UM_NONE;
- fxTMInit(fxMesa);
-
- /* FX units setup */
-
- fxMesa->unitsState.alphaTestEnabled=GL_FALSE;
- fxMesa->unitsState.alphaTestFunc=GR_CMP_ALWAYS;
- fxMesa->unitsState.alphaTestRefValue=0;
-
- fxMesa->unitsState.blendEnabled=GL_FALSE;
- fxMesa->unitsState.blendSrcFuncRGB=GR_BLEND_ONE;
- fxMesa->unitsState.blendDstFuncRGB=GR_BLEND_ZERO;
- fxMesa->unitsState.blendSrcFuncAlpha=GR_BLEND_ONE;
- fxMesa->unitsState.blendDstFuncAlpha=GR_BLEND_ZERO;
-
- fxMesa->unitsState.depthTestEnabled =GL_FALSE;
- fxMesa->unitsState.depthMask =GL_TRUE;
- fxMesa->unitsState.depthTestFunc =GR_CMP_LESS;
-
- grColorMask(FXTRUE,alphaBuffer ? FXTRUE : FXFALSE);
- if(doubleBuffer) {
- fxMesa->currentFB=GR_BUFFER_BACKBUFFER;
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- } else {
- fxMesa->currentFB=GR_BUFFER_FRONTBUFFER;
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- }
-
- fxMesa->state = NULL;
- fxMesa->fogTable = NULL;
-
- fxMesa->state = malloc(FX_grGetInteger(FX_GLIDE_STATE_SIZE));
- fxMesa->fogTable = malloc(FX_grGetInteger(FX_FOG_TABLE_ENTRIES)*sizeof(GrFog_t));
-
- if (!fxMesa->state || !fxMesa->fogTable) {
- errorstr = "malloc";
- goto errorhandler;
- }
-
- if(depthSize)
- grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
-
-#if (!FXMESA_USE_ARGB)
- grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); /* Not every Glide supports this */
-#endif
-
- fxMesa->glVis=gl_create_visual(GL_TRUE, /* RGB mode */
- alphaBuffer,
- doubleBuffer,
- GL_FALSE, /* stereo */
- depthSize, /* depth_size */
- stencilSize, /* stencil_size */
- accumSize, /* accum_size */
- 0, /* index bits */
- 5,6,5,0); /* RGBA bits */
- if (!fxMesa->glVis) {
- errorstr = "gl_create_visual";
- goto errorhandler;
- }
-
- ctx = fxMesa->glCtx=gl_create_context(fxMesa->glVis,
- shareCtx, /* share list context */
- (void *) fxMesa, GL_TRUE);
- if (!ctx) {
- errorstr = "gl_create_context";
- goto errorhandler;
- }
-
- fxMesa->glBuffer=gl_create_framebuffer(fxMesa->glVis);
- if (!fxMesa->glBuffer) {
- errorstr = "gl_create_framebuffer";
- goto errorhandler;
- }
-
- fxMesa->glCtx->Const.MaxTextureLevels=9;
- fxMesa->glCtx->Const.MaxTextureSize=256;
- fxMesa->glCtx->Const.MaxTextureUnits=fxMesa->emulateTwoTMUs ? 2 : 1;
+ fxMesa->glVis=gl_create_visual(GL_TRUE, /* RGB mode */
+ alphaBuffer,
+ doubleBuffer,
+ GL_FALSE, /* stereo */
+ depthSize, /* depth_size */
+ stencilSize, /* stencil_size */
+ accumSize, /* accum_size */
+ 0, /* index bits */
+ 5,6,5,0); /* RGBA bits */
+ if (!fxMesa->glVis) {
+ errorstr = "gl_create_visual";
+ goto errorhandler;
+ }
- fxMesa->glCtx->NewState|=NEW_DRVSTATE1;
- fxMesa->new_state = NEW_ALL;
-
- fxDDSetupInit();
- fxDDCvaInit();
- fxDDClipInit();
- fxDDTrifuncInit();
- fxDDFastPathInit();
+ ctx = fxMesa->glCtx=gl_create_context(fxMesa->glVis,
+ shareCtx, /* share list context */
+ (void *) fxMesa, GL_TRUE);
+ if (!ctx) {
+ errorstr = "gl_create_context";
+ goto errorhandler;
+ }
- fxSetupDDPointers(fxMesa->glCtx);
- fxDDRenderInit(fxMesa->glCtx);
- fxDDInitExtensions(fxMesa->glCtx);
- fxDDSetNearFar(fxMesa->glCtx,1.0,100.0);
-
- grGlideGetState((GrState*)fxMesa->state);
+ if (!fxDDInitFxMesaContext( fxMesa, win, res, ref, aux )) {
+ errorstr = "fxDDInitFxMesaContext failed";
+ goto errorhandler;
+ }
- /* XXX Fix me: callback not registered when main VB is created.
- */
- if (fxMesa->glCtx->VB)
- fxDDRegisterVB( fxMesa->glCtx->VB );
-
- /* XXX Fix me too: need to have the 'struct dd' prepared prior to
- * creating the context... The below is broken if you try to insert
- * new stages.
- */
- if (ctx->NrPipelineStages)
- ctx->NrPipelineStages = fxDDRegisterPipelineStages( ctx->PipelineStage,
- ctx->PipelineStage,
- ctx->NrPipelineStages);
+ fxMesa->glBuffer=gl_create_framebuffer(fxMesa->glVis);
+ if (!fxMesa->glBuffer) {
+ errorstr = "gl_create_framebuffer";
+ goto errorhandler;
+ }
- glbTotNumCtx++;
-
- /* Run the config file */
- gl_context_initialize( fxMesa->glCtx );
+ glbTotNumCtx++;
- /* install signal handlers */
+ /* install signal handlers */
#if defined(__linux__)
- if (fxMesa->glCtx->CatchSignals) {
- signal(SIGINT,cleangraphics_handler);
- signal(SIGHUP,cleangraphics_handler);
- signal(SIGPIPE,cleangraphics_handler);
- signal(SIGFPE,cleangraphics_handler);
- signal(SIGBUS,cleangraphics_handler);
- signal(SIGILL,cleangraphics_handler);
- signal(SIGSEGV,cleangraphics_handler);
- signal(SIGTERM,cleangraphics_handler);
- }
+ if (fxMesa->glCtx->CatchSignals) {
+ signal(SIGINT,cleangraphics_handler);
+ signal(SIGHUP,cleangraphics_handler);
+ signal(SIGPIPE,cleangraphics_handler);
+ signal(SIGFPE,cleangraphics_handler);
+ signal(SIGBUS,cleangraphics_handler);
+ signal(SIGILL,cleangraphics_handler);
+ signal(SIGSEGV,cleangraphics_handler);
+ signal(SIGTERM,cleangraphics_handler);
+ }
#endif
- if (MESA_VERBOSE&VERBOSE_DRIVER) {
- fprintf(stderr,"fxmesa: fxMesaCreateContext() End\n");
- }
+ if (MESA_VERBOSE&VERBOSE_DRIVER) {
+ fprintf(stderr,"fxmesa: fxMesaCreateContext() End\n");
+ }
- return fxMesa;
+ return fxMesa;
-errorhandler:
+ errorhandler:
if (fxMesa) {
if (fxMesa->glideContext)
- FX_grSstWinClose(fxMesa->glideContext);
+ FX_grSstWinClose(fxMesa->glideContext);
fxMesa->glideContext = 0;
if (fxMesa->state)
- free(fxMesa->state);
+ free(fxMesa->state);
if (fxMesa->fogTable)
- free(fxMesa->fogTable);
+ free(fxMesa->fogTable);
if (fxMesa->glBuffer)
- gl_destroy_framebuffer(fxMesa->glBuffer);
+ gl_destroy_framebuffer(fxMesa->glBuffer);
if (fxMesa->glVis)
- gl_destroy_visual(fxMesa->glVis);
+ gl_destroy_visual(fxMesa->glVis);
if (fxMesa->glCtx)
- gl_destroy_context(fxMesa->glCtx);
+ gl_destroy_context(fxMesa->glCtx);
free(fxMesa);
}
- if (MESA_VERBOSE&VERBOSE_DRIVER) {
+ if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxMesaCreateContext() End (%s)\n",errorstr);
- }
- return NULL;
+ }
+ return NULL;
}
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index 8ba124508e6..a726b0a44f7 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -29,6 +29,7 @@
#if defined(FX)
+#include "types.h"
#include "fxdrv.h"
#include "enums.h"
#include "extensions.h"
@@ -354,53 +355,159 @@ void fxDDSetNearFar(GLcontext *ctx, GLfloat n, GLfloat f)
*/
static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name)
{
- static char *extensions="GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp 3DFX_set_global_palette GL_FXMESA_global_texture_lod_bias";
+ switch (name) {
+ case GL_RENDERER:
+#if defined(GLX_DIRECT_RENDERING)
+ return "Mesa Glide - DRI VB/V3";
+#else
+ return "Mesa Glide";
+#endif
+ default:
+ return NULL;
+ }
+}
- static char buf[MAX_NUM_SST][64];
- fxQueryHardware();
+int fxDDInitFxMesaContext( fxMesaContext fxMesa,
+ int win,
+ int res,
+ int ref,
+ int aux )
+{
+ FX_GrContext_t glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
+#if FXMESA_USE_ARGB
+ GR_COLORFORMAT_ARGB,
+#else
+ GR_COLORFORMAT_ABGR,
+#endif
+ GR_ORIGIN_LOWER_LEFT,
+ 2,
+ aux);
+
+ if (!glideContext) return 0;
+
+ FX_setupGrVertexLayout();
+
+ fxMesa->glideContext = glideContext;
+
+ if (getenv("FX_EMULATE_SINGLE_TMU"))
+ fxMesa->haveTwoTMUs = GL_FALSE;
+
+ fxMesa->emulateTwoTMUs = fxMesa->haveTwoTMUs;
+
+ if (!getenv("FX_DONT_FAKE_MULTITEX"))
+ fxMesa->emulateTwoTMUs = GL_TRUE;
+
+ if(getenv("FX_GLIDE_SWAPINTERVAL"))
+ fxMesa->swapInterval=atoi(getenv("FX_GLIDE_SWAPINTERVAL"));
+ else
+ fxMesa->swapInterval=1;
+
+ if(getenv("MESA_FX_SWAP_PENDING"))
+ fxMesa->maxPendingSwapBuffers=atoi(getenv("MESA_FX_SWAP_PENDING"));
+ else
+ fxMesa->maxPendingSwapBuffers=2;
+
+ fxMesa->color=0xffffffff;
+ fxMesa->clearC=0;
+ fxMesa->clearA=0;
+
+ fxMesa->stats.swapBuffer=0;
+ fxMesa->stats.reqTexUpload=0;
+ fxMesa->stats.texUpload=0;
+ fxMesa->stats.memTexUpload=0;
+
+ fxMesa->tmuSrc=FX_TMU_NONE;
+ fxMesa->lastUnitsMode=FX_UM_NONE;
+ fxTMInit(fxMesa);
+
+ /* FX units setup */
+
+ fxMesa->unitsState.alphaTestEnabled=GL_FALSE;
+ fxMesa->unitsState.alphaTestFunc=GR_CMP_ALWAYS;
+ fxMesa->unitsState.alphaTestRefValue=0;
+
+ fxMesa->unitsState.blendEnabled=GL_FALSE;
+ fxMesa->unitsState.blendSrcFuncRGB=GR_BLEND_ONE;
+ fxMesa->unitsState.blendDstFuncRGB=GR_BLEND_ZERO;
+ fxMesa->unitsState.blendSrcFuncAlpha=GR_BLEND_ONE;
+ fxMesa->unitsState.blendDstFuncAlpha=GR_BLEND_ZERO;
+
+ fxMesa->unitsState.depthTestEnabled =GL_FALSE;
+ fxMesa->unitsState.depthMask =GL_TRUE;
+ fxMesa->unitsState.depthTestFunc =GR_CMP_LESS;
+
+ grColorMask(FXTRUE, fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE);
+ if(fxMesa->haveDoubleBuffer) {
+ fxMesa->currentFB=GR_BUFFER_BACKBUFFER;
+ grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ } else {
+ fxMesa->currentFB=GR_BUFFER_FRONTBUFFER;
+ grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ }
+
+ fxMesa->state = NULL;
+ fxMesa->fogTable = NULL;
+
+ fxMesa->state = malloc(FX_grGetInteger(FX_GLIDE_STATE_SIZE));
+ fxMesa->fogTable = malloc(FX_grGetInteger(FX_FOG_TABLE_ENTRIES)*sizeof(GrFog_t));
+
+ if (!fxMesa->state || !fxMesa->fogTable) {
+ if (fxMesa->state) free(fxMesa->state);
+ if (fxMesa->fogTable) free(fxMesa->fogTable);
+ return 0;
+ }
- switch (name) {
- case GL_RENDERER:
- if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO) {
- sprintf(buf[glbCurrentBoard],"Mesa Glide v0.30 Voodoo_Graphics %d CARD/%d FB/%d TM/%d TMU/%s",
- glbCurrentBoard,
+ if(fxMesa->haveZBuffer)
+ grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
+
+#if (!FXMESA_USE_ARGB)
+ grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); /* Not every Glide has this */
+#endif
- (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.sliDetect ?
- (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbRam*2) :
- glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbRam),
+ fxMesa->glCtx->Const.MaxTextureLevels=9;
+ fxMesa->glCtx->Const.MaxTextureSize=256;
+ fxMesa->glCtx->Const.MaxTextureUnits=fxMesa->emulateTwoTMUs ? 2 : 1;
+ fxMesa->glCtx->NewState|=NEW_DRVSTATE1;
+ fxMesa->new_state = NEW_ALL;
+
+ fxDDSetupInit();
+ fxDDCvaInit();
+ fxDDClipInit();
+ fxDDTrifuncInit();
+ fxDDFastPathInit();
- glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.tmuConfig[GR_TMU0].tmuRam+
- ((glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx>1) ?
- glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.tmuConfig[GR_TMU1].tmuRam :
- 0),
+ fxSetupDDPointers(fxMesa->glCtx);
+ fxDDRenderInit(fxMesa->glCtx);
+ fxDDInitExtensions(fxMesa->glCtx);
- glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx,
+ fxDDSetNearFar(fxMesa->glCtx,1.0,100.0);
+
+ grGlideGetState((GrState*)fxMesa->state);
- (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.sliDetect ? "SLI" : "NOSLI")
- );
- }
- else {
- if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96)
- sprintf(buf[glbCurrentBoard],"Glide v0.30 Voodoo_Rush %d CARD/%d FB/%d TM/%d TMU/NOSLI",
- glbCurrentBoard,
+ /* XXX Fix me: callback not registered when main VB is created.
+ */
+ if (fxMesa->glCtx->VB)
+ fxDDRegisterVB( fxMesa->glCtx->VB );
+
+ /* XXX Fix me too: need to have the 'struct dd' prepared prior to
+ * creating the context... The below is broken if you try to insert
+ * new stages.
+ */
+ if (fxMesa->glCtx->NrPipelineStages)
+ fxMesa->glCtx->NrPipelineStages = fxDDRegisterPipelineStages(
+ fxMesa->glCtx->PipelineStage,
+ fxMesa->glCtx->PipelineStage,
+ fxMesa->glCtx->NrPipelineStages);
+
+ /* Run the config file */
+ gl_context_initialize( fxMesa->glCtx );
+
+ return 1;
+}
- glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.fbRam,
- glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.tmuConfig.tmuRam,
- glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.nTexelfx
- );
- else
- strcpy(buf[glbCurrentBoard],"Glide v0.30 UNKNOWN");
- }
- return (GLubyte *) buf[glbCurrentBoard];
- case GL_EXTENSIONS:
- return (GLubyte *) extensions;
- default:
- return NULL;
- }
-}
void fxDDInitExtensions( GLcontext *ctx )
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index 92d867b0a7a..3559ad9a051 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -29,11 +29,16 @@
* you turn debugging on/off from the debugger.
*/
+#ifndef XFree86Server
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
+#else
+#include "GL/xf86glx.h"
+#endif
+
#if defined(__linux__)
#include <signal.h>
@@ -378,9 +383,15 @@ struct tfxMesaVertexBuffer {
};
#define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data))
-#define FX_CONTEXT(ctx) ((struct tfxMesaContext *)((ctx)->DriverCtx))
+#define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
#define FX_TEXTURE_DATA(t) ((tfxTexInfo *) ((t)->Current->DriverData))
+#if defined(XFree86Server) || defined(GLX_DIRECT_RENDERING)
+#include "tdfx_init.h"
+#else
+#define DRI_FX_CONTEXT
+#endif
+
struct tfxMesaContext {
GuTexPalette glbPalette;
@@ -458,12 +469,16 @@ struct tfxMesaContext {
GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */
GLboolean haveAlphaBuffer;
+ GLboolean haveZBuffer;
GLboolean haveDoubleBuffer;
GLboolean haveGlobalPaletteTexture;
GLint swapInterval;
GLint maxPendingSwapBuffers;
FX_GrContext_t glideContext;
+
+ DRI_FX_CONTEXT
+
};
typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint);
@@ -475,10 +490,10 @@ extern void fxSetupFXUnits(GLcontext *);
extern void fxSetupDDPointers(GLcontext *);
extern void fxDDSetNearFar(GLcontext *, GLfloat, GLfloat);
-extern void fxDDSetupInit();
-extern void fxDDCvaInit();
-extern void fxDDTrifuncInit();
-extern void fxDDFastPathInit();
+extern void fxDDSetupInit(void);
+extern void fxDDCvaInit(void);
+extern void fxDDTrifuncInit(void);
+extern void fxDDFastPathInit(void);
extern void fxDDChooseRenderState( GLcontext *ctx );
@@ -498,7 +513,7 @@ extern quad_func fxDDChooseQuadFunction(GLcontext *);
extern render_func **fxDDChooseRenderVBTables(GLcontext *);
extern void fxDDRenderInit(GLcontext *);
-extern void fxDDClipInit();
+extern void fxDDClipInit(void);
extern void fxUpdateDDSpanPointers(GLcontext *);
extern void fxSetupDDSpanPointers(GLcontext *);
@@ -554,8 +569,8 @@ extern void fxDDRenderVBIndirectDirect( struct vertex_buffer *VB );
extern void fxDDInitExtensions( GLcontext *ctx );
-extern void fxTMInit(fxMesaContext);
-extern void fxTMClose(fxMesaContext);
+extern void fxTMInit(fxMesaContext ctx);
+extern void fxTMClose(fxMesaContext ctx);
extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint);
extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *);
extern void fxTMFreeTexture(fxMesaContext, struct gl_texture_object *);
@@ -603,5 +618,7 @@ extern void fxPrintHintState( const char *msg, GLuint state );
extern void fxDDDoRenderVB( struct vertex_buffer *VB );
+extern int fxDDInitFxMesaContext( fxMesaContext fxMesa,
+ int win, int res, int ref, int aux );
#endif