Brian,

On Monday, December 19, 2011 17:01:07 you wrote:
> I still don't get what the purpose of the special mapping of the last
> four/five elements is all about.  Can you explain that?

As far as I can see the last ones should not map to anything.
The map is used only in fixed function mode. And there these arrays should not 
show up as inputs to any fixed function shader. I think that the purpose of the 
previous mapping was just to fill in anything. The changes I did serve exactly 
this purpose.

But I agree that here should not be any mapping of these attributes in this 
mode. Attached is a small change that is probably a more clean solution to 
this mapping problem.

The change passes a quick r600g piglit test.

> Yeah, I see how the incorrect varying_inputs values was causing
> _NEW_ARRAY to get set, thus hiding the problem.  The solution looks
> correct, but I'm a little worried about performance, as is mentioned
> in the comment.
> 
> Marek, made that change back in March.  Maybe he can take a look at
> this too.
I cannot comment on this, since I do not see a performance regression on my 
use cases.
Marek?

Greetings

Mathias
From 67f3e817dfd6cc0e937e95c9fc8b671da9bf406c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mathias=20Fr=C3=B6hlich?= <mathias.froehl...@web.de>
Date: Mon, 19 Dec 2011 20:53:51 +0100
Subject: [PATCH] vbo: Set unused arrays in fixed function mode to invalid.

The vbo module uses index maps to map VBO arrays into VERT_ATTRIB*
arrays. The fixed function map contains some entries that are
basically unused and are curretly mapped to any array.
This change will explicitly map these unused arrays to an
invalid array index which is then filtered out.

Signed-off-by: Mathias Froehlich <mathias.froehl...@web.de>
---
 src/mesa/vbo/vbo_context.c   |    2 +-
 src/mesa/vbo/vbo_exec_draw.c |    2 ++
 src/mesa/vbo/vbo_save_draw.c |    2 ++
 3 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index b2e6bbc..2542c5d 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -185,7 +185,7 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx )
 	 vbo->map_vp_none[VERT_ATTRIB_GENERIC(i)]
             = VBO_ATTRIB_MAT_FRONT_AMBIENT + i;
       for (i = NR_MAT_ATTRIBS; i < VERT_ATTRIB_GENERIC_MAX; i++)
-	 vbo->map_vp_none[VERT_ATTRIB_GENERIC(i)] = i;
+	 vbo->map_vp_none[VERT_ATTRIB_GENERIC(i)] = ~((GLuint)0);
       
       for (i = 0; i < Elements(vbo->map_vp_arb); i++)
 	 vbo->map_vp_arb[i] = i;
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index dd5363b..ac3ada3 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -218,6 +218,8 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
     */
    for (attr = 0; attr < VERT_ATTRIB_MAX ; attr++) {
       const GLuint src = map[attr];
+      if (VBO_ATTRIB_MAX <= src)
+         continue;
 
       if (exec->vtx.attrsz[src]) {
 	 GLsizeiptr offset = (GLbyte *)exec->vtx.attrptr[src] -
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index fa93ca4..8e84c2e 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -185,6 +185,8 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
 
    for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
       const GLuint src = map[attr];
+      if (VBO_ATTRIB_MAX <= src)
+         continue;
 
       if (node_attrsz[src]) {
          /* override the default array set above */
-- 
1.7.4.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to