diff options
author | Keith Whitwell <[email protected]> | 2009-04-30 10:59:19 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2009-05-08 14:57:26 +0100 |
commit | af09ba96e9e2d783fb0538a82513716c1c9aed3b (patch) | |
tree | 304db85234b17e1c4600af2f62686615fbcbbbc0 /src/gallium/auxiliary | |
parent | 482be01db02d3ea224e01c24c4d1638229d6a4dc (diff) |
gallium/draw: cope with unused vertex_elements
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt.h | 1 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt_fetch.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 6f3e1e0289b..8ef0ea8011f 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -187,6 +187,7 @@ struct pt_emit *draw_pt_emit_create( struct draw_context *draw ); struct pt_fetch; void draw_pt_fetch_prepare( struct pt_fetch *fetch, + unsigned vertex_input_count, unsigned vertex_size ); void draw_pt_fetch_run( struct pt_fetch *fetch, diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c index 505d32f2c32..65c3a34c347 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c @@ -26,6 +26,7 @@ **************************************************************************/ #include "util/u_memory.h" +#include "util/u_math.h" #include "draw/draw_context.h" #include "draw/draw_private.h" #include "draw/draw_vbuf.h" @@ -56,9 +57,11 @@ struct pt_fetch { * */ void draw_pt_fetch_prepare( struct pt_fetch *fetch, + unsigned vs_input_count, unsigned vertex_size ) { struct draw_context *draw = fetch->draw; + unsigned nr_inputs; unsigned i, nr = 0; unsigned dst_offset = 0; struct translate_key key; @@ -89,8 +92,11 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch, dst_offset += 4 * sizeof(float); } + assert( draw->pt.nr_vertex_elements >= vs_input_count ); - for (i = 0; i < draw->pt.nr_vertex_elements; i++) { + nr_inputs = MIN2( vs_input_count, draw->pt.nr_vertex_elements ); + + for (i = 0; i < nr_inputs; i++) { key.element[nr].input_format = draw->pt.vertex_element[i].src_format; key.element[nr].input_buffer = draw->pt.vertex_element[i].vertex_buffer_index; key.element[nr].input_offset = draw->pt.vertex_element[i].src_offset; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 11ac90fc563..df6c265b7ec 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -77,8 +77,8 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle, draw_pt_fetch_prepare( fpme->fetch, + vs->info.num_inputs, fpme->vertex_size ); - /* XXX: it's not really gl rasterization rules we care about here, * but gl vs dx9 clip spaces. */ |