diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/pipe/draw/draw_context.c | 25 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_context.h | 4 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_private.h | 3 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_validate.c | 4 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vbuf.c | 11 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex.c | 2 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex.h | 5 |
7 files changed, 46 insertions, 8 deletions
diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c index e08873c5e14..5b9ea556300 100644 --- a/src/mesa/pipe/draw/draw_context.c +++ b/src/mesa/pipe/draw/draw_context.c @@ -71,7 +71,7 @@ struct draw_context *draw_create( void ) */ { uint i; - char *tmp = MALLOC( Elements(draw->vcache.vertex) * MAX_VERTEX_SIZE ); + char *tmp = (char*) MALLOC( Elements(draw->vcache.vertex) * MAX_VERTEX_SIZE ); for (i = 0; i < Elements(draw->vcache.vertex); i++) draw->vcache.vertex[i] = (struct vertex_header *)(tmp + i * MAX_VERTEX_SIZE); @@ -82,6 +82,9 @@ struct draw_context *draw_create( void ) draw->attrib_front1 = 0; draw->attrib_back1 = 0; + draw->convert_wide_points = TRUE; + draw->convert_wide_lines = TRUE; + draw->prim = ~0; /* != any of PIPE_PRIM_x */ draw_vertex_cache_invalidate( draw ); @@ -217,6 +220,26 @@ draw_set_mapped_constant_buffer(struct draw_context *draw, } +/** + * Tells the draw module whether to convert wide points (size != 1) + * into triangles. + */ +void +draw_convert_wide_points(struct draw_context *draw, boolean enable) +{ + draw->convert_wide_points = enable; +} + + +/** + * Tells the draw module whether to convert wide lines (width != 1) + * into triangles. + */ +void +draw_convert_wide_lines(struct draw_context *draw, boolean enable) +{ + draw->convert_wide_lines = enable; +} diff --git a/src/mesa/pipe/draw/draw_context.h b/src/mesa/pipe/draw/draw_context.h index 91e11e6930a..cfde26ceb7b 100644 --- a/src/mesa/pipe/draw/draw_context.h +++ b/src/mesa/pipe/draw/draw_context.h @@ -89,6 +89,10 @@ void draw_set_rasterizer_state( struct draw_context *draw, void draw_set_rasterize_stage( struct draw_context *draw, struct draw_stage *stage ); +void draw_convert_wide_points(struct draw_context *draw, boolean enable); + +void draw_convert_wide_lines(struct draw_context *draw, boolean enable); + struct draw_vertex_shader * draw_create_vertex_shader(struct draw_context *draw, diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index 20503fe158a..a264fabfb48 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -195,6 +195,9 @@ struct draw_context uint attrib_front0, attrib_back0; uint attrib_front1, attrib_back1; + boolean convert_wide_points; /**< convert wide points to tris? */ + boolean convert_wide_lines; /**< convert side lines to tris? */ + boolean drawing; /**< do we presently have something queued for drawing? */ unsigned prim; /**< current prim type: PIPE_PRIM_x */ unsigned reduced_prim; diff --git a/src/mesa/pipe/draw/draw_validate.c b/src/mesa/pipe/draw/draw_validate.c index df06e0426c6..3b1f5179a93 100644 --- a/src/mesa/pipe/draw/draw_validate.c +++ b/src/mesa/pipe/draw/draw_validate.c @@ -51,8 +51,8 @@ static void validate_begin( struct draw_stage *stage ) * shorter pipelines for lines & points. */ - if (draw->rasterizer->line_width != 1.0 || - draw->rasterizer->point_size != 1.0 || + if ((draw->rasterizer->line_width != 1.0 && draw->convert_wide_lines) || + (draw->rasterizer->point_size != 1.0 && draw->convert_wide_points) || draw->rasterizer->point_sprite) { draw->pipeline.wide->next = next; next = draw->pipeline.wide; diff --git a/src/mesa/pipe/draw/draw_vbuf.c b/src/mesa/pipe/draw/draw_vbuf.c index 7683e3381c1..0e07ee76909 100644 --- a/src/mesa/pipe/draw/draw_vbuf.c +++ b/src/mesa/pipe/draw/draw_vbuf.c @@ -148,6 +148,10 @@ emit_vertex( struct vbuf_stage *vbuf, *vbuf->vertex_ptr++ = fui(vertex->data[j][0]); count++; break; + case FORMAT_1F_PSIZE: + *vbuf->vertex_ptr++ = fui(vbuf->stage.draw->rasterizer->point_size); + count++; + break; case FORMAT_2F: *vbuf->vertex_ptr++ = fui(vertex->data[j][0]); *vbuf->vertex_ptr++ = fui(vertex->data[j][1]); @@ -353,7 +357,7 @@ vbuf_alloc_vertices( struct draw_stage *stage, /* Allocate a new vertex buffer */ vbuf->vertex_size = new_vertex_size; vbuf->max_vertices = vbuf->render->max_vertex_buffer_bytes / vbuf->vertex_size; - vbuf->vertices = vbuf->render->allocate_vertices(vbuf->render, + vbuf->vertices = (uint *) vbuf->render->allocate_vertices(vbuf->render, (ushort) vbuf->vertex_size, (ushort) vbuf->max_vertices); vbuf->vertex_ptr = vbuf->vertices; @@ -388,6 +392,7 @@ vbuf_end( struct draw_stage *stage ) static void vbuf_reset_stipple_counter( struct draw_stage *stage ) { + (void) stage; } @@ -421,8 +426,8 @@ struct draw_stage *draw_vbuf_stage( struct draw_context *draw, assert(render->max_indices < UNDEFINED_VERTEX_ID); vbuf->max_indices = render->max_indices; - vbuf->indices - = align_malloc( vbuf->max_indices * sizeof(vbuf->indices[0]), 16 ); + vbuf->indices = (ushort *) + align_malloc( vbuf->max_indices * sizeof(vbuf->indices[0]), 16 ); vbuf->vertices = NULL; vbuf->vertex_ptr = vbuf->vertices; diff --git a/src/mesa/pipe/draw/draw_vertex.c b/src/mesa/pipe/draw/draw_vertex.c index a1926d951a5..6191fcedbf9 100644 --- a/src/mesa/pipe/draw/draw_vertex.c +++ b/src/mesa/pipe/draw/draw_vertex.c @@ -65,6 +65,8 @@ draw_compute_vertex_size(struct vertex_info *vinfo) break; case FORMAT_4UB: /* fall-through */ + case FORMAT_1F_PSIZE: + /* fall-through */ case FORMAT_1F: vinfo->size += 1; break; diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/mesa/pipe/draw/draw_vertex.h index ab0425e106d..e4f85bc49f8 100644 --- a/src/mesa/pipe/draw/draw_vertex.h +++ b/src/mesa/pipe/draw/draw_vertex.h @@ -41,12 +41,13 @@ struct draw_context; * Vertex attribute format */ enum attrib_format { - FORMAT_OMIT, + FORMAT_OMIT, /**< don't emit the attribute */ FORMAT_1F, + FORMAT_1F_PSIZE, /**< insert constant point size */ FORMAT_2F, FORMAT_3F, FORMAT_4F, - FORMAT_4UB + FORMAT_4UB /**< XXX may need variations for RGBA vs BGRA, etc */ }; |