It segfaults right after start .... 

#0  0x00000000 in ?? ()
No symbol table info available.
#1  0xb701b037 in _tnl_render_quad_strip_verts (ctx=0x88dba88, start=0, 
    count=42, flags=56) at tnl/t_vb_rendertmp.h:431
        j = 3
        tnl = <value optimized out>
        QuadFunc = (const tnl_quad_func) 0
        stipple = 0 '\0'
#2  0xb701c2cd in run_render (ctx=0x88dba88, stage=0x892edd8)
    at tnl/t_vb_render.c:320
        prim = <value optimized out>
        start = 0
        length = <value optimized out>
        i = 0
        tnl = (TNLcontext *) 0x892ebc8
        tab = (tnl_render_func *) 0xb71821a0
        pass = 0
        __PRETTY_FUNCTION__ = "run_render"
#3  0xb7010467 in _tnl_run_pipeline (ctx=0x88dba88) at tnl/t_pipeline.c:153
        tnl = (TNLcontext *) 0x892ec88
        __tmp = 895
        i = 8
#4  0xb701133e in _tnl_draw_prims (ctx=0x88dba88, arrays=0x891ce94, 
    prim=0x891b968, nr_prims=2, ib=0x0, min_index=0, max_index=83)
    at tnl/t_draw.c:478
        this_nr_prims = <value optimized out>
        bo = {0xb7180bb4, 0x88dba88, 0x30, 0xbf9e0928, 0xb6f73ddc, 0x80000000, 
  0x1, 0x8c28218, 0xb6f700de, 0x8c1afd8, 0x0, 0x2, 0x40, 0x88dba88, 0x88f2718, 
  0xbf9e0968, 0xb6f701f7, 0x88dba88, 0x400000, 0xbf9e0968, 0xb6f7017e, 
  0x88dba88, 0x400000, 0xb769b50c, 0xb717fa80, 0xb769b65c, 0x88d0544, 
  0x60121df, 0xb7180bb4, 0x88dba88, 0x0, 0xbf9e09c8, 0xb6fdf83e}
        nr_bo = 0
        max_basevertex = <value optimized out>
        i = <value optimized out>
        __PRETTY_FUNCTION__ = "_tnl_draw_prims"
#5  0xb70116a9 in _tnl_vbo_draw_prims (ctx=0x88dba88, arrays=0x891ce94, 
    prim=0x891b968, nr_prims=2, ib=0x0, index_bounds_valid=1 '\001', 
    min_index=0, max_index=83) at tnl/t_draw.c:384
No locals.
#6  0xb7007913 in vbo_exec_vtx_flush (exec=0x891b838, unmap=1 '\001')
    at vbo/vbo_exec_draw.c:384
        ctx = (GLcontext *) 0x88dba88
#7  0xb70050ee in vbo_exec_FlushVertices_internal (ctx=0x88dba88, 
    unmap=136 '\210') at vbo/vbo_exec_api.c:872
        exec = (struct vbo_exec_context *) 0x891b838
#8  0xb700518b in vbo_exec_FlushVertices (ctx=0x88dba88, flags=1)
    at vbo/vbo_exec_api.c:906
No locals.
#9  0xb6fd49bc in _mesa_PopMatrix () at main/matrix.c:285
        stack = (struct gl_matrix_stack *) 0x88dbfb4
#10 0x08049d89 in DrawCrankshaft (eng=0x8073f60) at engine.c:511
        phiStep = 120
        phi = -90
        i = 0
        z = 0.400000006
#11 0x0804b4b7 in Draw () at engine.c:528
        rot = {{0.457617939, -0.388804674, 0.799635649, 0}, {-0.00557587016, 
    0.898054183, 0.439849645, 0}, {-0.889131725, -0.205741853, 0.408797771, 
    0}, {0, 0, 0, 1}}
#12 0xb771a537 in processWindowWorkList (window=0x88c9ba8) at 
glut_event.c:1307
        workMask = 4
        __PRETTY_FUNCTION__ = "processWindowWorkList"
#13 0xb771b519 in glutMainLoop () at glut_event.c:1358
No locals.
#14 0x0804ae39 in main (argc=1, argv=0xbf9e0f54) at engine.c:1340
No locals.
From 50c585a409efdce367aabffa6192bd98d4e9da28 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <rand...@mail.ru>
Date: Thu, 4 Mar 2010 17:54:20 +0000
Subject: [PATCH 1/6] Add WAR_ONCE macro locally, begin implementing rendering more than one primitive per call  (port from Marcheu's code)

---
 src/mesa/drivers/dri/nouveau/nv04_render.c |   46 ++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c b/src/mesa/drivers/dri/nouveau/nv04_render.c
index b5943d9..46234f3 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_render.c
@@ -23,6 +23,19 @@
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  */
+ 
+#define WARN_ONCE(a, ...) do {\
+ static int warn##__LINE__=1;\
+ if(warn##__LINE__){\
+ fprintf(stderr, "*********************************WARN_ONCE*********************************\n");\
+ fprintf(stderr, "File %s function %s line %d\n", __FILE__, __FUNCTION__, __LINE__);\
+ fprintf(stderr, a, ## __VA_ARGS__);\
+ fprintf(stderr, "***************************************************************************\n");\
+ warn##__LINE__=0;\
+ } \
+ }while(0)
+
+// #include "tnl_dd/t_dd_tritmp.h"
 
 #include "nouveau_driver.h"
 #include "nouveau_context.h"
@@ -148,14 +161,31 @@ swtnl_reset_stipple(GLcontext *ctx)
 static void
 swtnl_points(GLcontext *ctx, GLuint first, GLuint last)
 {
+WARN_ONCE("points rendering - Unimplemented\n");
 }
 
 static void
 swtnl_line(GLcontext *ctx, GLuint v1, GLuint v2)
 {
+WARN_ONCE("line rendering - Unimplemented\n");
 }
 
 static void
+swtnl_2triangles(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4, GLuint v5, GLuint v6)
+{
+	BEGIN_PRIMITIVE(6);
+	OUT_VERTEX(v1);
+	OUT_VERTEX(v2);
+	OUT_VERTEX(v3);
+	OUT_VERTEX(v4);
+	OUT_VERTEX(v5);
+	OUT_VERTEX(v6);
+	END_PRIMITIVE(0xFEDCBA);
+}
+
+
+
+static void
 swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3)
 {
 	BEGIN_PRIMITIVE(3);
@@ -176,6 +206,22 @@ swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4)
 	END_PRIMITIVE(0x320210);
 }
 
+static void
+swtnl_render_triangles_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+	int i;
+	for(i=start;i<count-5;i+=6)
+		 swtnl_2triangles(ctx, i+0, i+1, i+2, i+3, i+4, i+5);
+	if (i!=count)
+	{
+		swtnl_triangle(ctx, i+0,i+1,i+2);
+		i+=3;
+	}
+	
+	if (i!=count)
+		printf("oops\n");
+}
+
 /* TnL initialization. */
 void
 nv04_render_init(GLcontext *ctx)
-- 
1.6.5.4

From e2d04b310d52f6b83b17bf17d41a8217f028d582 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <rand...@mail.ru>
Date: Fri, 5 Mar 2010 00:33:42 +0000
Subject: [PATCH 2/6] Another not plugged rendering function: swtnl_render_tri_strip_verts

---
 src/mesa/drivers/dri/nouveau/nv04_render.c |   42 ++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c b/src/mesa/drivers/dri/nouveau/nv04_render.c
index 46234f3..86928a6 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_render.c
@@ -128,6 +128,7 @@ swtnl_reset_stipple(GLcontext *ctx)
 {
 }
 
+#define NONINC_METHOD 0x40000000
 /* Primitive rendering */
 
 #define BEGIN_PRIMITIVE(n)						\
@@ -158,6 +159,20 @@ swtnl_reset_stipple(GLcontext *ctx)
 		OUT_RING(chan, draw);					\
 	}
 
+
+#define END_PRIMITIVE_N(draw)						\
+	if (nv04_mtex_engine(fahrenheit)) {				\
+		BEGIN_RING(chan, fahrenheit,				\
+			   NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE(0) |NONINC_METHOD, 1); \
+		OUT_RING(chan, draw);					\
+	} else {							\
+		BEGIN_RING(chan, fahrenheit,				\
+			   NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE(0) |NONINC_METHOD , 1); \
+		OUT_RING(chan, draw);					\
+	}
+
+
+
 static void
 swtnl_points(GLcontext *ctx, GLuint first, GLuint last)
 {
@@ -222,6 +237,33 @@ swtnl_render_triangles_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint fla
 		printf("oops\n");
 }
 
+static void 
+swtnl_render_tri_strip_verts(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
+{
+	struct nouveau_channel *chan = context_chan(ctx);
+	uint32_t striptbl[]={0x321210,0x543432,0x765654,0x987876,0xBA9A98,0xDCBCBA,0xFEDEDC};
+	int i,j;
+	
+	for(i=start;i<count;i+=14)
+		{
+		int numvert=MIN2(16,count-i);
+		int numtri=numvert-2;
+			if (numvert<3)
+			break;
+
+		BEGIN_PRIMITIVE(numvert);
+		 for(j=0;j<numvert;j++)
+		 OUT_VERTEX(i+j);
+		 END_PRIMITIVE_N((numtri+1)/2);
+
+		 for(j=0;j<numtri/2;j++)
+		 OUT_RING(chan, striptbl[j]);
+		 if (numtri%2)
+		 OUT_RING(chan, striptbl[numtri/2]&0xFFF);
+ }
+}
+
+
 /* TnL initialization. */
 void
 nv04_render_init(GLcontext *ctx)
-- 
1.6.5.4

From d887ea841900b55275481f40918f64cd4ffcc89a Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <rand...@mail.ru>
Date: Fri, 5 Mar 2010 02:00:12 +0000
Subject: [PATCH 3/6] Populate swtnl_render_tab_verts

---
 src/mesa/drivers/dri/nouveau/nv04_render.c |  120 +++++++++++++++++++++++++++-
 1 files changed, 119 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c b/src/mesa/drivers/dri/nouveau/nv04_render.c
index 86928a6..2878c29 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_render.c
@@ -144,6 +144,21 @@ swtnl_reset_stipple(GLcontext *ctx)
 		BEGIN_RING(chan, fahrenheit,				\
 			   NV04_TEXTURED_TRIANGLE_TLVERTEX_SX(0),	\
 			   n * vertex_len);				\
+			
+			
+#define BEGIN_PRIMITIVE_F(n)						\
+	struct nouveau_channel *chan = context_chan(ctx);		\
+	struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx);	\
+	int vertex_len = TNL_CONTEXT(ctx)->clipspace.vertex_size / 4;	\
+									\
+	if (nv04_mtex_engine(fahrenheit))				\
+		BEGIN_RING(chan, fahrenheit,				\
+			   NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SX(0x1),	\
+			   n * vertex_len);				\
+	else								\
+		BEGIN_RING(chan, fahrenheit,				\
+			   NV04_TEXTURED_TRIANGLE_TLVERTEX_SX(0x1),	\
+			   n * vertex_len);				\
 
 #define OUT_VERTEX(i)						\
 	OUT_RINGp(chan, _tnl_get_vertex(ctx, i), vertex_len);
@@ -221,6 +236,26 @@ swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4)
 	END_PRIMITIVE(0x320210);
 }
 
+static void swtnl_render_points_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+ // erm - said Stephane Marchesin
+}
+
+static void swtnl_render_lines_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+ // umm - said Stephane Marchesin
+}
+
+static void swtnl_render_line_strip_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+ // yeah - said Stephane Marchesin
+}
+
+static void swtnl_render_line_loop_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+ // right - finally said Stephane Marchesin
+}
+
 static void
 swtnl_render_triangles_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
 {
@@ -260,9 +295,92 @@ swtnl_render_tri_strip_verts(GLcontext *ctx, GLuint start, GLuint count, GLuint
 		 OUT_RING(chan, striptbl[j]);
 		 if (numtri%2)
 		 OUT_RING(chan, striptbl[numtri/2]&0xFFF);
- }
+		}
+}
+
+static void
+swtnl_render_tri_fan_verts(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
+{
+	uint32_t fantbl[]={0x320210,0x540430,0x760650,0x980870,0xBA0A90,0xDC0CB0,0xFE0ED0};
+	int i,j;
+	
+	BEGIN_PRIMITIVE(start);
+	OUT_VERTEX(start);
+	
+	for(i=start+1;i<count;i+=14)
+	{
+		int numvert=MIN2(15,count-i);
+		int numtri=numvert-1;
+			if (numvert<3)
+			break;
+
+		BEGIN_PRIMITIVE_F(numvert);
+
+		for(j=0;j<numvert;j++)
+		OUT_VERTEX(i+j);
+		END_PRIMITIVE_N((numtri+1)/2);
+		
+		for(j=0;j<numtri/2;j++)
+		OUT_RING(chan, fantbl[j]);
+		if (numtri%2)
+		OUT_RING(chan, fantbl[numtri/2]&0xFFF);
+	}
+
+}
+
+static void swtnl_render_quads_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+
+	int i;
+
+	for(i=start;i<count;i+=4)
+	swtnl_quad(ctx, i+0, i+1, i+2, i+3);
+
 }
 
+static void swtnl_render_noop_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+}
+
+static void (*swtnl_render_tab_verts[GL_POLYGON+2])(GLcontext *,  GLuint,  GLuint,  GLuint) =
+{
+ swtnl_render_points_verts,
+ swtnl_render_lines_verts,
+ swtnl_render_line_loop_verts,
+ swtnl_render_line_strip_verts,
+ swtnl_render_triangles_verts,
+ swtnl_render_tri_strip_verts,
+ swtnl_render_tri_fan_verts,
+ swtnl_render_quads_verts,
+ swtnl_render_tri_strip_verts, //nv04_render_quad_strip_verts
+ swtnl_render_tri_fan_verts, //nv04_render_poly_verts
+ swtnl_render_noop_verts,
+};
+
+
+static void nv04_render_points_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+ // erm
+}
+
+static void nv04_render_lines_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+ // umm
+}
+
+static void nv04_render_line_strip_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+ // yeah
+}
+
+static void nv04_render_line_loop_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+ // right
+}
+
+
+
+
 
 /* TnL initialization. */
 void
-- 
1.6.5.4

From 8016895fddb6b25a18a60ea951e337a47b946cb2 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <rand...@mail.ru>
Date: Fri, 5 Mar 2010 02:26:04 +0000
Subject: [PATCH 4/6] Populate swtnl_render_tab_elts

---
 src/mesa/drivers/dri/nouveau/nv04_render.c |  112 +++++++++++++++++++++++++++-
 1 files changed, 108 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c b/src/mesa/drivers/dri/nouveau/nv04_render.c
index 2878c29..db09fba 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_render.c
@@ -358,28 +358,132 @@ static void (*swtnl_render_tab_verts[GL_POLYGON+2])(GLcontext *,  GLuint,  GLuin
 };
 
 
-static void nv04_render_points_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+static void swtnl_render_points_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
 {
  // erm
 }
 
-static void nv04_render_lines_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+static void swtnl_render_lines_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
 {
  // umm
 }
 
-static void nv04_render_line_strip_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+static void swtnl_render_line_strip_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
 {
  // yeah
 }
 
-static void nv04_render_line_loop_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+static void swtnl_render_line_loop_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
 {
  // right
 }
 
 
+static void swtnl_render_noop_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+}
+
+static void
+swtnl_render_triangles_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+	int i;
+	const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts;
+	
+	for(i=start;i<count-5;i+=6)
+		 swtnl_2triangles(ctx, elt[i+0], elt[i+1], elt[i+2], elt[i+3], elt[i+4], elt[i+5]);
+	if (i!=count)
+	{
+		swtnl_triangle(ctx, elt[i+0], elt[i+1], elt[i+2]);
+		i+=3;
+	}
+	
+	if (i!=count)
+		printf("oops\n");
+}
+
+static void 
+swtnl_render_tri_strip_elts(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
+{
+	struct nouveau_channel *chan = context_chan(ctx);
+	uint32_t striptbl[]={0x321210,0x543432,0x765654,0x987876,0xBA9A98,0xDCBCBA,0xFEDEDC};
+	int i,j;
+	const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts;
+	
+	for(i=start;i<count;i+=14)
+		{
+		int numvert=MIN2(16,count-i);
+		int numtri=numvert-2;
+			if (numvert<3)
+			break;
+
+		BEGIN_PRIMITIVE(numvert);
+		 for(j=0;j<numvert;j++)
+		 OUT_VERTEX(elt[i+j]);
+		 END_PRIMITIVE_N((numtri+1)/2);
+
+		 for(j=0;j<numtri/2;j++)
+		 OUT_RING(chan, striptbl[j]);
+		 if (numtri%2)
+		 OUT_RING(chan, striptbl[numtri/2]&0xFFF);
+		}
+}
+
+static void
+swtnl_render_tri_fan_elts(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
+{
+	uint32_t fantbl[]={0x320210,0x540430,0x760650,0x980870,0xBA0A90,0xDC0CB0,0xFE0ED0};
+	int i,j;
+	const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts;
+	
+	BEGIN_PRIMITIVE(start);
+	OUT_VERTEX(start);
+	
+	for(i=start+1;i<count;i+=14)
+	{
+		int numvert=MIN2(15,count-i);
+		int numtri=numvert-1;
+			if (numvert<3)
+			break;
+
+		BEGIN_PRIMITIVE_F(numvert);
 
+		for(j=0;j<numvert;j++)
+		OUT_VERTEX(elt[i+j]);
+		END_PRIMITIVE_N((numtri+1)/2);
+		
+		for(j=0;j<numtri/2;j++)
+		OUT_RING(chan, fantbl[j]);
+		if (numtri%2)
+		OUT_RING(chan, fantbl[numtri/2]&0xFFF);
+	}
+
+}
+
+static void swtnl_render_quads_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
+{
+
+	int i;
+	const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts;
+
+	for(i=start;i<count;i+=4)
+	swtnl_quad(ctx, elt[i+0], elt[i+1], elt[i+2], elt[i+3]);
+
+}
+
+static void (*swtnl_render_tab_elts[GL_POLYGON+2])(GLcontext *, GLuint, GLuint, GLuint) =
+{
+ swtnl_render_points_elts,
+ swtnl_render_lines_elts,
+ swtnl_render_line_loop_elts,
+ swtnl_render_line_strip_elts,
+ swtnl_render_triangles_elts,
+ swtnl_render_tri_strip_elts,
+ swtnl_render_tri_fan_elts,
+ swtnl_render_quads_elts,
+ swtnl_render_tri_strip_elts, // nv04_render_quad_strip_elts,
+ swtnl_render_tri_fan_elts, // nv04_render_poly_elts,
+ swtnl_render_noop_elts,
+};
 
 
 /* TnL initialization. */
-- 
1.6.5.4

From 1581b9cdcce20a67413a3d101ed026e3a79d44de Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <rand...@mail.ru>
Date: Fri, 5 Mar 2010 02:33:16 +0000
Subject: [PATCH 5/6] create swtnlRenderPrimitive

---
 src/mesa/drivers/dri/nouveau/nv04_render.c |   35 ++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c b/src/mesa/drivers/dri/nouveau/nv04_render.c
index db09fba..0129822 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_render.c
@@ -485,6 +485,41 @@ static void (*swtnl_render_tab_elts[GL_POLYGON+2])(GLcontext *, GLuint, GLuint,
  swtnl_render_noop_elts,
 };
 
+static const GLuint hw_prim[GL_POLYGON+1] = {
+ GL_POINTS+1,
+ GL_LINES+1,
+ GL_LINE_STRIP+1,
+ GL_LINE_LOOP+1,
+ GL_TRIANGLES+1,
+ GL_TRIANGLE_STRIP+1,
+ GL_TRIANGLE_FAN+1,
+ GL_QUADS+1,
+ GL_QUAD_STRIP+1,
+ GL_POLYGON+1
+};
+
+void swtnlRasterPrimitive(GLcontext *ctx,
+ GLenum glprim,
+ GLuint hwprim)
+{
+
+#if 0
+ struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
+
+ assert (!nmesa->new_state);
+
+ if (hwprim != nmesa->current_primitive)
+ {
+ nmesa->current_primitive=hwprim;
+ }
+ 
+#endif
+}
+
+static void nv04RenderPrimitive( GLcontext *ctx, GLuint prim )
+{
+ swtnlRasterPrimitive( ctx, prim, hw_prim[prim] );
+}
 
 /* TnL initialization. */
 void
-- 
1.6.5.4

From f6683881de9b26a9ecfbce11aec67cacb6a503d9 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <rand...@mail.ru>
Date: Fri, 5 Mar 2010 19:18:47 +0000
Subject: [PATCH 6/6] Segfault :(

---
 src/mesa/drivers/dri/nouveau/nv04_context.h |    3 +
 src/mesa/drivers/dri/nouveau/nv04_render.c  |   72 ++++++++++++++++++++++----
 2 files changed, 64 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.h b/src/mesa/drivers/dri/nouveau/nv04_context.h
index ccd3b61..ee0b2ba 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.h
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.h
@@ -34,6 +34,9 @@ struct nv04_context {
 	struct nouveau_grobj *eng3d;
 	struct nouveau_surface dummy_texture;
 	float viewport[16];
+	GLuint new_state;
+	GLenum current_primitive;
+	GLuint new_render_state;
 };
 #define to_nv04_context(ctx) ((struct nv04_context *)(ctx))
 
diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c b/src/mesa/drivers/dri/nouveau/nv04_render.c
index 0129822..d12bb81 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_render.c
@@ -236,6 +236,20 @@ swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4)
 	END_PRIMITIVE(0x320210);
 }
 
+static void swtnl_render_triangle(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3)
+{
+ 
+ swtnl_triangle( ctx , v1, v2, v3);
+ 
+}
+
+static void swtnl_render_quad(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3,GLuint v4)
+{
+ 
+
+ swtnl_quad( ctx, v1,v2,v3,v4);
+}
+
 static void swtnl_render_points_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags)
 {
  // erm - said Stephane Marchesin
@@ -498,25 +512,61 @@ static const GLuint hw_prim[GL_POLYGON+1] = {
  GL_POLYGON+1
 };
 
+static void swtnlChooseRenderState(GLcontext *ctx)
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+
+ tnl->Driver.Render.PrimTabVerts = swtnl_render_tab_verts;
+ tnl->Driver.Render.PrimTabElts = swtnl_render_tab_elts;
+/* tnl->Driver.Render.ClippedLine = swtnl_render_clipped_line;
+ tnl->Driver.Render.ClippedPolygon = swtnl_render_clipped_poly; */
+ tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
+ tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
+ tnl->Driver.Render.Points = swtnl_points;
+ tnl->Driver.Render.Line = swtnl_line;
+ tnl->Driver.Render.Triangle = swtnl_render_triangle;
+ tnl->Driver.Render.Quad = swtnl_render_quad;
+}
+
+static void swtnlRenderStart(GLcontext *ctx)
+{
+ struct nv04_context *nctx = to_nv04_context(ctx);
+
+ if (nctx->new_state) {
+ nctx->new_render_state |= nctx->new_state;
+ }
+
+ if (nctx->new_render_state) {
+ // swtnlChooseVertexState(ctx);
+ swtnlChooseRenderState(ctx);
+ nctx->new_render_state = 0;
+ }
+}
+
+static void swtnlRenderFinish(GLcontext *ctx)
+{
+}
+
 void swtnlRasterPrimitive(GLcontext *ctx,
  GLenum glprim,
  GLuint hwprim)
 {
 
-#if 0
- struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
+#if 1
+ // struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
+ struct nv04_context *nctx = to_nv04_context(ctx);
 
- assert (!nmesa->new_state);
+ assert (!nctx->new_state);
 
- if (hwprim != nmesa->current_primitive)
+ if (hwprim != nctx->current_primitive)
  {
- nmesa->current_primitive=hwprim;
+ nctx->current_primitive=hwprim;
  }
  
 #endif
 }
 
-static void nv04RenderPrimitive( GLcontext *ctx, GLuint prim )
+static void swtnlRenderPrimitive( GLcontext *ctx, GLuint prim )
 {
  swtnlRasterPrimitive( ctx, prim, hw_prim[prim] );
 }
@@ -534,16 +584,16 @@ nv04_render_init(GLcontext *ctx)
 	tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
 	tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
 
-	tnl->Driver.Render.Start = swtnl_start;
-	tnl->Driver.Render.Finish = swtnl_finish;
-	tnl->Driver.Render.PrimitiveNotify = swtnl_primitive;
+	tnl->Driver.Render.Start = swtnlRenderStart; // was swtnl_start
+	tnl->Driver.Render.Finish = swtnlRenderFinish; // was swtnl_finish
+	tnl->Driver.Render.PrimitiveNotify = swtnlRenderPrimitive; /* swtnl_primitive  */
 	tnl->Driver.Render.ResetLineStipple = swtnl_reset_stipple;
-
+/*
 	tnl->Driver.Render.Points = swtnl_points;
 	tnl->Driver.Render.Line = swtnl_line;
 	tnl->Driver.Render.Triangle = swtnl_triangle;
 	tnl->Driver.Render.Quad = swtnl_quad;
-
+*/
 	_tnl_need_projected_coords(ctx, GL_TRUE);
 	_tnl_init_vertices(ctx, tnl->vb.Size,
 			   NUM_VERTEX_ATTRS * 4 * sizeof(GLfloat));
-- 
1.6.5.4

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to