summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/vega/path.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-12-03 00:44:43 +0800
committerChia-I Wu <[email protected]>2010-12-03 14:23:04 +0800
commita84a1e344f544ec4da61809d4f09853a94d93e07 (patch)
treed1d141510e4a3b64c58e7596b2127749b320a067 /src/gallium/state_trackers/vega/path.c
parent29bea39fde0b3be89a34bf0d979f33f601412eee (diff)
st/vega: Move vertex transformation to shader.
It was done in path-to-polygon conversion. That meant that the results were invalidated when the transformation was modified, and CPU had to recreate the vertex buffer with new vertices. It could be a performance hit for apps that animate.
Diffstat (limited to 'src/gallium/state_trackers/vega/path.c')
-rw-r--r--src/gallium/state_trackers/vega/path.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/vega/path.c b/src/gallium/state_trackers/vega/path.c
index 31a043ea9b7..d7253befd03 100644
--- a/src/gallium/state_trackers/vega/path.c
+++ b/src/gallium/state_trackers/vega/path.c
@@ -1565,10 +1565,11 @@ void path_render(struct path *p, VGbitfield paintModes,
mat,
&paint_matrix)) {
/* First the fill */
+ shader_set_surface_matrix(ctx->shader, mat);
shader_set_paint(ctx->shader, ctx->state.vg.fill_paint);
shader_set_paint_matrix(ctx->shader, &paint_matrix);
shader_bind(ctx->shader);
- path_fill(p, mat);
+ path_fill(p);
}
if ((paintModes & VG_STROKE_PATH) &&
@@ -1580,18 +1581,23 @@ void path_render(struct path *p, VGbitfield paintModes,
* taking place."*/
if (ctx->state.vg.stroke.line_width.f <= 0)
return;
+ shader_set_surface_matrix(ctx->shader, mat);
shader_set_paint(ctx->shader, ctx->state.vg.stroke_paint);
shader_set_paint_matrix(ctx->shader, &paint_matrix);
shader_bind(ctx->shader);
- path_stroke(p, mat);
+ path_stroke(p);
}
}
-void path_fill(struct path *p, struct matrix *mat)
+void path_fill(struct path *p)
{
struct vg_context *ctx = vg_current_context();
+ struct matrix identity;
+
+ matrix_load_identity(&identity);
+
{
- struct polygon_array *polygon_array = path_get_fill_polygons(p, mat);
+ struct polygon_array *polygon_array = path_get_fill_polygons(p, &identity);
struct array *polys = polygon_array->array;
if (!polygon_array || !polys || !polys->num_elements) {
@@ -1601,7 +1607,7 @@ void path_fill(struct path *p, struct matrix *mat)
}
}
-void path_stroke(struct path *p, struct matrix *mat)
+void path_stroke(struct path *p)
{
struct vg_context *ctx = vg_current_context();
VGFillRule old_fill = ctx->state.vg.fill_rule;
@@ -1613,7 +1619,7 @@ void path_stroke(struct path *p, struct matrix *mat)
if (stroke && !path_is_empty(stroke)) {
ctx->state.vg.fill_rule = VG_NON_ZERO;
- path_fill(stroke, mat);
+ path_fill(stroke);
ctx->state.vg.fill_rule = old_fill;
}