summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_pt_emit.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-05-08 22:13:21 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-05-08 22:15:00 +0100
commitb514f5f3ba4c9cf6c39cbcdf5bf0d2d8efb8d19b (patch)
tree1886ac244a69a5b3393b4f032b4b285b8e1cd753 /src/gallium/auxiliary/draw/draw_pt_emit.c
parentfec1d215f623221cb52f22c8f10e5de99ebc9cc2 (diff)
draw: only fill in / compare the part of the translate key we're using.
It's quite a big struct & we examine it a lot (too much). Reduce the impact of this by just looking at the active part where possible.
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pt_emit.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_emit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c
index f9ac16786e..671abc25ce 100644
--- a/src/gallium/auxiliary/draw/draw_pt_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_emit.c
@@ -49,6 +49,7 @@ void draw_pt_emit_prepare( struct pt_emit *emit,
const struct vertex_info *vinfo;
unsigned dst_offset;
struct translate_key hw_key;
+ unsigned keysize;
unsigned i;
boolean ok;
@@ -58,12 +59,10 @@ void draw_pt_emit_prepare( struct pt_emit *emit,
return;
}
- memset(&hw_key, 0, sizeof(hw_key));
-
/* Must do this after set_primitive() above:
*/
vinfo = draw->render->get_vertex_info(draw->render);
-
+ keysize = 2*4 + vinfo->num_attribs * sizeof(hw_key.element[0]);
/* Translate from pipeline vertices to hw vertices.
*/
@@ -122,8 +121,9 @@ void draw_pt_emit_prepare( struct pt_emit *emit,
hw_key.output_stride = vinfo->size * 4;
if (!emit->translate ||
- memcmp(&emit->translate->key, &hw_key, sizeof(hw_key)) != 0)
+ memcmp(&emit->translate->key, &hw_key, keysize) != 0)
{
+ memset((char *)&hw_key + keysize, 0, sizeof(hw_key) - keysize);
emit->translate = translate_cache_find(emit->cache, &hw_key);
}
}