mesa: Branch 'master'

Stephane Marchesin marcheu at kemper.freedesktop.org
Sun Feb 4 02:16:21 UTC 2007


 src/mesa/drivers/dri/nouveau/nouveau_swtcl.c |    4 -
 src/mesa/drivers/dri/nouveau/nv04_state.c    |   20 ++++-----
 src/mesa/drivers/dri/nouveau/nv04_swtcl.c    |   52 ++++++++++++++++++++++++-
 src/mesa/drivers/dri/nouveau/nv10_swtcl.c    |   56 +++++++++++++++++++++++++++
 4 files changed, 118 insertions(+), 14 deletions(-)

New commits:
diff-tree 63568745863a54308fecc32dbb96397c35b22496 (from f8ec7f1398e600f4ed2ff3d0fb8d77d706f0fc18)
Author: Stephane Marchesin <marchesin at icps.u-strasbg.fr>
Date:   Sun Feb 4 03:17:06 2007 +0100

    nouveau: fix nv04 and nv10 swtcl, more work on nv04 state.

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_swtcl.c b/src/mesa/drivers/dri/nouveau/nouveau_swtcl.c
index f5c92a1..8a013bd 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_swtcl.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_swtcl.c
@@ -84,7 +84,7 @@ void nouveauFallback(struct nouveau_cont
 			if (nmesa->screen->card->type<NV_10) {
 				//nv04FinishPrimitive(nmesa);
 			} else {
-				nv10FinishPrimitive(nmesa);
+				//nv10FinishPrimitive(nmesa);
 			}
 
 			_swsetup_Wakeup(ctx);
@@ -97,7 +97,7 @@ void nouveauFallback(struct nouveau_cont
 			_swrast_flush( ctx );
 
 			if (nmesa->screen->card->type<NV_10) {
-				//nv04TriInitFunctions(ctx);
+				nv04TriInitFunctions(ctx);
 			} else {
 				nv10TriInitFunctions(ctx);
 			}
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state.c b/src/mesa/drivers/dri/nouveau/nv04_state.c
index ec4cd40..4129ecc 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state.c
@@ -35,9 +35,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #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;
@@ -51,9 +51,9 @@ static uint32_t nv04_compare_func(GLcont
 	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;
@@ -66,7 +66,7 @@ static uint32_t nv04_blend_func(GLcontex
 		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;
 }
 
@@ -78,11 +78,11 @@ static void nv04_emit_control(GLcontext 
 
 	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))
@@ -126,8 +126,8 @@ static void nv04_emit_blend(GLcontext *c
 		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);
@@ -463,7 +463,7 @@ static GLboolean nv04BindBuffers(nouveau
 
 	/* 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) {
diff --git a/src/mesa/drivers/dri/nouveau/nv04_swtcl.c b/src/mesa/drivers/dri/nouveau/nv04_swtcl.c
index f31c0d6..9b5332b 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_swtcl.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_swtcl.c
@@ -84,6 +84,43 @@ static inline void nv04_1quad(struct nou
 	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                   */
 /**********************************************************************/
@@ -404,6 +441,13 @@ do {									\
    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)
 {
@@ -411,8 +455,12 @@ static void nv04ChooseRenderState(GLcont
 
 	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;
 }
 
 
diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c
index c9bfac8..9891b36 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c
@@ -303,6 +303,58 @@ static void nv10_render_clipped_poly(GLc
 	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);
@@ -312,6 +364,10 @@ static void nv10ChooseRenderState(GLcont
 	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;
 }
 
 



More information about the mesa-commit mailing list