/* XXX hack for now */
#define channel 1
-static void nv10RenderPrimitive( GLcontext *ctx, GLenum prim );
static void nv10RasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim );
+static void nv10RenderPrimitive( GLcontext *ctx, GLenum prim );
+static void nv10ResetLineStipple( GLcontext *ctx );
+
/***********************************************************************
BEGIN_RING_PRIM(channel,NV20_BEGIN_VERTICES,NOUVEAU_MIN_PRIM_SIZE);
}
-static inline void nv10FinishPrimitive(struct nouveau_context *nmesa)
+inline void nv10FinishPrimitive(struct nouveau_context *nmesa)
{
FINISH_RING_PRIM();
if (nmesa->screen->card_type==NV_10)
+#define CTX_ARG nouveauContextPtr nmesa
+#define GET_VERTEX_DWORDS() nmesa->vertex_size
+#define LOCAL_VARS \
+ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); \
+ const char *nouveauverts = (char *)nmesa->verts;
+#define VERT(x) (nouveauVertex *)(nouveauverts + ((x) * vertsize * sizeof(int)))
+#define VERTEX nouveauVertex
+
+#undef TAG
+#define TAG(x) nouveau_##x
+#include "tnl_dd/t_dd_triemit.h"
+
/***********************************************************************
* Macros for nouveau_dd_tritmp.h to draw basic primitives *
***********************************************************************/
nv10_draw_point(nmesa, v0); \
} while (0)
+#undef TAG
/***********************************************************************
* Build render functions from dd templates *
color->alpha=(c)[3]; \
} while (0)
-#define VERT_COPY_RGBA( v0, v1 ) \
- do { \
- if (coloroffset) { \
- v0->f[coloroffset][0] = v1->f[coloroffset][0]; \
- v0->f[coloroffset][1] = v1->f[coloroffset][1]; \
- v0->f[coloroffset][2] = v1->f[coloroffset][2]; \
- v0->f[coloroffset][3] = v1->f[coloroffset][3]; \
- } \
- } while (0)
+#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
#define VERT_SET_SPEC( v, c ) \
do { \
#define VERT_COPY_SPEC( v0, v1 ) \
do { \
if (specoffset) { \
- v0->f[specoffset][0] = v1->f[specoffset][0]; \
- v0->f[specoffset][1] = v1->f[specoffset][1]; \
- v0->f[specoffset][2] = v1->f[specoffset][2]; \
+ nouveau_color_t *spec0 = (nouveau_color_t *)&((v0)->ui[specoffset]); \
+ nouveau_color_t *spec1 = (nouveau_color_t *)&((v1)->ui[specoffset]); \
+ spec0->red = spec1->red; \
+ spec0->green = spec1->green; \
+ spec0->blue = spec1->blue; \
} \
} while (0)
#define VERT_RESTORE_SPEC( idx ) if (specoffset) v[idx]->f[specoffset] = spec[idx]
+#undef LOCAL_VARS
#define LOCAL_VARS(n) \
struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); \
GLuint color[n], spec[n]; \
};
#define RASTERIZE(x) nv10RasterPrimitive( ctx, x, hw_prim[x] )
-#define RENDER_PRIMITIVE nmesa->renderPrimitive
+#define RENDER_PRIMITIVE nmesa->current_primitive
#define TAG(x) x
#define IND NOUVEAU_FALLBACK_BIT
#include "tnl_dd/t_dd_unfilled.h"
const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
const GLboolean stipple = ctx->Line.StippleFlag; \
(void) elt; (void) stipple;
-#define RESET_STIPPLE if ( stipple ) nouveauResetLineStipple( ctx );
+#define RESET_STIPPLE if ( stipple ) nv10ResetLineStipple( ctx );
#define RESET_OCCLUSION
#define PRESERVE_VB_DEFS
#define ELT(x) x
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint prim = NOUVEAU_CONTEXT(ctx)->renderPrimitive;
+ GLuint prim = NOUVEAU_CONTEXT(ctx)->current_primitive;
/* Render the new vertices as an unclipped polygon.
*/
index = NOUVEAU_MAX_TRIFUNC; /* flat specular */
}
- if (nmesa->renderIndex != index) {
- nmesa->renderIndex = index;
+ if (nmesa->render_index != index) {
+ nmesa->render_index = index;
tnl->Driver.Render.Points = rast_tab[index].points;
tnl->Driver.Render.Line = rast_tab[index].line;
for(i=8;i<16;i++)
{
if (index&(1<<i))
+ /* FIXME that is very dubious */
attr_size[i]=VB->TexCoordPtr[i];
else
attr_size[i]=0;
* Tell the hardware about the vertex format
*/
if (nmesa->screen->card_type==NV_10) {
- // XXX needs some love
+ int size;
+
+#define NV10_SET_VERTEX_ATTRIB(i,j) \
+ do { \
+ size = attr_size[j] << 4; \
+ size |= (attr_size[j]*4) << 8; \
+ size |= NV20_VERTEX_ATTRIBUTE_TYPE_FLOAT; \
+ BEGIN_RING_SIZE(channel, NV10_VERTEX_ATTRIBUTE(i),1); \
+ OUT_RING(size); \
+ } while (0)
+
+ NV10_SET_VERTEX_ATTRIB(0, _TNL_ATTRIB_POS);
+ NV10_SET_VERTEX_ATTRIB(1, _TNL_ATTRIB_COLOR0);
+ NV10_SET_VERTEX_ATTRIB(2, _TNL_ATTRIB_COLOR1);
+ NV10_SET_VERTEX_ATTRIB(3, _TNL_ATTRIB_TEX0);
+ NV10_SET_VERTEX_ATTRIB(4, _TNL_ATTRIB_TEX1);
+ NV10_SET_VERTEX_ATTRIB(5, _TNL_ATTRIB_NORMAL);
+ NV10_SET_VERTEX_ATTRIB(6, _TNL_ATTRIB_WEIGHT);
+ NV10_SET_VERTEX_ATTRIB(7, _TNL_ATTRIB_FOG);
+
+ BEGIN_RING_SIZE(channel, NV10_VERTEX_SET_FORMAT,1);
+ OUT_RING(0);
} else if (nmesa->screen->card_type==NV_20) {
for(i=0;i<16;i++)
{
{
struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint index = tnl->render_inputs;
+ GLuint index = tnl->render_inputs_bitset;
- if (index!=nmesa->render_inputs)
+ if (index!=nmesa->render_inputs_bitset)
{
- nmesa->render_inputs=index;
+ nmesa->render_inputs_bitset=index;
nv10OutputVertexFormat(nmesa,index);
}
}
static void nv10RenderStart(GLcontext *ctx)
{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
- if (nmesa->newState) {
- nmesa->newRenderState |= nmesa->newState;
+ if (nmesa->new_state) {
+ nmesa->new_render_state |= nmesa->new_state;
}
if (nmesa->Fallback) {
return;
}
- if (nmesa->newRenderState) {
+ if (nmesa->new_render_state) {
nv10ChooseVertexState(ctx);
nv10ChooseRenderState(ctx);
- nmesa->newRenderState = 0;
+ nmesa->new_render_state = 0;
}
}
{
struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
- assert (!nmesa->newState);
+ assert (!nmesa->new_state);
if (hwprim != nmesa->current_primitive)
{
nv10RasterPrimitive( ctx, prim, hw_prim[prim] );
}
+static void nv10ResetLineStipple( GLcontext *ctx )
+{
+ /* FIXME do something here */
+}
/**********************************************************************/
/* Initialization. */
/**********************************************************************/
-
-void nouveauInitTriFuncs(GLcontext *ctx)
+void nv10TriInitFunctions(GLcontext *ctx)
{
struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Start = nv10RenderStart;
tnl->Driver.Render.Finish = nv10RenderFinish;
tnl->Driver.Render.PrimitiveNotify = nv10RenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = nouveauResetLineStipple;
+ tnl->Driver.Render.ResetLineStipple = nv10ResetLineStipple;
tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
tnl->Driver.Render.CopyPV = _tnl_copy_pv;
tnl->Driver.Render.Interp = _tnl_interp;
}
+