summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/draw/draw_wide_prims.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-22 12:10:30 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-22 12:10:30 -0600
commit1b4852345954af9b582b03a91a3d8399b8fb0e92 (patch)
treeac81b602940c3b854bf1a0b511cc3218da3a9c7a /src/mesa/pipe/draw/draw_wide_prims.c
parent22e5c4f0f09cff64039b171c5cee6def07395e1f (diff)
add support for sprite texcoord modes
Diffstat (limited to 'src/mesa/pipe/draw/draw_wide_prims.c')
-rw-r--r--src/mesa/pipe/draw/draw_wide_prims.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/mesa/pipe/draw/draw_wide_prims.c b/src/mesa/pipe/draw/draw_wide_prims.c
index 0d02e70814..917944a611 100644
--- a/src/mesa/pipe/draw/draw_wide_prims.c
+++ b/src/mesa/pipe/draw/draw_wide_prims.c
@@ -40,7 +40,8 @@ struct wide_stage {
float half_line_width;
float half_point_size;
- uint texcoord[PIPE_MAX_SHADER_OUTPUTS];
+ uint texcoord_slot[PIPE_MAX_SHADER_OUTPUTS];
+ uint texcoord_mode[PIPE_MAX_SHADER_OUTPUTS];
uint num_texcoords;
};
@@ -123,16 +124,26 @@ static void wide_line( struct draw_stage *stage,
}
+/**
+ * Set the vertex texcoords for sprite mode.
+ * Coords may be left untouched or set to a right-side-up or upside-down
+ * orientation.
+ */
static void set_texcoords(const struct wide_stage *wide,
struct vertex_header *v, const float tc[4])
{
uint i;
for (i = 0; i < wide->num_texcoords; i++) {
- uint j = wide->texcoord[i];
- v->data[j][0] = tc[0];
- v->data[j][1] = tc[1];
- v->data[j][2] = tc[2];
- v->data[j][3] = tc[3];
+ if (wide->texcoord_mode[i] != PIPE_SPRITE_COORD_NONE) {
+ uint j = wide->texcoord_slot[i];
+ v->data[j][0] = tc[0];
+ if (wide->texcoord_mode[i] == PIPE_SPRITE_COORD_LOWER_LEFT)
+ v->data[j][1] = 1.0 - tc[1];
+ else
+ v->data[j][1] = tc[1];
+ v->data[j][2] = tc[2];
+ v->data[j][3] = tc[3];
+ }
}
}
@@ -230,7 +241,9 @@ static void wide_begin( struct draw_stage *stage )
uint i, j = 0;
for (i = 0; i < vs->state->num_outputs; i++) {
if (vs->state->output_semantic_name[i] == TGSI_SEMANTIC_GENERIC) {
- wide->texcoord[j++] = i;
+ wide->texcoord_slot[j] = i;
+ wide->texcoord_mode[j] = draw->rasterizer->sprite_coord_mode[j];
+ j++;
}
}
wide->num_texcoords = j;