summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-04-19 18:14:04 +0200
committerJosé Fonseca <jfonseca@vmware.com>2010-04-19 18:14:04 +0200
commit2197fac47cb1f87387820678357cc67c9a2536b9 (patch)
treea23d704cdd4bcc8179a81bf4251b8039d43b4be4 /src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
parent857c7c7ca266df4be8d4c725e056f69d4ee96624 (diff)
draw: Implement index bias.
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h77
1 files changed, 39 insertions, 38 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
index 7cba8547f1..eedd31b7f8 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
@@ -3,6 +3,7 @@
static void FUNC( struct draw_pt_front_end *frontend,
pt_elt_func get_elt,
const void *elts,
+ int elt_bias,
unsigned count )
{
struct vcache_frontend *vcache = (struct vcache_frontend *)frontend;
@@ -20,7 +21,7 @@ static void FUNC( struct draw_pt_front_end *frontend,
case PIPE_PRIM_POINTS:
for (i = 0; i < count; i ++) {
POINT( vcache,
- get_elt(elts, i + 0) );
+ get_elt(elts, i + 0) + elt_bias );
}
break;
@@ -28,8 +29,8 @@ static void FUNC( struct draw_pt_front_end *frontend,
for (i = 0; i+1 < count; i += 2) {
LINE( vcache,
DRAW_PIPE_RESET_STIPPLE,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1));
+ get_elt(elts, i + 0) + elt_bias,
+ get_elt(elts, i + 1) + elt_bias);
}
break;
@@ -40,14 +41,14 @@ static void FUNC( struct draw_pt_front_end *frontend,
for (i = 1; i < count; i++, flags = 0) {
LINE( vcache,
flags,
- get_elt(elts, i - 1),
- get_elt(elts, i ));
+ get_elt(elts, i - 1) + elt_bias,
+ get_elt(elts, i ) + elt_bias);
}
LINE( vcache,
flags,
- get_elt(elts, i - 1),
- get_elt(elts, 0 ));
+ get_elt(elts, i - 1) + elt_bias,
+ get_elt(elts, 0 ) + elt_bias);
}
break;
@@ -56,8 +57,8 @@ static void FUNC( struct draw_pt_front_end *frontend,
for (i = 1; i < count; i++, flags = 0) {
LINE( vcache,
flags,
- get_elt(elts, i - 1),
- get_elt(elts, i ));
+ get_elt(elts, i - 1) + elt_bias,
+ get_elt(elts, i ) + elt_bias);
}
break;
@@ -65,9 +66,9 @@ static void FUNC( struct draw_pt_front_end *frontend,
for (i = 0; i+2 < count; i += 3) {
TRIANGLE( vcache,
DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2 ));
+ get_elt(elts, i + 0) + elt_bias,
+ get_elt(elts, i + 1) + elt_bias,
+ get_elt(elts, i + 2 ) + elt_bias);
}
break;
@@ -76,18 +77,18 @@ static void FUNC( struct draw_pt_front_end *frontend,
for (i = 0; i+2 < count; i++) {
TRIANGLE( vcache,
DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1 + (i&1)),
- get_elt(elts, i + 2 - (i&1)));
+ get_elt(elts, i + 0) + elt_bias,
+ get_elt(elts, i + 1 + (i&1) + elt_bias),
+ get_elt(elts, i + 2 - (i&1) + elt_bias));
}
}
else {
for (i = 0; i+2 < count; i++) {
TRIANGLE( vcache,
DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
- get_elt(elts, i + 0 + (i&1)),
- get_elt(elts, i + 1 - (i&1)),
- get_elt(elts, i + 2 ));
+ get_elt(elts, i + 0 + (i&1) + elt_bias),
+ get_elt(elts, i + 1 - (i&1) + elt_bias),
+ get_elt(elts, i + 2 ) + elt_bias);
}
}
break;
@@ -98,18 +99,18 @@ static void FUNC( struct draw_pt_front_end *frontend,
for (i = 0; i+2 < count; i++) {
TRIANGLE( vcache,
DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
- get_elt(elts, i + 1),
- get_elt(elts, i + 2),
- get_elt(elts, 0 ));
+ get_elt(elts, i + 1) + elt_bias,
+ get_elt(elts, i + 2) + elt_bias,
+ get_elt(elts, 0 ) + elt_bias);
}
}
else {
for (i = 0; i+2 < count; i++) {
TRIANGLE( vcache,
DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
- get_elt(elts, 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2 ));
+ get_elt(elts, 0) + elt_bias,
+ get_elt(elts, i + 1) + elt_bias,
+ get_elt(elts, i + 2 ) + elt_bias);
}
}
}
@@ -119,20 +120,20 @@ static void FUNC( struct draw_pt_front_end *frontend,
case PIPE_PRIM_QUADS:
for (i = 0; i+3 < count; i += 4) {
QUAD( vcache,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2),
- get_elt(elts, i + 3) );
+ get_elt(elts, i + 0) + elt_bias,
+ get_elt(elts, i + 1) + elt_bias,
+ get_elt(elts, i + 2) + elt_bias,
+ get_elt(elts, i + 3) + elt_bias );
}
break;
case PIPE_PRIM_QUAD_STRIP:
for (i = 0; i+3 < count; i += 2) {
QUAD( vcache,
- get_elt(elts, i + 2),
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 3) );
+ get_elt(elts, i + 2) + elt_bias,
+ get_elt(elts, i + 0) + elt_bias,
+ get_elt(elts, i + 1) + elt_bias,
+ get_elt(elts, i + 3) + elt_bias );
}
break;
@@ -165,16 +166,16 @@ static void FUNC( struct draw_pt_front_end *frontend,
if (flatfirst) {
TRIANGLE( vcache,
flags,
- get_elt(elts, 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2) );
+ get_elt(elts, 0) + elt_bias,
+ get_elt(elts, i + 1) + elt_bias,
+ get_elt(elts, i + 2) + elt_bias );
}
else {
TRIANGLE( vcache,
flags,
- get_elt(elts, i + 1),
- get_elt(elts, i + 2),
- get_elt(elts, 0));
+ get_elt(elts, i + 1) + elt_bias,
+ get_elt(elts, i + 2) + elt_bias,
+ get_elt(elts, 0) + elt_bias);
}
}
}