[Mesa-dev] [PATCH] draw/so: uses the correct index with the pre clipped coordinates

Zack Rusin zackr at vmware.com
Wed Apr 17 19:28:49 PDT 2013


pre_clip_pos is a float[4] we just use (*float)[4] to be able to
jump within the array of vertex_headers with it. So if the idx
happened to be anything but 0, we'd actually read from some garbage
in memory. Always use 0 to correctly offset withing float[4].

Signed-off-by: Zack Rusin <zackr at vmware.com>
---
 src/gallium/auxiliary/draw/draw_pt_so_emit.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
index ae071a6..64831a8 100644
--- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
@@ -170,7 +170,7 @@ static void so_emit_prim(struct pt_so_emit *so,
                             draw->so.targets[ob]->internal_offset) + state->output[slot].dst_offset;
          
          if (idx == so->pos_idx && pcp_ptr)
-            memcpy(buffer, &pre_clip_pos[idx][start_comp], num_comps * sizeof(float));
+            memcpy(buffer, &pre_clip_pos[0][start_comp], num_comps * sizeof(float));
          else
             memcpy(buffer, &input[idx][start_comp], num_comps * sizeof(float));
       }
-- 
1.7.10.4



More information about the mesa-dev mailing list