if (nmesa->screen->card->type<NV_10) {
//nv04FinishPrimitive(nmesa);
} else {
- nv10FinishPrimitive(nmesa);
+ //nv10FinishPrimitive(nmesa);
}
_swsetup_Wakeup(ctx);
_swrast_flush( ctx );
if (nmesa->screen->card->type<NV_10) {
- //nv04TriInitFunctions(ctx);
+ nv04TriInitFunctions(ctx);
} else {
nv10TriInitFunctions(ctx);
}
#include "mtypes.h"
#include "colormac.h"
-static uint32_t nv04_compare_func(GLcontext *ctx,GLuint f)
+static uint32_t nv04_compare_func(GLuint f)
{
- switch ( ctx->Color.AlphaFunc ) {
+ switch ( f ) {
case GL_NEVER: return 1;
case GL_LESS: return 2;
case GL_EQUAL: return 3;
return 0;
}
-static uint32_t nv04_blend_func(GLcontext *ctx,GLuint f)
+static uint32_t nv04_blend_func(GLuint f)
{
- switch ( ctx->Color.AlphaFunc ) {
+ switch ( f ) {
case GL_ZERO: return 0x1;
case GL_ONE: return 0x2;
case GL_SRC_COLOR: return 0x3;
case GL_ONE_MINUS_DST_COLOR: return 0xA;
case GL_SRC_ALPHA_SATURATE: return 0xB;
}
- WARN_ONCE("Unable to find the function\n");
+ WARN_ONCE("Unable to find the function 0x%x\n",f);
return 0;
}
CLAMPED_FLOAT_TO_UBYTE(alpha_ref, ctx->Color.AlphaRef);
control=alpha_ref;
- control|=(nv04_compare_func(ctx,ctx->Color.AlphaFunc)<<8);
+ control|=(nv04_compare_func(ctx->Color.AlphaFunc)<<8);
control|=(ctx->Color.AlphaEnabled<<12);
control|=(1<<13);
control|=(ctx->Depth.Test<<14);
- control|=(nv04_compare_func(ctx,ctx->Depth.Func)<<16);
+ control|=(nv04_compare_func(ctx->Depth.Func)<<16);
if ((ctx->Polygon.CullFlag)&&(ctx->Polygon.CullFaceMode!=GL_FRONT_AND_BACK))
{
if ((ctx->Polygon.FrontFace==GL_CW)&&(ctx->Polygon.CullFaceMode==GL_FRONT))
blend|=(1<<8);
blend|=(ctx->Fog.Enabled<<16);
blend|=(ctx->Color.BlendEnabled<<20);
- blend|=(nv04_blend_func(ctx,ctx->Color.BlendSrcRGB)<<24);
- blend|=(nv04_blend_func(ctx,ctx->Color.BlendDstRGB)<<28);
+ blend|=(nv04_blend_func(ctx->Color.BlendSrcRGB)<<24);
+ blend|=(nv04_blend_func(ctx->Color.BlendDstRGB)<<28);
BEGIN_RING_CACHE(NvSub3D, NV04_DX5_TEXTURED_TRIANGLE_BLEND, 1);
OUT_RING_CACHE(blend);
/* FIXME pitches have to be aligned ! */
BEGIN_RING_SIZE(NvSubCtxSurf3D, NV04_CONTEXT_SURFACES_3D_PITCH, 2);
- OUT_RING(color[0]->pitch|(depth->pitch<<16));
+ OUT_RING(color[0]->pitch|(depth?(depth->pitch<<16):0));
OUT_RING(color[0]->offset);
if (depth) {
OUT_RING(0xFECEDC);
}
+static inline void nv04_render_points(GLcontext *ctx,GLuint first,GLuint last)
+{
+ WARN_ONCE("Unimplemented\n");
+}
+
+static inline void nv04_render_line(GLcontext *ctx,GLuint v1,GLuint v2)
+{
+ WARN_ONCE("Unimplemented\n");
+}
+
+static inline void nv04_render_triangle(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3)
+{
+ struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
+ GLubyte *vertptr = (GLubyte *)nmesa->verts;
+ GLuint vertsize = nmesa->vertex_size;
+
+ nv04_1triangle(nmesa,
+ (nouveauVertex*)(vertptr+v1*vertsize),
+ (nouveauVertex*)(vertptr+v2*vertsize),
+ (nouveauVertex*)(vertptr+v3*vertsize)
+ );
+}
+
+static inline void nv04_render_quad(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3,GLuint v4)
+{
+ struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
+ GLubyte *vertptr = (GLubyte *)nmesa->verts;
+ GLuint vertsize = nmesa->vertex_size;
+
+ nv04_1quad(nmesa,
+ (nouveauVertex*)(vertptr+v1*vertsize),
+ (nouveauVertex*)(vertptr+v2*vertsize),
+ (nouveauVertex*)(vertptr+v3*vertsize),
+ (nouveauVertex*)(vertptr+v4*vertsize)
+ );
+}
+
/**********************************************************************/
/* Render unclipped begin/end objects */
/**********************************************************************/
nmesa->vertex_attr_count++; \
} while (0)
+static void nv04_render_clipped_line(GLcontext *ctx,GLuint ii,GLuint jj)
+{
+}
+
+static void nv04_render_clipped_poly(GLcontext *ctx,const GLuint *elts,GLuint n)
+{
+}
static void nv04ChooseRenderState(GLcontext *ctx)
{
tnl->Driver.Render.PrimTabVerts = nv04_render_tab_verts;
tnl->Driver.Render.PrimTabElts = nv04_render_tab_elts;
- tnl->Driver.Render.ClippedLine = NULL;
- tnl->Driver.Render.ClippedPolygon = NULL;
+ tnl->Driver.Render.ClippedLine = nv04_render_clipped_line;
+ tnl->Driver.Render.ClippedPolygon = nv04_render_clipped_poly;
+ tnl->Driver.Render.Points = nv04_render_points;
+ tnl->Driver.Render.Line = nv04_render_line;
+ tnl->Driver.Render.Triangle = nv04_render_triangle;
+ tnl->Driver.Render.Quad = nv04_render_quad;
}
VB->Elts = tmp;
}
+static inline void nv10_render_points(GLcontext *ctx,GLuint first,GLuint last)
+{
+ WARN_ONCE("Unimplemented\n");
+}
+
+static inline void nv10_render_line(GLcontext *ctx,GLuint v1,GLuint v2)
+{
+ struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
+ GLubyte *vertptr = (GLubyte *)nmesa->verts;
+ GLuint vertsize = nmesa->vertex_size;
+ GLuint size_dword = vertsize*(2)/4;
+
+ nv10ExtendPrimitive(nmesa, size_dword);
+ nv10StartPrimitive(nmesa,GL_LINES+1,size_dword);
+ OUT_RINGp((nouveauVertex*)(vertptr+(v1*vertsize)),vertsize);
+ OUT_RINGp((nouveauVertex*)(vertptr+(v2*vertsize)),vertsize);
+ nv10FinishPrimitive(nmesa);
+}
+
+static inline void nv10_render_triangle(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3)
+{
+ struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
+ GLubyte *vertptr = (GLubyte *)nmesa->verts;
+ GLuint vertsize = nmesa->vertex_size;
+ GLuint size_dword = vertsize*(3)/4;
+
+ nv10ExtendPrimitive(nmesa, size_dword);
+ nv10StartPrimitive(nmesa,GL_TRIANGLES+1,size_dword);
+ OUT_RINGp((nouveauVertex*)(vertptr+(v1*vertsize)),vertsize);
+ OUT_RINGp((nouveauVertex*)(vertptr+(v2*vertsize)),vertsize);
+ OUT_RINGp((nouveauVertex*)(vertptr+(v3*vertsize)),vertsize);
+ nv10FinishPrimitive(nmesa);
+}
+
+static inline void nv10_render_quad(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3,GLuint v4)
+{
+ struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
+ GLubyte *vertptr = (GLubyte *)nmesa->verts;
+ GLuint vertsize = nmesa->vertex_size;
+ GLuint size_dword = vertsize*(4)/4;
+
+ nv10ExtendPrimitive(nmesa, size_dword);
+ nv10StartPrimitive(nmesa,GL_QUADS+1,size_dword);
+ OUT_RINGp((nouveauVertex*)(vertptr+(v1*vertsize)),vertsize);
+ OUT_RINGp((nouveauVertex*)(vertptr+(v2*vertsize)),vertsize);
+ OUT_RINGp((nouveauVertex*)(vertptr+(v3*vertsize)),vertsize);
+ OUT_RINGp((nouveauVertex*)(vertptr+(v4*vertsize)),vertsize);
+ nv10FinishPrimitive(nmesa);
+}
+
+
+
static void nv10ChooseRenderState(GLcontext *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.PrimTabElts = nv10_render_tab_elts;
tnl->Driver.Render.ClippedLine = nv10_render_clipped_line;
tnl->Driver.Render.ClippedPolygon = nv10_render_clipped_poly;
+ tnl->Driver.Render.Points = nv10_render_points;
+ tnl->Driver.Render.Line = nv10_render_line;
+ tnl->Driver.Render.Triangle = nv10_render_triangle;
+ tnl->Driver.Render.Quad = nv10_render_quad;
}