From a407636efb6c32cee81b9a1525dbc804aacd957b Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 12 Jan 2010 15:54:13 +0100 Subject: gallium: remove point_size_min and point_size_max from rasterizer state The state tracker is responsible for clamping to any graphics API enforced size min/max limits for both the static point_size setting as well as per vertex point size (in the vertex shader). Note that mesa state tracker didn't actually use these values. --- src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/gallium/auxiliary/draw') diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c index 8dc50c0ab4..f723e658e1 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c @@ -64,8 +64,6 @@ struct widepoint_stage { struct draw_stage stage; float half_point_size; - float point_size_min; - float point_size_max; float xbias; float ybias; @@ -151,13 +149,6 @@ static void widepoint_point( struct draw_stage *stage, /* point size is either per-vertex or fixed size */ if (wide->psize_slot >= 0) { half_size = header->v[0]->data[wide->psize_slot][0]; - - /* XXX: temporary -- do this in the vertex shader?? - */ - half_size = CLAMP(half_size, - wide->point_size_min, - wide->point_size_max); - half_size *= 0.5f; } else { @@ -222,8 +213,6 @@ static void widepoint_first_point( struct draw_stage *stage, struct draw_context *draw = stage->draw; wide->half_point_size = 0.5f * draw->rasterizer->point_size; - wide->point_size_min = draw->rasterizer->point_size_min; - wide->point_size_max = draw->rasterizer->point_size_max; wide->xbias = 0.0; wide->ybias = 0.0; -- cgit v1.2.3 From 4a4daa75a85db22cd37ebd533ebbccb427e07077 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 3 Feb 2010 17:25:14 +0100 Subject: 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). --- src/gallium/auxiliary/draw/draw_pipe_validate.c | 6 +++--- src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 16 +++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/gallium/auxiliary/draw') diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c index bea90e50d3..ac29634d67 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 f723e658e1..d9d4d2a8b6 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++; } } -- cgit v1.2.3 From 68f93ea3eb83cfad014b8ec93cec3564c1aa9833 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 4 Feb 2010 21:35:28 +0100 Subject: gallium: add point_quad_rasterization bit to rasterizer state This determines if points should be rasterized according to GL point rules or as normal quads (GL point sprites / d3d points / d3d point sprites). --- src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium/auxiliary/draw') diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c index d9d4d2a8b6..fdabce7d44 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c @@ -128,6 +128,7 @@ static void set_texcoords(const struct widepoint_stage *wide, static void widepoint_point( struct draw_stage *stage, struct prim_header *header ) { + /* XXX should take point_quad_rasterization into account? */ 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->sprite_coord_enable; -- cgit v1.2.3