summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2010-02-03 17:25:14 +0100
committerRoland Scheidegger <[email protected]>2010-02-03 17:25:14 +0100
commit4a4daa75a85db22cd37ebd533ebbccb427e07077 (patch)
tree981d728824666f3c19995ce54e05a511c1fdd690 /src/gallium/auxiliary/draw
parenta407636efb6c32cee81b9a1525dbc804aacd957b (diff)
gallium: clean up point sprite rasterizer state
Don't need sprite coord origin per coord. Also, don't need separate sprite enable bit - if all coords have it diabled, then there are no point sprites (technically, there's a distinction in pre-GL3, but it only differs in having more leniency in clamping to max size, something the state tracker would need to handle and the hardware won't bother anyway). Also, use packed field for the per-coord enables. All in all, should save 3 dwords in rasterizer state (from 10 down to 7).
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_validate.c6
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_wide_point.c16
2 files changed, 12 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c
index bea90e50d30..ac29634d677 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_validate.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c
@@ -105,7 +105,7 @@ draw_need_pipeline(const struct draw_context *draw,
return TRUE;
/* point sprites */
- if (rasterizer->point_sprite && draw->pipeline.point_sprite)
+ if (rasterizer->sprite_coord_enable && draw->pipeline.point_sprite)
return TRUE;
}
@@ -165,7 +165,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
&& !draw->rasterizer->line_smooth);
/* drawing large points? */
- if (draw->rasterizer->point_sprite && draw->pipeline.point_sprite)
+ if (draw->rasterizer->sprite_coord_enable && draw->pipeline.point_sprite)
wide_points = TRUE;
else if (draw->rasterizer->point_smooth && draw->pipeline.aapoint)
wide_points = FALSE;
@@ -197,7 +197,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
precalc_flat = 1;
}
- if (wide_points || draw->rasterizer->point_sprite) {
+ if (wide_points || draw->rasterizer->sprite_coord_enable) {
draw->pipeline.wide_point->next = next;
next = draw->pipeline.wide_point;
}
diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
index f723e658e1a..d9d4d2a8b67 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
@@ -69,8 +69,9 @@ struct widepoint_stage {
float ybias;
uint texcoord_slot[PIPE_MAX_SHADER_OUTPUTS];
- uint texcoord_mode[PIPE_MAX_SHADER_OUTPUTS];
+ uint texcoord_enable[PIPE_MAX_SHADER_OUTPUTS];
uint num_texcoords;
+ uint texcoord_mode;
int psize_slot;
@@ -96,10 +97,10 @@ static void set_texcoords(const struct widepoint_stage *wide,
{
uint i;
for (i = 0; i < wide->num_texcoords; i++) {
- if (wide->texcoord_mode[i] != PIPE_SPRITE_COORD_NONE) {
+ if (wide->texcoord_enable[i]) {
uint j = wide->texcoord_slot[i];
v->data[j][0] = tc[0];
- if (wide->texcoord_mode[i] == PIPE_SPRITE_COORD_LOWER_LEFT)
+ if (wide->texcoord_mode == PIPE_SPRITE_COORD_LOWER_LEFT)
v->data[j][1] = 1.0f - tc[1];
else
v->data[j][1] = tc[1];
@@ -129,7 +130,7 @@ static void widepoint_point( struct draw_stage *stage,
{
const struct widepoint_stage *wide = widepoint_stage(stage);
const unsigned pos = draw_current_shader_position_output(stage->draw);
- const boolean sprite = (boolean) stage->draw->rasterizer->point_sprite;
+ const boolean sprite = (boolean) stage->draw->rasterizer->sprite_coord_enable;
float half_size;
float left_adj, right_adj, bot_adj, top_adj;
@@ -222,21 +223,22 @@ static void widepoint_first_point( struct draw_stage *stage,
/* XXX we won't know the real size if it's computed by the vertex shader! */
if ((draw->rasterizer->point_size > draw->pipeline.wide_point_threshold) ||
- (draw->rasterizer->point_sprite && draw->pipeline.point_sprite)) {
+ (draw->rasterizer->sprite_coord_enable && draw->pipeline.point_sprite)) {
stage->point = widepoint_point;
}
else {
stage->point = draw_pipe_passthrough_point;
}
- if (draw->rasterizer->point_sprite) {
+ if (draw->rasterizer->sprite_coord_enable) {
/* find vertex shader texcoord outputs */
const struct draw_vertex_shader *vs = draw->vs.vertex_shader;
uint i, j = 0;
+ wide->texcoord_mode = draw->rasterizer->sprite_coord_mode;
for (i = 0; i < vs->info.num_outputs; i++) {
if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_GENERIC) {
wide->texcoord_slot[j] = i;
- wide->texcoord_mode[j] = draw->rasterizer->sprite_coord_mode[j];
+ wide->texcoord_enable[j] = (draw->rasterizer->sprite_coord_enable >> j) & 1;
j++;
}
}