summaryrefslogtreecommitdiff
path: root/xc/extras/Mesa/src/FX
diff options
context:
space:
mode:
Diffstat (limited to 'xc/extras/Mesa/src/FX')
-rw-r--r--xc/extras/Mesa/src/FX/fxglidew.c48
-rw-r--r--xc/extras/Mesa/src/FX/fxglidew.h119
-rw-r--r--xc/extras/Mesa/src/FX/fxrender.c31
3 files changed, 166 insertions, 32 deletions
diff --git a/xc/extras/Mesa/src/FX/fxglidew.c b/xc/extras/Mesa/src/FX/fxglidew.c
index 790e5c923..57b35ad4d 100644
--- a/xc/extras/Mesa/src/FX/fxglidew.c
+++ b/xc/extras/Mesa/src/FX/fxglidew.c
@@ -55,6 +55,13 @@
#include <stdlib.h>
#include <string.h>
+
+grStencilFunc_t grStencilFuncPtr = NULL;
+grStencilMask_t grStencilMaskPtr = NULL;
+grStencilOp_t grStencilOpPtr = NULL;
+grBufferClearExt_t grBufferClearExtPtr = NULL;
+
+
FxI32 FX_grGetInteger_NoLock(FxU32 pname)
{
#if !defined(FX_GLIDE3)
@@ -71,6 +78,8 @@ FxI32 FX_grGetInteger_NoLock(FxU32 pname)
case FX_TEXTURE_ALIGN:
/* This is a guess from reading the glide3 docs */
return 8;
+ case FX_ZDEPTH_MAX:
+ return 0xFFFF;
default:
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n");
@@ -90,6 +99,12 @@ FxI32 FX_grGetInteger_NoLock(FxU32 pname)
case FX_TEXTURE_ALIGN:
grname = pname;
break;
+ case FX_ZDEPTH_MAX: {
+ int zvals[2];
+
+ grGet(GR_ZDEPTH_MIN_MAX, 8, zvals);
+ return zvals[0];
+ }
default:
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n");
@@ -154,7 +169,17 @@ extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu) {
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;
@@ -225,12 +250,12 @@ void FX_grGlideGetVersion(char *buf)
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)
@@ -385,6 +410,10 @@ int FX_grSstQueryHardware(GrHwConfiguration *c)
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,
@@ -403,6 +432,7 @@ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
nColBuffers,
nAuxBuffers );
+ /*
fprintf(stderr,
"grSstWinOpen( win %d res %d ref %d fmt %d\n"
" org %d ncol %d naux %d )\n"
@@ -415,13 +445,11 @@ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
nColBuffers,
nAuxBuffers,
i);
+ */
END_BOARD_LOCK();
return i;
}
-
-
-#endif
#else
/*
diff --git a/xc/extras/Mesa/src/FX/fxglidew.h b/xc/extras/Mesa/src/FX/fxglidew.h
index 28556d8c5..f188c263d 100644
--- a/xc/extras/Mesa/src/FX/fxglidew.h
+++ b/xc/extras/Mesa/src/FX/fxglidew.h
@@ -47,7 +47,51 @@
#define __FX_GLIDE_WARPER__
#include <glide.h>
+#include <g3ext.h>
+/*
+ * These are glide extension definitions. These are not
+ * defined in glide.h. They should really be defined in
+ * g3ext.h, but they are not.
+ */
+#if 0
+FX_ENTRY void FX_CALL
+grStencilFunc(GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask);
+
+FX_ENTRY void FX_CALL
+grStencilMask(GrStencil_t write_mask);
+
+FX_ENTRY void FX_CALL
+grStencilOp(
+ GrStencilOp_t stencil_fail,
+ GrStencilOp_t depth_fail,
+ GrStencilOp_t depth_pass);
+
+FX_ENTRY void FX_CALL
+grBufferClearExt(
+ GrColor_t color,
+ GrAlpha_t alpha,
+ FxU32 depth,
+ GrStencil_t stencil);
+#endif
+
+
+typedef void (*grStencilFunc_t)(GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask);
+typedef void (*grStencilMask_t)(GrStencil_t write_mask);
+typedef void (*grStencilOp_t)(GrStencilOp_t stencil_fail, GrStencilOp_t depth_fail, GrStencilOp_t depth_pass);
+typedef void (*grBufferClearExt_t)(GrColor_t color, GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil);
+
+extern grStencilFunc_t grStencilFuncPtr;
+extern grStencilMask_t grStencilMaskPtr;
+extern grStencilOp_t grStencilOpPtr;
+extern grBufferClearExt_t grBufferClearExtPtr;
+
+
+FX_ENTRY void FX_CALL
+grEnable(GrEnableMode_t mode);
+
+FX_ENTRY void FX_CALL
+grEnable(GrEnableMode_t mode);
/*
* General context:
*/
@@ -74,12 +118,13 @@
#define FX_PENDING_BUFFERSWAPS GR_PENDING_BUFFERSWAPS
#define FX_TEXTURE_ALIGN GR_TEXTURE_ALIGN
#endif
+#define FX_ZDEPTH_MAX 0x100
/*
* Genral warper functions for Glide2/Glide3:
*/
-extern FxI32 FX_grGetInteger(FxU32 pname);
extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
+extern FxI32 FX_grGetInteger(FxU32 pname);
/*
* Glide2 emulation on Glide3:
@@ -253,7 +298,6 @@ typedef struct
#endif
-
/*
* Glide2 functions for Glide3
*/
@@ -334,10 +378,11 @@ typedef struct
/*
* Draw triangle
*/
+#define FX_grDrawTriangle_NoLock(a,b,c) grDrawTriangle(a,b,c)
#define FX_grDrawTriangle(a,b,c) \
do { \
BEGIN_CLIP_LOOP(); \
- grDrawTriangle(a,b,c); \
+ FX_grDrawTriangle_NoLock(a,b,c); \
END_CLIP_LOOP(); \
} while (0)
@@ -521,17 +566,19 @@ extern FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
int nAuxBuffers);
+#define FX_grDrawLine_NoLock(v1, v2) grDrawLine(v1, v2)
#define FX_grDrawLine(v1, v2) \
do { \
BEGIN_CLIP_LOOP(); \
- grDrawLine(v1, v2); \
+ FX_grDrawLine_NoLock(v1, v2);\
END_CLIP_LOOP(); \
} while (0)
+#define FX_grDrawPoint_NoLock(p) grDrawPoint(p)
#define FX_grDrawPoint(p) \
do { \
BEGIN_CLIP_LOOP(); \
- grDrawPoint(p); \
+ FX_grDrawPoint_NoLock(p); \
END_CLIP_LOOP(); \
} while (0)
@@ -567,6 +614,55 @@ extern void FX_grDrawPolygonVertexList(int n, GrVertex *v);
END_CLIP_LOOP(); \
} while (0)
+#define FX_grBufferClearExt(c, a, d, s) \
+ do { \
+ BEGIN_CLIP_LOOP(); \
+ (*grBufferClearExtPtr)(c, a, d, s); \
+ END_CLIP_LOOP(); \
+ } while (0)
+
+/*
+ * Enable/Disable
+ */
+#define FX_grEnable(m) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grEnable(m); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grDisable(m) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grDisable(m); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+/*
+ * Stencil operations.
+ */
+#define FX_grStencilFunc(fnc, ref, mask) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ (*grStencilFuncPtr)((fnc), (ref), (mask)); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grStencilMask(write_mask) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ (*grStencilMaskPtr)(write_mask); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+
+#define FX_grStencilOp(stencil_fail, depth_fail, depth_pass) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ (*grStencilOpPtr)((stencil_fail), (depth_fail), (depth_pass)); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
#define FX_grDepthMask(m) \
do { \
BEGIN_BOARD_LOCK(); \
@@ -821,9 +917,18 @@ extern FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info);
#define FX_grGlideShutdown() \
do { \
- BEGIN_CLIP_LOOP(); \
+ BEGIN_BOARD_LOCK(); \
grGlideShutdown(); \
- END_CLIP_LOOP(); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grTexLodBiasValue_NoLock(t, v) grTexLodBiasValue(t, v)
+
+#define FX_grTexLodBiasValue(t, v) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grTexLodBiasValue(t, v); \
+ END_BOARD_LOCK(); \
} while (0)
#define FX_grGlideInit_NoLock grGlideInit
diff --git a/xc/extras/Mesa/src/FX/fxrender.c b/xc/extras/Mesa/src/FX/fxrender.c
index 8ce4b0618..9c5329fff 100644
--- a/xc/extras/Mesa/src/FX/fxrender.c
+++ b/xc/extras/Mesa/src/FX/fxrender.c
@@ -533,43 +533,44 @@ static INLINE void fxSafeClippedTriangle3( struct vertex_buffer *VB,
do { \
GLuint e; \
for(e=start;e<=count;e++) { \
- FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \
+ FX_grDrawPoint_NoLock((GrVertex *)gWin[elt[e]].f);\
} \
} while (0)
#define RENDER_LINE( i1, i ) \
do { \
GLuint e1 = elt[i1], e = elt[i]; \
- FX_grDrawLine((GrVertex *)gWin[e1].f, (GrVertex *)gWin[e].f); \
+ FX_grDrawLine_NoLock((GrVertex *)gWin[e1].f, (GrVertex *)gWin[e].f);\
} while (0)
#define RENDER_TRI( i2, i1, i, pv, parity) \
do { \
GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
- if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \
- FX_grDrawTriangle((GrVertex *)gWin[e2].f, \
- (GrVertex *)gWin[e1].f, \
- (GrVertex *)gWin[e].f); \
+ if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \
+ FX_grDrawTriangle_NoLock((GrVertex *)gWin[e2].f, \
+ (GrVertex *)gWin[e1].f, \
+ (GrVertex *)gWin[e].f); \
} while (0)
#define RENDER_QUAD( i3, i2, i1, i, pv) \
do { \
GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\
- FX_grDrawTriangle((GrVertex *)gWin[e3].f, \
- (GrVertex *)gWin[e2].f, \
- (GrVertex *)gWin[e].f); \
- FX_grDrawTriangle((GrVertex *)gWin[e2].f, \
- (GrVertex *)gWin[e1].f, \
- (GrVertex *)gWin[e].f); \
+ FX_grDrawTriangle_NoLock((GrVertex *)gWin[e3].f, \
+ (GrVertex *)gWin[e2].f, \
+ (GrVertex *)gWin[e].f); \
+ FX_grDrawTriangle_NoLock((GrVertex *)gWin[e2].f, \
+ (GrVertex *)gWin[e1].f, \
+ (GrVertex *)gWin[e].f); \
} while (0)
#define LOCAL_VARS \
fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \
const GLuint *elt = VB->EltPtr->data;
-#define INIT(x)
+#define INIT(x) BEGIN_CLIP_LOOP();
+#define POSTFIX END_CLIP_LOOP();
#define TAG(x) x##_fx_smooth_indirect
#undef RVB_COLOR
@@ -722,8 +723,8 @@ render_func **fxDDChooseRenderVBTables(GLcontext *ctx)
return null_tables;
switch (fxMesa->render_index) {
- case FX_FLAT:
- return fxDDRenderVBFlat_tables;
+/* case FX_FLAT: */
+/* return fxDDRenderVBFlat_tables; */
case 0:
return fxDDRenderVBSmooth_tables;
default: