summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_pipe_aaline.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2008-06-11 23:48:13 +0100
committerKeith Whitwell <[email protected]>2008-06-11 23:48:45 +0100
commit2161b0fafcdc16703162dd489d2ec1e7114cce4c (patch)
tree4e192f064c7416c9fb59012d586d1fc87afdf877 /src/gallium/auxiliary/draw/draw_pipe_aaline.c
parent807f8f177b3a2833806d84a70e71019f8849239f (diff)
draw: don't assume vertex position is in data[0]
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pipe_aaline.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 634bf067f14..ecdebca5f12 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -78,6 +78,8 @@ struct aaline_stage
/** For AA lines, this is the vertex attrib slot for the new texcoords */
uint tex_slot;
+ /** position, not necessarily output zero */
+ uint pos_slot;
void *sampler_cso;
struct pipe_texture *texture;
@@ -520,9 +522,10 @@ aaline_line(struct draw_stage *stage, struct prim_header *header)
struct prim_header tri;
struct vertex_header *v[8];
uint texPos = aaline->tex_slot;
+ uint posPos = aaline->pos_slot;
float *pos, *tex;
- float dx = header->v[1]->data[0][0] - header->v[0]->data[0][0];
- float dy = header->v[1]->data[0][1] - header->v[0]->data[0][1];
+ float dx = header->v[1]->data[posPos][0] - header->v[0]->data[posPos][0];
+ float dy = header->v[1]->data[posPos][1] - header->v[0]->data[posPos][1];
double a = atan2(dy, dx);
float c_a = (float) cos(a), s_a = (float) sin(a);
uint i;
@@ -549,35 +552,35 @@ aaline_line(struct draw_stage *stage, struct prim_header *header)
*/
/* new verts */
- pos = v[0]->data[0];
+ pos = v[0]->data[posPos];
pos[0] += (-dx * c_a - dy * s_a);
pos[1] += (-dx * s_a + dy * c_a);
- pos = v[1]->data[0];
+ pos = v[1]->data[posPos];
pos[0] += (-dx * c_a - -dy * s_a);
pos[1] += (-dx * s_a + -dy * c_a);
- pos = v[2]->data[0];
+ pos = v[2]->data[posPos];
pos[0] += ( dx * c_a - dy * s_a);
pos[1] += ( dx * s_a + dy * c_a);
- pos = v[3]->data[0];
+ pos = v[3]->data[posPos];
pos[0] += ( dx * c_a - -dy * s_a);
pos[1] += ( dx * s_a + -dy * c_a);
- pos = v[4]->data[0];
+ pos = v[4]->data[posPos];
pos[0] += (-dx * c_a - dy * s_a);
pos[1] += (-dx * s_a + dy * c_a);
- pos = v[5]->data[0];
+ pos = v[5]->data[posPos];
pos[0] += (-dx * c_a - -dy * s_a);
pos[1] += (-dx * s_a + -dy * c_a);
- pos = v[6]->data[0];
+ pos = v[6]->data[posPos];
pos[0] += ( dx * c_a - dy * s_a);
pos[1] += ( dx * s_a + dy * c_a);
- pos = v[7]->data[0];
+ pos = v[7]->data[posPos];
pos[0] += ( dx * c_a - -dy * s_a);
pos[1] += ( dx * s_a + -dy * c_a);
@@ -653,7 +656,7 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header)
/* update vertex attrib info */
aaline->tex_slot = draw->vs.num_vs_outputs;
- assert(aaline->tex_slot > 0); /* output[0] is vertex pos */
+ aaline->pos_slot = draw->vs.position_output;
/* advertise the extra post-transformed vertex attribute */
draw->extra_vp_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;