summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_pt_fetch.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-04-30 10:59:19 +0100
committerKeith Whitwell <keithw@vmware.com>2009-05-05 13:14:46 +0100
commitc6b3c2f34b5fdc30e679068d4e6130ba30efc1e4 (patch)
treee22ed2ed73656db55be436a5c5a878a5ba8fb8b8 /src/gallium/auxiliary/draw/draw_pt_fetch.c
parent4d548bd069220677b12630cbab6f8c228e3d3a6b (diff)
gallium/draw: cope with unused vertex_elements
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pt_fetch.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c
index 505d32f2c3..65c3a34c34 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;