still not working/not plugged in......
What i need to do about lack of
->new_state and ->current_primitive in ctx ?
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/5] 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/5] 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/5] 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/5] 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/5] 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
------------------------------------------------------------------------------
Download Intel® 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