summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2008-03-23 18:21:00 +0000
committerKeith Whitwell <[email protected]>2008-03-23 18:21:00 +0000
commit301b187ca9a811b608894d20bab934af0a10b8ab (patch)
treea2721ffcfcfcd79e2e69515c369b252b16d9ae15 /src/gallium
parentf40357e25c0520ef1d64ffab03501da4c8b93529 (diff)
draw: fix some unsigned vs ushort confusion
Middle-end elements are ushort, but prior to that have to treat all elements as unsigned to avoid wrapping and/or overruns.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_elts.c8
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache.c9
3 files changed, 9 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h
index 1b81d196f62..f56fa8d5ccd 100644
--- a/src/gallium/auxiliary/draw/draw_pt.h
+++ b/src/gallium/auxiliary/draw/draw_pt.h
@@ -35,7 +35,7 @@
#include "pipe/p_compiler.h"
-typedef ushort (*pt_elt_func)( const void *elts, ushort idx );
+typedef unsigned (*pt_elt_func)( const void *elts, unsigned idx );
/* The "front end" - prepare sets of fetch, draw elements for the
diff --git a/src/gallium/auxiliary/draw/draw_pt_elts.c b/src/gallium/auxiliary/draw/draw_pt_elts.c
index 585b83fa903..f337f71ea0e 100644
--- a/src/gallium/auxiliary/draw/draw_pt_elts.c
+++ b/src/gallium/auxiliary/draw/draw_pt_elts.c
@@ -37,22 +37,22 @@
* the start value into a pointer.
*/
-static ushort elt_uint( const void *elts, ushort idx )
+static unsigned elt_uint( const void *elts, unsigned idx )
{
return *(((const uint *)elts) + idx);
}
-static ushort elt_ushort( const void *elts, ushort idx )
+static unsigned elt_ushort( const void *elts, unsigned idx )
{
return *(((const ushort *)elts) + idx);
}
-static ushort elt_ubyte( const void *elts, ushort idx )
+static unsigned elt_ubyte( const void *elts, unsigned idx )
{
return *(((const ubyte *)elts) + idx);
}
-static ushort elt_vert( const void *elts, ushort idx )
+static unsigned elt_vert( const void *elts, unsigned idx )
{
return (const ubyte *)elts - (const ubyte *)NULL + idx;
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c
index 07e9f0ae5fa..98c22eb4d4a 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache.c
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c
@@ -45,7 +45,7 @@
struct vcache_frontend {
struct draw_pt_front_end base;
- ushort in[CACHE_MAX];
+ unsigned in[CACHE_MAX];
ushort out[CACHE_MAX];
ushort draw_elts[DRAW_MAX];
@@ -74,13 +74,14 @@ static void vcache_flush( struct vcache_frontend *vcache )
}
#endif
- if (vcache->draw_count)
+ if (vcache->draw_count) {
vcache->middle->run( vcache->middle,
vcache->output_prim,
vcache->fetch_elts,
vcache->fetch_count,
vcache->draw_elts,
vcache->draw_count );
+ }
memset(vcache->in, ~0, sizeof(vcache->in));
vcache->fetch_count = 0;
@@ -100,9 +101,7 @@ static void vcache_check_flush( struct vcache_frontend *vcache )
static void vcache_elt( struct vcache_frontend *vcache,
unsigned felt )
{
- // ushort felt = elt(draw, i);
-
- ushort idx = felt % CACHE_MAX;
+ unsigned idx = felt % CACHE_MAX;
if (vcache->in[idx] != felt) {
assert(vcache->fetch_count < FETCH_MAX);