summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-06-02 14:36:27 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-06-02 14:37:03 +0100
commit6a39bcf3752df7c22cdd38b4645a885eb318add8 (patch)
tree752d11b8a127f1dccbfca87bad0ae5aa23c94f0f /src/gallium/auxiliary/draw
parente0860518dfb5a5c6ba6584e3c1b5d7b203277dac (diff)
draw: fast element translate path without delta
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache.c124
1 files changed, 93 insertions, 31 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c
index 9ffc99abf9..ad86ab4292 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache.c
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c
@@ -201,39 +201,74 @@ static void vcache_ef_quad( struct vcache_frontend *vcache,
#define FUNC vcache_run
#include "draw_pt_vcache_tmp.h"
+static void rebase_uint_elts( const unsigned *src,
+ unsigned count,
+ int delta,
+ ushort *dest )
+{
+ unsigned i;
+
+ for (i = 0; i < count; i++)
+ dest[i] = (ushort)(src[i] + delta);
+}
+
+static void rebase_ushort_elts( const ushort *src,
+ unsigned count,
+ int delta,
+ ushort *dest )
+{
+ unsigned i;
+
+ for (i = 0; i < count; i++)
+ dest[i] = (ushort)(src[i] + delta);
+}
+
+static void rebase_ubyte_elts( const ubyte *src,
+ unsigned count,
+ int delta,
+ ushort *dest )
+{
+ unsigned i;
+
+ for (i = 0; i < count; i++)
+ dest[i] = (ushort)(src[i] + delta);
+}
+
+
+
static void translate_uint_elts( const unsigned *src,
unsigned count,
- int delta,
ushort *dest )
{
unsigned i;
for (i = 0; i < count; i++)
- dest[i] = (ushort)(src[i] + delta);
+ dest[i] = (ushort)(src[i]);
}
static void translate_ushort_elts( const ushort *src,
unsigned count,
- int delta,
ushort *dest )
{
unsigned i;
for (i = 0; i < count; i++)
- dest[i] = (ushort)(src[i] + delta);
+ dest[i] = (ushort)(src[i]);
}
static void translate_ubyte_elts( const ubyte *src,
unsigned count,
- int delta,
ushort *dest )
{
unsigned i;
for (i = 0; i < count; i++)
- dest[i] = (ushort)(src[i] + delta);
+ dest[i] = (ushort)(src[i]);
}
+
+
+
#if 0
static enum pipe_format format_from_get_elt( pt_elt_func get_elt )
{
@@ -282,31 +317,58 @@ static void vcache_check_run( struct draw_pt_front_end *frontend,
if (!storage)
goto fail;
- switch(index_size) {
- case 1:
- translate_ubyte_elts( (const ubyte *)elts,
- draw_count,
- 0 - (int)min_index,
- storage );
- break;
-
- case 2:
- translate_ushort_elts( (const ushort *)elts,
- draw_count,
- 0 - (int)min_index,
- storage );
- break;
-
- case 4:
- translate_uint_elts( (const uint *)elts,
- draw_count,
- 0 - (int)min_index,
- storage );
- break;
-
- default:
- assert(0);
- return;
+ if (min_index == 0) {
+ switch(index_size) {
+ case 1:
+ translate_ubyte_elts( (const ubyte *)elts,
+ draw_count,
+ storage );
+ break;
+
+ case 2:
+ translate_ushort_elts( (const ushort *)elts,
+ draw_count,
+ storage );
+ break;
+
+ case 4:
+ translate_uint_elts( (const uint *)elts,
+ draw_count,
+ storage );
+ break;
+
+ default:
+ assert(0);
+ return;
+ }
+ }
+ else {
+ switch(index_size) {
+ case 1:
+ rebase_ubyte_elts( (const ubyte *)elts,
+ draw_count,
+ 0 - (int)min_index,
+ storage );
+ break;
+
+ case 2:
+ rebase_ushort_elts( (const ushort *)elts,
+ draw_count,
+ 0 - (int)min_index,
+ storage );
+ break;
+
+ case 4:
+ rebase_uint_elts( (const uint *)elts,
+ draw_count,
+ 0 - (int)min_index,
+ storage );
+ break;
+
+ default:
+ assert(0);
+ return;
+ }
}
transformed_elts = storage;
}