#include "mtypes.h"
#include "macros.h"
#include "colormac.h"
-#include "nvfragprog.h"
-
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/t_context.h"
#include "fxdrv.h"
-GLboolean fxMultipass_ColorSum (GLcontext *ctx, GLuint pass);
+static GLboolean fxMultipass_ColorSum (GLcontext *ctx, GLuint pass);
/*
* Fallback to swrast for basic primitives *
***********************************************************************/
-/* Build an SWvertex from a hardware vertex.
+/* Build an SWvertex from a hardware vertex.
*
* This code is hit only when a mix of accelerated and unaccelerated
* primitives are being drawn, and only for the unaccelerated
- * primitives.
+ * primitives.
*/
-static void
+static void
fx_translate_vertex( GLcontext *ctx, const GrVertex *src, SWvertex *dst)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
}
-static void
-fx_fallback_tri( fxMesaContext fxMesa,
- GrVertex *v0,
- GrVertex *v1,
+static void
+fx_fallback_tri( fxMesaContext fxMesa,
+ GrVertex *v0,
+ GrVertex *v1,
GrVertex *v2 )
{
GLcontext *ctx = fxMesa->glCtx;
}
-static void
+static void
fx_fallback_line( fxMesaContext fxMesa,
GrVertex *v0,
GrVertex *v1 )
}
-static void
-fx_fallback_point( fxMesaContext fxMesa,
+static void
+fx_fallback_point( fxMesaContext fxMesa,
GrVertex *v0 )
{
GLcontext *ctx = fxMesa->glCtx;
#else /* !FX_PACKEDCOLOR */
fprintf(stderr, "\tr %f g %f b %f a %f\n", v->r, v->g, v->b, v->a);
#endif /* !FX_PACKEDCOLOR */
-
+
fprintf(stderr, "\n");
}
#define VERT_X(_v) _v->x
#define VERT_Y(_v) _v->y
#define VERT_Z(_v) _v->ooz
+#define AREA_IS_CCW( a ) IS_NEGATIVE( a )
#define GET_VERTEX(e) (fxMesa->verts + e)
-#ifdef USE_IEEE
-#define AREA_IS_CCW( a ) (((fi_type *)&(a))->i < 0)
-#else
-#define AREA_IS_CCW( a ) (a < 0)
-#endif
-
#if FX_PACKEDCOLOR
#define VERT_SET_RGBA( dst, f ) \
#define VERT_COPY_RGBA( v0, v1 ) \
do { \
- *(GLuint *)&v0->r = *(GLuint *)&v1->r; \
- *(GLuint *)&v0->g = *(GLuint *)&v1->g; \
- *(GLuint *)&v0->b = *(GLuint *)&v1->b; \
- *(GLuint *)&v0->a = *(GLuint *)&v1->a; \
+ COPY_FLOAT(v0->r, v1->r); \
+ COPY_FLOAT(v0->g, v1->g); \
+ COPY_FLOAT(v0->b, v1->b); \
+ COPY_FLOAT(v0->a, v1->a); \
} while (0)
#define VERT_SAVE_RGBA( idx ) \
do { \
- *(GLuint *)&color[idx][0] = *(GLuint *)&v[idx]->r;\
- *(GLuint *)&color[idx][1] = *(GLuint *)&v[idx]->g;\
- *(GLuint *)&color[idx][2] = *(GLuint *)&v[idx]->b;\
- *(GLuint *)&color[idx][3] = *(GLuint *)&v[idx]->a;\
+ COPY_FLOAT(color[idx][0], v[idx]->r); \
+ COPY_FLOAT(color[idx][1], v[idx]->g); \
+ COPY_FLOAT(color[idx][2], v[idx]->b); \
+ COPY_FLOAT(color[idx][3], v[idx]->a); \
} while (0)
#define VERT_RESTORE_RGBA( idx ) \
do { \
- *(GLuint *)&v[idx]->r = *(GLuint *)&color[idx][0];\
- *(GLuint *)&v[idx]->g = *(GLuint *)&color[idx][1];\
- *(GLuint *)&v[idx]->b = *(GLuint *)&color[idx][2];\
- *(GLuint *)&v[idx]->a = *(GLuint *)&color[idx][3];\
+ COPY_FLOAT(v[idx]->r, color[idx][0]); \
+ COPY_FLOAT(v[idx]->g, color[idx][1]); \
+ COPY_FLOAT(v[idx]->b, color[idx][2]); \
+ COPY_FLOAT(v[idx]->a, color[idx][3]); \
} while (0)
#define VERT_COPY_SPEC( v0, v1 ) \
do { \
- *(GLuint *)&v0->r1 = *(GLuint *)&v1->r1; \
- *(GLuint *)&v0->g1 = *(GLuint *)&v1->g1; \
- *(GLuint *)&v0->b1 = *(GLuint *)&v1->b1; \
+ COPY_FLOAT(v0->r1, v1->r1); \
+ COPY_FLOAT(v0->g1, v1->g1); \
+ COPY_FLOAT(v0->b1, v1->b1); \
} while (0)
#define VERT_SAVE_SPEC( idx ) \
do { \
- *(GLuint *)&spec[idx][0] = *(GLuint *)&v[idx]->r1;\
- *(GLuint *)&spec[idx][1] = *(GLuint *)&v[idx]->g1;\
- *(GLuint *)&spec[idx][2] = *(GLuint *)&v[idx]->b1;\
+ COPY_FLOAT(spec[idx][0], v[idx]->r1); \
+ COPY_FLOAT(spec[idx][1], v[idx]->g1); \
+ COPY_FLOAT(spec[idx][2], v[idx]->b1); \
} while (0)
#define VERT_RESTORE_SPEC( idx ) \
do { \
- *(GLuint *)&v[idx]->r1 = *(GLuint *)&spec[idx][0];\
- *(GLuint *)&v[idx]->g1 = *(GLuint *)&spec[idx][1];\
- *(GLuint *)&v[idx]->b1 = *(GLuint *)&spec[idx][2];\
+ COPY_FLOAT(v[idx]->r1, spec[idx][0]); \
+ COPY_FLOAT(v[idx]->g1, spec[idx][1]); \
+ COPY_FLOAT(v[idx]->b1, spec[idx][2]); \
} while (0)
#define LOCAL_VARS(n) \
fxMesaContext fxMesa = FX_CONTEXT(ctx); \
- GLuint color[n][4], spec[n][4]; \
+ GLfloat color[n][4], spec[n][4]; \
(void) color; (void) spec;
#endif /* !FX_PACKEDCOLOR */
grDrawVertexArrayContiguous( GR_LINE_STRIP, count-j,
fxVB + j, sizeof(GrVertex));
- if (flags & PRIM_END)
+ if (flags & PRIM_END)
grDrawLine( fxVB + (count - 1),
fxVB + start );
static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *,
GLuint,
GLuint,
- GLuint) =
+ GLuint) =
{
fx_render_vb_points,
fx_render_vb_lines,
const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
(void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
+#define RESET_STIPPLE
+#define RESET_OCCLUSION
#define PRESERVE_VB_DEFS
/* Elts, no clipping.
-static void fxRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void fxRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
GLuint n )
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
GLuint prim = fxMesa->render_primitive;
- /* Render the new vertices as an unclipped polygon.
+ /* Render the new vertices as an unclipped polygon.
*/
{
GLuint *tmp = VB->Elts;
VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n,
+ tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n,
PRIM_BEGIN|PRIM_END );
VB->Elts = tmp;
}
}
-static void fxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void fxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
GLuint n )
{
int i;
-/* Determine the rasterized primitive when not drawing unfilled
+/* Determine the rasterized primitive when not drawing unfilled
* polygons.
*/
static void fxRenderPrimitive( GLcontext *ctx, GLenum prim )
if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
return;
-
+
if (fxMesa->raster_primitive != rprim) {
fxRasterPrimitive( ctx, rprim );
}
tnl->Driver.Render.Start = fxCheckTexSizes;
tnl->Driver.Render.Finish = fxRenderFinish;
tnl->Driver.Render.PrimitiveNotify = fxRenderPrimitive;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
+ tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
tnl->Driver.Render.Start = fxCheckTexSizes;
tnl->Driver.Render.Finish = fxRenderFinish;
tnl->Driver.Render.PrimitiveNotify = fxRenderPrimitive;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
+ tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
tnl->Driver.Render.BuildVertices = fxBuildVertices;
tnl->Driver.Render.Multipass = NULL;
-
+
(void) fx_print_vertex;
}
/* [dBorca] Hack alert:
* doesn't work with blending.
*/
-GLboolean fxMultipass_ColorSum (GLcontext *ctx, GLuint pass)
+static GLboolean
+fxMultipass_ColorSum (GLcontext *ctx, GLuint pass)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxUnitsState *us = &fxMesa->unitsState;