From b514f5f3ba4c9cf6c39cbcdf5bf0d2d8efb8d19b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 8 May 2008 22:13:21 +0100 Subject: 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. --- src/gallium/auxiliary/draw/draw_pt_fetch.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/gallium/auxiliary/draw/draw_pt_fetch.c') diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c index 1f765b73ad..a5bebb4ca1 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c @@ -62,10 +62,11 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch, unsigned i, nr = 0; unsigned dst_offset = 0; struct translate_key key; + unsigned keysize; fetch->vertex_size = vertex_size; - - memset(&key, 0, sizeof(key)); + keysize = (2*4 + + (draw->pt.nr_vertex_elements + 1) * sizeof(key.element[0])); /* Always emit/leave space for a vertex header. * @@ -110,8 +111,9 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch, if (!fetch->translate || - memcmp(&fetch->translate->key, &key, sizeof(key)) != 0) + memcmp(&fetch->translate->key, &key, keysize) != 0) { + memset((char *)&key + keysize, 0, sizeof(key) - keysize); fetch->translate = translate_cache_find(fetch->cache, &key); { -- cgit v1.2.3