-/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
* Mesa 3-D graphics library
#include <stdlib.h>
#include <string.h>
-static FxI32 FX_grGetInteger_NoLock(FxU32 pname)
+FxI32 FX_grGetInteger_NoLock(FxU32 pname)
{
#if !defined(FX_GLIDE3)
switch (pname)
return FXFALSE;
case FX_PENDING_BUFFERSWAPS:
return grBufferNumPending();
+ case FX_TEXTURE_ALIGN:
+ /* This is a guess from reading the glide3 docs */
+ return 8;
default:
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n");
case FX_GLIDE_STATE_SIZE:
case FX_LFB_PIXEL_PIPE:
case FX_PENDING_BUFFERSWAPS:
+ case FX_TEXTURE_ALIGN:
grname = pname;
break;
default:
FxBool FX_grSstControl(FxU32 code)
{
#if defined(FX_GLIDE3)
- (void) code;
+ /* The glide 3 sources call for grEnable/grDisable to be called in exchange
+ * for grSstControl. */
+ switch(code) {
+ case GR_CONTROL_ACTIVATE:
+ grEnable(GR_PASSTHRU);
+ break;
+ case GR_CONTROL_DEACTIVATE:
+ grDisable(GR_PASSTHRU);
+ break;
+ }
+ /* Appearently GR_CONTROL_RESIZE can be ignored. */
return 1; /* OK? */
#else
FxU32 result;
void FX_grSstPerfStats(GrSstPerfStats_t *st)
{
- /* ToDo */
- st->pixelsIn = 0;
- st->chromaFail = 0;
- st->zFuncFail = 0;
- st->aFuncFail = 0;
- st->pixelsOut = 0;
+ FxI32 n;
+ grGet(GR_STATS_PIXELS_IN, 4, &n); st->pixelsIn = n;
+ grGet(GR_STATS_PIXELS_CHROMA_FAIL, 4, &n); st->chromaFail = n;
+ grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &n); st->zFuncFail = n;
+ grGet(GR_STATS_PIXELS_AFUNC_FAIL, 4, &n); st->aFuncFail = n;
+ grGet(GR_STATS_PIXELS_OUT, 4, &n); st->pixelsOut = n;
}
void FX_grAADrawLine(GrVertex *a,GrVertex *b)
END_CLIP_LOOP();
}
-#if FX_USE_PARGB
-void FX_setupGrVertexLayout(void)
+void FX_grDrawPolygonVertexList(int n, GrVertex *verts)
{
- BEGIN_BOARD_LOCK();
- grReset(GR_VERTEX_PARAMETER);
-
- grCoordinateSpace(GR_WINDOW_COORDS);
- grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
- END_BOARD_LOCK();
+ BEGIN_CLIP_LOOP();
+ grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex));
+ END_CLIP_LOOP();
}
-#else /* FX_USE_PARGB */
+
void FX_setupGrVertexLayout(void)
{
BEGIN_BOARD_LOCK();
grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
END_BOARD_LOCK();
}
-#endif
void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask)
{
END_BOARD_LOCK();
}
+/*
+ * Glide3 doesn't have the grSstQueryHardware function anymore.
+ * Instead, we call grGet() and fill in the data structures ourselves.
+ */
int FX_grSstQueryHardware(GrHwConfiguration *config)
{
- int i,j;
+ int i, j;
int numFB;
BEGIN_BOARD_LOCK();
- grGet(GR_NUM_BOARDS,4,(void*)&(config->num_sst));
+
+ grGet(GR_NUM_BOARDS, 4, (void*)&(config->num_sst));
if (config->num_sst == 0)
- return 0;
- for (i = 0; i< config->num_sst; i++)
- {
+ return 0;
+
+ for (i = 0; i< config->num_sst; i++) {
+ FxI32 result;
+
config->SSTs[i].type = GR_SSTTYPE_VOODOO;
grSstSelect(i);
- grGet(GR_MEMORY_FB,4,(void*)&(config->SSTs[i].sstBoard.VoodooConfig.fbRam));
- config->SSTs[i].sstBoard.VoodooConfig.fbRam/= 1024*1024;
+
+ grGet(GR_MEMORY_FB, 4, &result);
+ config->SSTs[i].sstBoard.VoodooConfig.fbRam = result / (1024 * 1024);
- grGet(GR_NUM_TMU,4,(void*)&(config->SSTs[i].sstBoard.VoodooConfig.nTexelfx));
+ grGet(GR_NUM_TMU, 4, &result);
+ config->SSTs[i].sstBoard.VoodooConfig.nTexelfx = result;
+
+ grGet(GR_REVISION_FB, 4, &result);
+ config->SSTs[i].sstBoard.VoodooConfig.fbiRev = result;
-
grGet(GR_NUM_FB,4,(void*)&numFB);
if (numFB > 1)
config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXTRUE;
else
config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXFALSE;
- for (j = 0; j < config->SSTs[i].sstBoard.VoodooConfig.nTexelfx; j++)
- {
- grGet(GR_MEMORY_TMU,4,(void*)&(config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam));
- config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam /= 1024*1024;
+
+ for (j = 0; j < config->SSTs[i].sstBoard.VoodooConfig.nTexelfx; j++) {
+ grGet(GR_MEMORY_TMU, 4, &result);
+ config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam = result / (1024*1024);
+ grGet(GR_REVISION_TMU, 4, &result);
+ config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRev = result;
}
}
END_BOARD_LOCK();
return i;
}
+
+#endif /* FX_GLIDE3 */
+
+/* It appears to me that this function is needed either way. */
FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
nColBuffers,
nAuxBuffers );
+ /*
fprintf(stderr,
"grSstWinOpen( win %d res %d ref %d fmt %d\n"
" org %d ncol %d naux %d )\n"
nColBuffers,
nAuxBuffers,
i);
+ */
END_BOARD_LOCK();
return i;
}
-#endif
#else
/*
* Need this to provide at least one external definition.
*/
+extern int gl_fx_dummy_function_glidew(void);
int gl_fx_dummy_function_glidew(void)
{
return 0;