mesa: Branch 'master' - 3 commits

Patrice Mandin pmandin at kemper.freedesktop.org
Sat Jan 13 13:14:36 UTC 2007


 src/mesa/drivers/dri/nouveau/nouveau_context.h |    5 -
 src/mesa/drivers/dri/nouveau/nv10_state.c      |  119 +++++++++++--------------
 2 files changed, 61 insertions(+), 63 deletions(-)

New commits:
diff-tree fb5f359b93073d85f4cae05cd89ff1012fafeda6 (from 308ef2dc3208e9c274763726b541f28e2169324b)
Author: Patrice Mandin <patrice at manoir.racoon.city>
Date:   Sat Jan 13 14:14:19 2007 +0100

    nouveau: update nv10 state

diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c
index 162a5e2..d65eb94 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state.c
@@ -61,40 +61,42 @@ static void nv10BlendColor(GLcontext *ct
 
 static void nv10BlendEquationSeparate(GLcontext *ctx, GLenum modeRGB, GLenum modeA)
 {
-	nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
-	BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_BLEND_EQUATION, 1);
-	OUT_RING_CACHE((modeA<<16) | modeRGB);
+	/* Not for NV10 */
 }
 
 
 static void nv10BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB,
 		GLenum sfactorA, GLenum dfactorA)
 {
-	nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
-	BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC, 2);
-	OUT_RING_CACHE((sfactorA<<16) | sfactorRGB);
-	OUT_RING_CACHE((dfactorA<<16) | dfactorRGB);
+	/* Not for NV10 */
+}
+
+static void nv10Clear(GLcontext *ctx, GLbitfield mask)
+{
+	/* TODO */
 }
 
-/*
 static void nv10ClearColor(GLcontext *ctx, const GLfloat color[4])
 {
+	nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+	GLubyte c[4];
+	UNCLAMPED_FLOAT_TO_RGBA_CHAN(c,color);
+	nmesa->clear_color_value = PACK_COLOR_8888(c[3],c[0],c[1],c[2]);
 }
 
 static void nv10ClearDepth(GLcontext *ctx, GLclampd d)
 {
+	/* FIXME: check if 16 or 24/32 bits depth buffer */
+	nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+	nmesa->clear_value=((nmesa->clear_value&0x000000FF)|(((uint32_t)(d*0xFFFFFF))<<8));
 }
-*/
 
-/* we're don't support indexed buffers
-   void (*ClearIndex)(GLcontext *ctx, GLuint index)
- */
-
-/*
 static void nv10ClearStencil(GLcontext *ctx, GLint s)
 {
+	/* FIXME: not valid for 16 bits depth buffer (0 stencil bits) */
+	nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+	nmesa->clear_value=((nmesa->clear_value&0xFFFFFF00)|(s&0x000000FF));
 }
-*/
 
 static void nv10ClipPlane(GLcontext *ctx, GLenum plane, const GLfloat *equation)
 {
@@ -116,7 +118,7 @@ static void nv10ColorMask(GLcontext *ctx
 
 static void nv10ColorMaterial(GLcontext *ctx, GLenum face, GLenum mode)
 {
-	// TODO I need love
+	/* TODO I need love */
 }
 
 static void nv10CullFace(GLcontext *ctx, GLenum mode)
@@ -320,7 +322,7 @@ static void nv10Fogfv(GLcontext *ctx, GL
    
 static void nv10Hint(GLcontext *ctx, GLenum target, GLenum mode)
 {
-	// TODO I need love (fog and line_smooth hints)
+	/* TODO I need love (fog and line_smooth hints) */
 }
 
 // void (*IndexMask)(GLcontext *ctx, GLuint mask);
@@ -448,6 +450,7 @@ static void (*LightModelfv)(GLcontext *c
 
 static void nv10LineStipple(GLcontext *ctx, GLint factor, GLushort pattern )
 {
+	/* Not for NV10 */
 }
 
 static void nv10LineWidth(GLcontext *ctx, GLfloat width)
@@ -471,7 +474,6 @@ static void nv10PointParameterfv(GLconte
 	
 }
 
-/** Specify the diameter of rasterized points */
 static void nv10PointSize(GLcontext *ctx, GLfloat size)
 {
 	nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
@@ -479,7 +481,6 @@ static void nv10PointSize(GLcontext *ctx
 	OUT_RING_CACHE(((int) (size * 8.0)) & -4);
 }
 
-/** Select a polygon rasterization mode */
 static void nv10PolygonMode(GLcontext *ctx, GLenum face, GLenum mode)
 {
 	nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
@@ -495,9 +496,20 @@ static void nv10PolygonMode(GLcontext *c
 }
 
 /** Set the scale and units used to calculate depth values */
-void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
+static void nv10PolygonOffset(GLcontext *ctx, GLfloat factor, GLfloat units)
+{
+        nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+        BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FACTOR, 2);
+        OUT_RING_CACHEf(factor);
+        OUT_RING_CACHEf(units);
+}
+
 /** Set the polygon stippling pattern */
-void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
+static void nv10PolygonStipple(GLcontext *ctx, const GLubyte *mask )
+{
+	/* Not for NV10 */
+}
+
 /* Specifies the current buffer for reading */
 void (*ReadBuffer)( GLcontext *ctx, GLenum buffer );
 /** Set rasterization mode */
@@ -517,37 +529,21 @@ static void nv10ShadeModel(GLcontext *ct
 	OUT_RING_CACHE(mode);
 }
 
-/** OpenGL 2.0 two-sided StencilFunc */
 static void nv10StencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func,
 		GLint ref, GLuint mask)
 {
-	nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
-
-	BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_STENCIL_FUNC_FUNC, 3);
-	OUT_RING_CACHE(func);
-	OUT_RING_CACHE(ref);
-	OUT_RING_CACHE(mask);
+	/* Not for NV10 */
 }
 
-/** OpenGL 2.0 two-sided StencilMask */
 static void nv10StencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask)
 {
-	nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
-
-	BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_STENCIL_MASK, 1);
-	OUT_RING_CACHE(mask);
+	/* Not for NV10 */
 }
 
-/** OpenGL 2.0 two-sided StencilOp */
 static void nv10StencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail,
 		GLenum zfail, GLenum zpass)
 {
-	nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
-
-	BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_STENCIL_OP_FAIL, 1);
-	OUT_RING_CACHE(fail);
-	OUT_RING_CACHE(zfail);
-	OUT_RING_CACHE(zpass);
+	/* Not for NV10 */
 }
 
 /** Control the generation of texture coordinates */
@@ -560,7 +556,14 @@ void (*TexEnv)(GLcontext *ctx, GLenum ta
 void (*TexParameter)(GLcontext *ctx, GLenum target,
 		struct gl_texture_object *texObj,
 		GLenum pname, const GLfloat *params);
-void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
+
+static void nv10TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat)
+{
+        nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+        BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_TX_MATRIX(unit, 0), 16);
+        /*XXX: This SHOULD work.*/
+        OUT_RING_CACHEp(mat->m, 16);
+}
 
 /** Set the viewport */
 static void nv10Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
@@ -597,13 +600,12 @@ void nv10InitStateFuncs(GLcontext *ctx, 
 
 	func->AlphaFunc			= nv10AlphaFunc;
 	func->BlendColor		= nv10BlendColor;
-	func->BlendEquationSeparate	= nv10BlendEquationSeparate;
-	func->BlendFuncSeparate		= nv10BlendFuncSeparate;
-#if 0
+	func->BlendEquationSeparate	= nv10BlendEquationSeparate;	/* Not for NV10 */
+	func->BlendFuncSeparate		= nv10BlendFuncSeparate;	/* Not for NV10 */
+	func->Clear			= nv10Clear;
 	func->ClearColor		= nv10ClearColor;
 	func->ClearDepth		= nv10ClearDepth;
 	func->ClearStencil		= nv10ClearStencil;
-#endif
 	func->ClipPlane			= nv10ClipPlane;
 	func->ColorMask			= nv10ColorMask;
 	func->ColorMaterial		= nv10ColorMaterial;
@@ -617,32 +619,26 @@ void nv10InitStateFuncs(GLcontext *ctx, 
 	func->Hint			= nv10Hint;
 	func->Lightfv			= nv10Lightfv;
 /*	func->LightModelfv		= nv10LightModelfv; */
-	func->LineStipple		= nv10LineStipple;
+	func->LineStipple		= nv10LineStipple;		/* Not for NV10 */
 	func->LineWidth			= nv10LineWidth;
 	func->LogicOpcode		= nv10LogicOpcode;
 	func->PointParameterfv		= nv10PointParameterfv;
 	func->PointSize			= nv10PointSize;
 	func->PolygonMode		= nv10PolygonMode;
-#if 0
 	func->PolygonOffset		= nv10PolygonOffset;
-	func->PolygonStipple		= nv10PolygonStipple;
-	func->ReadBuffer		= nv10ReadBuffer;
-	func->RenderMode		= nv10RenderMode;
-#endif
+	func->PolygonStipple		= nv10PolygonStipple;		/* Not for NV10 */
+/*	func->ReadBuffer		= nv10ReadBuffer;*/
+/*	func->RenderMode		= nv10RenderMode;*/
 	func->Scissor			= nv10Scissor;
 	func->ShadeModel		= nv10ShadeModel;
-	func->StencilFuncSeparate	= nv10StencilFuncSeparate;
-	func->StencilMaskSeparate	= nv10StencilMaskSeparate;
-	func->StencilOpSeparate		= nv10StencilOpSeparate;
-#if 0
-	func->TexGen			= nv10TexGen;
-	func->TexParameter		= nv10TexParameter;
+	func->StencilFuncSeparate	= nv10StencilFuncSeparate;	/* Not for NV10 */
+	func->StencilMaskSeparate	= nv10StencilMaskSeparate;	/* Not for NV10 */
+	func->StencilOpSeparate		= nv10StencilOpSeparate;	/* Not for NV10 */
+/*	func->TexGen			= nv10TexGen;*/
+/*	func->TexParameter		= nv10TexParameter;*/
 	func->TextureMatrix		= nv10TextureMatrix;
-#endif
-	func->Viewport			= nv10Viewport;
 
 	nmesa->hw_func.InitCard		= nv10InitCard;
 	nmesa->hw_func.BindBuffers	= nv10BindBuffers;
 	nmesa->hw_func.WindowMoved	= nv10WindowMoved;
 }
-
diff-tree 308ef2dc3208e9c274763726b541f28e2169324b (from ca75853f9d9e7d131f25daeaa7c646894ab4807e)
Author: Patrice Mandin <patrice at manoir.racoon.city>
Date:   Sat Jan 13 13:56:18 2007 +0100

    nouveau: Add clear color for nv10

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h
index 134e2a4..c7bf387 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -119,7 +119,10 @@ typedef struct nouveau_context {
 	struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
 	GLuint vertex_attr_count;
 
-	/* Depth/stencil clear state */
+	/* Color buffer clear value */
+	uint32_t clear_color_value;
+
+	/* Depth/stencil clear value */
 	uint32_t clear_value;
 
 	/* Light state */
diff-tree ca75853f9d9e7d131f25daeaa7c646894ab4807e (from b55f1ec9af30ddc5fa44818f85518fffe4580dc6)
Author: Patrice Mandin <patrice at manoir.racoon.city>
Date:   Sat Jan 13 13:22:03 2007 +0100

    nv10 has alpha color mask

diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c
index c028be2..162a5e2 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state.c
@@ -106,13 +106,12 @@ static void nv10ClipPlane(GLcontext *ctx
 	OUT_RING_CACHEf(equation[3]);
 }
 
-/* Seems does not support alpha in color mask */
 static void nv10ColorMask(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
 		GLboolean bmask, GLboolean amask )
 {
 	nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
 	BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_COLOR_MASK, 1);
-	OUT_RING_CACHE(/*((amask && 0x01) << 24) |*/ ((rmask && 0x01) << 16) | ((gmask && 0x01)<< 8) | ((bmask && 0x01) << 0));
+	OUT_RING_CACHE(((amask && 0x01) << 24) | ((rmask && 0x01) << 16) | ((gmask && 0x01)<< 8) | ((bmask && 0x01) << 0));
 }
 
 static void nv10ColorMaterial(GLcontext *ctx, GLenum face, GLenum mode)



More information about the mesa-commit mailing list