#include "fxdrv.h"
#include "enums.h"
#include "extensions.h"
-
+#include "pb.h"
/* These lookup table are used to extract RGB values in [0,255] from
* 16-bit pixel values.
}
}
+static void fxDDReducedPrimitiveChange(GLcontext *ctx, GLenum prim)
+{
+ if (ctx->Polygon.CullFlag) {
+ if (ctx->PB->primitive != GL_POLYGON) { /* Lines or Points */
+ FX_grCullMode(GR_CULL_DISABLE);
+ FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE;
+ }
+ }
+}
+
void fxSetupDDPointers(GLcontext *ctx)
{
if (MESA_VERBOSE&VERBOSE_DRIVER) {
ctx->Driver.CullFace=fxDDCullFace;
ctx->Driver.ShadeModel=fxDDShadeModel;
ctx->Driver.Enable=fxDDEnable;
+ ctx->Driver.ReducedPrimitiveChange=fxDDReducedPrimitiveChange;
ctx->Driver.RegisterVB=fxDDRegisterVB;
ctx->Driver.UnregisterVB=fxDDUnregisterVB;
GrColor_t clearC;
GrAlpha_t clearA;
GLuint constColor;
+ GrCullMode_t cullMode;
tfxUnitsState unitsState;
tfxUnitsState restoreUnitsState; /* saved during multipass */
#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)
END_CLIP_LOOP();
}
+void FX_grDrawPolygonVertexList(int n, GrVertex *verts)
+{
+ BEGIN_CLIP_LOOP();
+ grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex));
+ END_CLIP_LOOP();
+}
+
#if FX_USE_PARGB
void FX_setupGrVertexLayout(void)
{
* Genral warper functions for Glide2/Glide3:
*/
extern FxI32 FX_grGetInteger(FxU32 pname);
+extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
/*
* Glide2 emulation on Glide3:
END_CLIP_LOOP(); \
} while (0)
+#if defined(FX_GLIDE3)
+extern void FX_grDrawPolygonVertexList(int n, GrVertex *v);
+#else
+#define FX_grDrawPolygonVertexList(n, v) \
+ do { \
+ BEGIN_CLIP_LOOP(); \
+ grDrawPolygonVertexList(n, v); \
+ END_CLIP_LOOP(); \
+ } while (0)
+#endif
+
#define FX_grDitherMode(m) \
do { \
BEGIN_BOARD_LOCK(); \
grGlideGetState(s); \
END_BOARD_LOCK(); \
} while (0)
+#define FX_grGlideGetState_NoLock(s) grGlideGetState(s);
#define FX_grDRIBufferSwap(i) \
do { \
grGlideSetState(s); \
END_BOARD_LOCK(); \
} while (0)
+#define FX_grGlideSetState_NoLock(s) grGlideSetState(s);
#define FX_grDepthBufferMode(m) \
do { \
GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION,
FXFALSE,FXFALSE);
- FX_grTexCombine_NoLock(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- FXFALSE,FXFALSE);
+ if (fxMesa->haveTwoTMUs)
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
+ FXFALSE,FXFALSE);
fxMesa->tmuSrc=FX_TMU_SPLIT;
}
else {
static void fxSetupCull(GLcontext *ctx)
{
- if(ctx->Polygon.CullFlag) {
- switch(ctx->Polygon.CullFaceMode) {
- case GL_BACK:
- if(ctx->Polygon.FrontFace==GL_CCW)
- FX_grCullMode(GR_CULL_NEGATIVE);
- else
- FX_grCullMode(GR_CULL_POSITIVE);
- break;
- case GL_FRONT:
- if(ctx->Polygon.FrontFace==GL_CCW)
- FX_grCullMode(GR_CULL_POSITIVE);
- else
- FX_grCullMode(GR_CULL_NEGATIVE);
- break;
- case GL_FRONT_AND_BACK:
- FX_grCullMode(GR_CULL_DISABLE);
- break;
- default:
- break;
- }
- } else
- FX_grCullMode(GR_CULL_DISABLE);
+ if (ctx->Polygon.CullFlag) {
+ switch (ctx->Polygon.CullFaceMode) {
+ case GL_BACK:
+ if (ctx->Polygon.FrontFace==GL_CCW)
+ FX_CONTEXT(ctx)->cullMode=GR_CULL_NEGATIVE;
+ else
+ FX_CONTEXT(ctx)->cullMode=GR_CULL_POSITIVE;
+ break;
+ case GL_FRONT:
+ if(ctx->Polygon.FrontFace==GL_CCW)
+ FX_CONTEXT(ctx)->cullMode=GR_CULL_POSITIVE;
+ else
+ FX_CONTEXT(ctx)->cullMode=GR_CULL_NEGATIVE;
+ break;
+ case GL_FRONT_AND_BACK:
+ FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE;
+ break;
+ default:
+ break;
+ }
+ } else FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE;
+ FX_grCullMode(FX_CONTEXT(ctx)->cullMode);
}
if (ctx->glCtx->Texture.Unit[i].Current==tObj) {
/* Force the texture onto the board, as it could be in use */
where=ti->whichTMU;
- ti->whichTMU=FX_TMU_NONE;
+ fxTMMoveOutTM_NoLock(ctx, tObj);
fxTMMoveInTM_NoLock(ctx, tObj, where);
break;
}