On 04/17/2014 12:48 AM, Rob Clark wrote: > On Wed, Apr 16, 2014 at 9:09 AM, Thomas Hellstrom <thellst...@vmware.com> > wrote: >> Hi, Rob, >> >> Do you think we can push patches 1 trough 3 with a CC to stable for >> patch 3? > yes please.. you can push, or I can.. I was just waiting to hear back > from you on the later patches. I meant to propose merging the first 3 > but got distracted with other things ;-) > > OK, so I've pushed the three first patches ( I added your reviewed-by on the third, It looked from our email discussion like you have revied it).
I also took a liberty of reworking the fourth patch a bit. By sending solid colors to the fragment shader using shader constants the xa_renderer code becomes a lot nicer. I've attached the patches to this email. (I have no intentions to "steal" your work so feel free to add tags or use the code in any way you see fit :) ). I haven't tested extensively but I don't see the rendercheck errors with these patches. I still have a rendering problem when enabling solid fills, though, but I suspect that's a vmwgfx bug. As for the fifth patch, it seems to me like if the source is xrgb and the dest is alpha, we could be using a solid fill path with (1, 0, 0, 0) source color, without alterations to the fragment shader? Likewise if mask is xrgb and we're not using component alpha, that's equivalent to no mask regardless of destination? Thanks Thomas
>From bfa1e504961e0980bb2b40c1ac271691a2d8aebe Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom <thellst...@vmware.com> Date: Thu, 17 Apr 2014 08:06:22 +0200 Subject: [PATCH 1/2] st/xa: Enable solid fill with (non-solid) mask Based on work by Rob Clark. Signed-off-by: Thomas Hellstrom <thellst...@vmware.com> --- src/gallium/state_trackers/xa/xa_composite.c | 94 +++++++++++----------------- src/gallium/state_trackers/xa/xa_context.c | 2 +- src/gallium/state_trackers/xa/xa_priv.h | 2 +- src/gallium/state_trackers/xa/xa_renderer.c | 47 ++++++++------ src/gallium/state_trackers/xa/xa_tgsi.c | 13 ++-- 5 files changed, 73 insertions(+), 85 deletions(-) diff --git a/src/gallium/state_trackers/xa/xa_composite.c b/src/gallium/state_trackers/xa/xa_composite.c index 7ae35a1..de57518 100644 --- a/src/gallium/state_trackers/xa/xa_composite.c +++ b/src/gallium/state_trackers/xa/xa_composite.c @@ -125,6 +125,7 @@ blend_for_op(struct xa_composite_blend *blend, if (xa_blends[i].op == op) { *blend = xa_blends[i]; supported = TRUE; + break; } } @@ -224,18 +225,12 @@ xa_composite_check_accelerated(const struct xa_composite *comp) } - if (src_pic->src_pict) { - if (src_pic->src_pict->type != xa_src_pict_solid_fill) + if (src_pic->src_pict && src_pic->src_pict->type != xa_src_pict_solid_fill) return -XA_ERR_INVAL; - /* - * Currently we don't support solid fill with a mask. - * We can easily do that, but that would require shader, - * sampler view setup and vertex setup modification. - */ - if (comp->mask) - return -XA_ERR_INVAL; - } + /* No solid masks for now. */ + if (comp->mask && comp->mask->src_pict) + return -XA_ERR_INVAL; if (blend_for_op(&blend, comp->op, comp->src, comp->mask, comp->dst)) { struct xa_picture *mask = comp->mask; @@ -337,7 +332,7 @@ bind_shaders(struct xa_context *ctx, const struct xa_composite *comp) if (src_pic->src_pict) { if (src_pic->src_pict->type == xa_src_pict_solid_fill) { - fs_traits |= FS_SOLID_FILL | FS_FILL; + fs_traits |= FS_SOLID_FILL; vs_traits |= VS_SOLID_FILL; xa_pixel_to_float4(src_pic->src_pict->solid_fill.color, ctx->solid_color); @@ -392,38 +387,32 @@ bind_samplers(struct xa_context *ctx, struct pipe_context *pipe = ctx->pipe; struct xa_picture *src_pic = comp->src; struct xa_picture *mask_pic = comp->mask; + int num_samplers = 0; - ctx->num_bound_samplers = 0; - + xa_ctx_sampler_views_destroy(ctx); memset(&src_sampler, 0, sizeof(struct pipe_sampler_state)); memset(&mask_sampler, 0, sizeof(struct pipe_sampler_state)); - if (src_pic) { - if (ctx->has_solid_color) { - samplers[0] = NULL; - pipe_sampler_view_reference(&ctx->bound_sampler_views[0], NULL); - } else { - unsigned src_wrap = xa_repeat_to_gallium(src_pic->wrap); - int filter; - - (void) xa_filter_to_gallium(src_pic->filter, &filter); - - src_sampler.wrap_s = src_wrap; - src_sampler.wrap_t = src_wrap; - src_sampler.min_img_filter = filter; - src_sampler.mag_img_filter = filter; - src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; - src_sampler.normalized_coords = 1; - samplers[0] = &src_sampler; - ctx->num_bound_samplers = 1; - u_sampler_view_default_template(&view_templ, - src_pic->srf->tex, - src_pic->srf->tex->format); - src_view = pipe->create_sampler_view(pipe, src_pic->srf->tex, - &view_templ); - pipe_sampler_view_reference(&ctx->bound_sampler_views[0], NULL); - ctx->bound_sampler_views[0] = src_view; - } + if (src_pic && !ctx->has_solid_color) { + unsigned src_wrap = xa_repeat_to_gallium(src_pic->wrap); + int filter; + + (void) xa_filter_to_gallium(src_pic->filter, &filter); + + src_sampler.wrap_s = src_wrap; + src_sampler.wrap_t = src_wrap; + src_sampler.min_img_filter = filter; + src_sampler.mag_img_filter = filter; + src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; + src_sampler.normalized_coords = 1; + samplers[0] = &src_sampler; + u_sampler_view_default_template(&view_templ, + src_pic->srf->tex, + src_pic->srf->tex->format); + src_view = pipe->create_sampler_view(pipe, src_pic->srf->tex, + &view_templ); + ctx->bound_sampler_views[0] = src_view; + num_samplers++; } if (mask_pic) { @@ -438,31 +427,21 @@ bind_samplers(struct xa_context *ctx, mask_sampler.mag_img_filter = filter; src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; mask_sampler.normalized_coords = 1; - samplers[1] = &mask_sampler; - ctx->num_bound_samplers = 2; + samplers[num_samplers] = &mask_sampler; u_sampler_view_default_template(&view_templ, mask_pic->srf->tex, mask_pic->srf->tex->format); src_view = pipe->create_sampler_view(pipe, mask_pic->srf->tex, &view_templ); - pipe_sampler_view_reference(&ctx->bound_sampler_views[1], NULL); - ctx->bound_sampler_views[1] = src_view; - - - /* - * If src is a solid color, we have no src view, so set up a - * dummy one that will not be used anyway. - */ - if (ctx->bound_sampler_views[0] == NULL) - pipe_sampler_view_reference(&ctx->bound_sampler_views[0], - src_view); - + ctx->bound_sampler_views[num_samplers] = src_view; + num_samplers++; } - cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, ctx->num_bound_samplers, + cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, num_samplers, (const struct pipe_sampler_state **)samplers); - cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, ctx->num_bound_samplers, - ctx->bound_sampler_views); + cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, num_samplers, + ctx->bound_sampler_views); + ctx->num_bound_samplers = num_samplers; } XA_EXPORT int @@ -504,8 +483,7 @@ xa_composite_rect(struct xa_context *ctx, int dstX, int dstY, int width, int height) { if (ctx->num_bound_samplers == 0 ) { /* solid fill */ - renderer_solid(ctx, dstX, dstY, dstX + width, dstY + height, - ctx->solid_color); + renderer_solid(ctx, dstX, dstY, dstX + width, dstY + height); } else { const struct xa_composite *comp = ctx->comp; int pos[6] = {srcX, srcY, maskX, maskY, dstX, dstY}; diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c index 37de45b..4602e52 100644 --- a/src/gallium/state_trackers/xa/xa_context.c +++ b/src/gallium/state_trackers/xa/xa_context.c @@ -339,7 +339,7 @@ XA_EXPORT void xa_solid(struct xa_context *ctx, int x, int y, int width, int height) { xa_scissor_update(ctx, x, y, x + width, y + height); - renderer_solid(ctx, x, y, x + width, y + height, ctx->solid_color); + renderer_solid(ctx, x, y, x + width, y + height); } XA_EXPORT void diff --git a/src/gallium/state_trackers/xa/xa_priv.h b/src/gallium/state_trackers/xa/xa_priv.h index c95d19d..a4ef834 100644 --- a/src/gallium/state_trackers/xa/xa_priv.h +++ b/src/gallium/state_trackers/xa/xa_priv.h @@ -283,7 +283,7 @@ void renderer_draw_flush(struct xa_context *r); void renderer_begin_solid(struct xa_context *r); void renderer_solid(struct xa_context *r, - int x0, int y0, int x1, int y1, float *color); + int x0, int y0, int x1, int y1); void renderer_begin_textures(struct xa_context *r); diff --git a/src/gallium/state_trackers/xa/xa_renderer.c b/src/gallium/state_trackers/xa/xa_renderer.c index 05dc9f1..eeeb431 100644 --- a/src/gallium/state_trackers/xa/xa_renderer.c +++ b/src/gallium/state_trackers/xa/xa_renderer.c @@ -136,7 +136,7 @@ renderer_init_state(struct xa_context *r) } static INLINE void -add_vertex_color(struct xa_context *r, float x, float y, float color[4]) +add_vertex_none(struct xa_context *r, float x, float y) { float *vertex = r->buffer + r->buffer_size; @@ -145,12 +145,7 @@ add_vertex_color(struct xa_context *r, float x, float y, float color[4]) vertex[2] = 0.f; /*z */ vertex[3] = 1.f; /*w */ - vertex[4] = color[0]; /*r */ - vertex[5] = color[1]; /*g */ - vertex[6] = color[2]; /*b */ - vertex[7] = color[3]; /*a */ - - r->buffer_size += 8; + r->buffer_size += 4; } static INLINE void @@ -541,27 +536,29 @@ void renderer_begin_solid(struct xa_context *r) { r->buffer_size = 0; - r->attrs_per_vertex = 2; + r->attrs_per_vertex = 1; + renderer_set_constants(r, PIPE_SHADER_FRAGMENT, r->solid_color, + 4 * sizeof(float)); } void renderer_solid(struct xa_context *r, - int x0, int y0, int x1, int y1, float *color) + int x0, int y0, int x1, int y1) { /* * debug_printf("solid rect[(%d, %d), (%d, %d)], rgba[%f, %f, %f, %f]\n", * x0, y0, x1, y1, color[0], color[1], color[2], color[3]); */ - renderer_draw_conditional(r, 4 * 8); + renderer_draw_conditional(r, 4 * 4); /* 1st vertex */ - add_vertex_color(r, x0, y0, color); + add_vertex_none(r, x0, y0); /* 2nd vertex */ - add_vertex_color(r, x1, y0, color); + add_vertex_none(r, x1, y0); /* 3rd vertex */ - add_vertex_color(r, x1, y1, color); + add_vertex_none(r, x1, y1); /* 4th vertex */ - add_vertex_color(r, x0, y1, color); + add_vertex_none(r, x0, y1); } void @@ -573,6 +570,10 @@ renderer_draw_flush(struct xa_context *r) void renderer_begin_textures(struct xa_context *r) { + if (r->has_solid_color) + renderer_set_constants(r, PIPE_SHADER_FRAGMENT, r->solid_color, + 4 * sizeof(float)); + r->attrs_per_vertex = 1 + r->num_bound_samplers; r->buffer_size = 0; } @@ -604,11 +605,19 @@ renderer_texture(struct xa_context *r, switch(r->attrs_per_vertex) { case 2: renderer_draw_conditional(r, 4 * 8); - add_vertex_data1(r, - pos[0], pos[1], /* src */ - pos[4], pos[5], /* dst */ - width, height, - sampler_view[0]->texture, src_matrix); + if (!r->has_solid_color) { + add_vertex_data1(r, + pos[0], pos[1], /* src */ + pos[4], pos[5], /* dst */ + width, height, + sampler_view[0]->texture, src_matrix); + } else { + add_vertex_data1(r, + pos[2], pos[3], /* mask */ + pos[4], pos[5], /* dst */ + width, height, + sampler_view[0]->texture, mask_matrix); + } break; case 3: renderer_draw_conditional(r, 4 * 12); diff --git a/src/gallium/state_trackers/xa/xa_tgsi.c b/src/gallium/state_trackers/xa/xa_tgsi.c index c7454c9..25701fa 100644 --- a/src/gallium/state_trackers/xa/xa_tgsi.c +++ b/src/gallium/state_trackers/xa/xa_tgsi.c @@ -85,7 +85,7 @@ print_fs_traits(int fs_traits) "FS_MASK_SET_ALPHA", /* = 1 << 13, */ "FS_SRC_LUMINANCE", /* = 1 << 14, */ "FS_MASK_LUMINANCE", /* = 1 << 15, */ - "FS_DST_LUMINANCE", /* = 1 << 15, */ + "FS_DST_LUMINANCE", /* = 1 << 15, */ }; int i, k; @@ -452,6 +452,7 @@ create_fs(struct pipe_context *pipe, unsigned fs_traits) unsigned src_luminance = (fs_traits & FS_SRC_LUMINANCE) != 0; unsigned mask_luminance = (fs_traits & FS_MASK_LUMINANCE) != 0; unsigned dst_luminance = (fs_traits & FS_DST_LUMINANCE) != 0; + unsigned cur_sampler = 0; #if 0 print_fs_traits(fs_traits); @@ -474,15 +475,14 @@ create_fs(struct pipe_context *pipe, unsigned fs_traits) imm0 = ureg_imm4f(ureg, 0, 0, 0, 1); } if (is_composite) { - src_sampler = ureg_DECL_sampler(ureg, 0); + src_sampler = ureg_DECL_sampler(ureg, cur_sampler); + cur_sampler++; src_input = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_GENERIC, 0, TGSI_INTERPOLATE_PERSPECTIVE); } else if (is_fill) { if (is_solid) - src_input = ureg_DECL_fs_input(ureg, - TGSI_SEMANTIC_COLOR, 0, - TGSI_INTERPOLATE_PERSPECTIVE); + src_input = ureg_DECL_constant(ureg, 0); else src_input = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0, @@ -493,7 +493,8 @@ create_fs(struct pipe_context *pipe, unsigned fs_traits) } if (has_mask) { - mask_sampler = ureg_DECL_sampler(ureg, 1); + mask_sampler = ureg_DECL_sampler(ureg, cur_sampler); + cur_sampler++; mask_pos = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_GENERIC, 1, TGSI_INTERPOLATE_PERSPECTIVE); -- 1.8.3.2
>From d853f51f2a751a50d3e2bac5ceb4673435065510 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom <thellst...@vmware.com> Date: Thu, 17 Apr 2014 08:57:59 +0200 Subject: [PATCH 2/2] st/xa: Handle solid masks No component-alpha yet. Based on work by Rob Clark. Signed-off-by: Thomas Hellstrom <thellst...@vmware.com> --- src/gallium/state_trackers/xa/xa_composite.c | 76 ++++++++++++++++++++-------- src/gallium/state_trackers/xa/xa_priv.h | 8 +++ src/gallium/state_trackers/xa/xa_renderer.c | 2 +- src/gallium/state_trackers/xa/xa_tgsi.c | 37 ++++++++------ 4 files changed, 86 insertions(+), 37 deletions(-) diff --git a/src/gallium/state_trackers/xa/xa_composite.c b/src/gallium/state_trackers/xa/xa_composite.c index de57518..6083b71 100644 --- a/src/gallium/state_trackers/xa/xa_composite.c +++ b/src/gallium/state_trackers/xa/xa_composite.c @@ -218,6 +218,7 @@ xa_composite_check_accelerated(const struct xa_composite *comp) { struct xa_composite_blend blend; struct xa_picture *src_pic = comp->src; + struct xa_picture *mask_pic = comp->mask; if (!xa_is_filter_accelerated(src_pic) || !xa_is_filter_accelerated(comp->mask)) { @@ -225,11 +226,10 @@ xa_composite_check_accelerated(const struct xa_composite *comp) } - if (src_pic->src_pict && src_pic->src_pict->type != xa_src_pict_solid_fill) - return -XA_ERR_INVAL; + if (src_pic->src_pict && !xa_is_solid_fill(src_pic)) + return -XA_ERR_INVAL; - /* No solid masks for now. */ - if (comp->mask && comp->mask->src_pict) + if (mask_pic && mask_pic->src_pict && !xa_is_solid_fill(mask_pic)) return -XA_ERR_INVAL; if (blend_for_op(&blend, comp->op, comp->src, comp->mask, comp->dst)) { @@ -316,6 +316,23 @@ picture_format_fixups(struct xa_picture *src_pic, return ret; } +/** + * xa_src_in_mask - Compute a static src IN mask operation. + * + * @src: source value. Computed result is also returned here. + * @mask: mask value. + * + * TODO: Extend for component alpha. + */ +static void +xa_src_in_mask(float src[4], const float mask[4]) +{ + src[0] *= mask[3]; + src[1] *= mask[3]; + src[2] *= mask[3]; + src[3] *= mask[3]; +} + static int bind_shaders(struct xa_context *ctx, const struct xa_composite *comp) { @@ -325,13 +342,14 @@ bind_shaders(struct xa_context *ctx, const struct xa_composite *comp) struct xa_picture *mask_pic = comp->mask; ctx->has_solid_color = FALSE; + ctx->has_solid_mask = FALSE; if (src_pic) { if (src_pic->wrap == xa_wrap_clamp_to_border && src_pic->has_transform) fs_traits |= FS_SRC_REPEAT_NONE; if (src_pic->src_pict) { - if (src_pic->src_pict->type == xa_src_pict_solid_fill) { + if (xa_is_solid_fill(src_pic)) { fs_traits |= FS_SOLID_FILL; vs_traits |= VS_SOLID_FILL; xa_pixel_to_float4(src_pic->src_pict->solid_fill.color, @@ -347,21 +365,36 @@ bind_shaders(struct xa_context *ctx, const struct xa_composite *comp) } if (mask_pic) { - vs_traits |= VS_MASK; - fs_traits |= FS_MASK; - if (mask_pic->wrap == xa_wrap_clamp_to_border && - mask_pic->has_transform) - fs_traits |= FS_MASK_REPEAT_NONE; - - if (mask_pic->component_alpha) { - struct xa_composite_blend blend; - if (!blend_for_op(&blend, comp->op, src_pic, mask_pic, NULL)) - return -XA_ERR_INVAL; - - if (blend.alpha_src) { - fs_traits |= FS_CA_SRCALPHA; - } else - fs_traits |= FS_CA_FULL; + if (xa_is_solid_fill(mask_pic)) { + if (ctx->has_solid_color) { + float solid_mask[4]; + + xa_pixel_to_float4(mask_pic->src_pict->solid_fill.color, + solid_mask); + xa_src_in_mask(ctx->solid_color, solid_mask); + } else { + xa_pixel_to_float4(mask_pic->src_pict->solid_fill.color, + ctx->solid_color); + ctx->has_solid_mask = TRUE; + fs_traits |= FS_MASK | FS_SOLID_MASK; + } + } else { + vs_traits |= VS_MASK; + fs_traits |= FS_MASK; + if (mask_pic->wrap == xa_wrap_clamp_to_border && + mask_pic->has_transform) + fs_traits |= FS_MASK_REPEAT_NONE; + + if (mask_pic->component_alpha) { + struct xa_composite_blend blend; + if (!blend_for_op(&blend, comp->op, src_pic, mask_pic, NULL)) + return -XA_ERR_INVAL; + + if (blend.alpha_src) { + fs_traits |= FS_CA_SRCALPHA; + } else + fs_traits |= FS_CA_FULL; + } } fs_traits |= picture_format_fixups(mask_pic, 1); @@ -415,7 +448,7 @@ bind_samplers(struct xa_context *ctx, num_samplers++; } - if (mask_pic) { + if (mask_pic && !xa_is_solid_fill(mask_pic)) { unsigned mask_wrap = xa_repeat_to_gallium(mask_pic->wrap); int filter; @@ -509,6 +542,7 @@ xa_composite_done(struct xa_context *ctx) ctx->comp = NULL; ctx->has_solid_color = FALSE; + ctx->has_solid_mask = FALSE; xa_ctx_sampler_views_destroy(ctx); } diff --git a/src/gallium/state_trackers/xa/xa_priv.h b/src/gallium/state_trackers/xa/xa_priv.h index a4ef834..836f37b 100644 --- a/src/gallium/state_trackers/xa/xa_priv.h +++ b/src/gallium/state_trackers/xa/xa_priv.h @@ -115,6 +115,7 @@ struct xa_context { int simple_copy; int has_solid_color; + int has_solid_mask; float solid_color[4]; unsigned int num_bound_samplers; @@ -172,6 +173,7 @@ enum xa_fs_traits { FS_SRC_LUMINANCE = 1 << 14, FS_MASK_LUMINANCE = 1 << 15, FS_DST_LUMINANCE = 1 << 16, + FS_SOLID_MASK = 1 << 17, FS_FILL = (FS_SOLID_FILL | FS_LINGRAD_FILL | FS_RADGRAD_FILL), FS_COMPONENT_ALPHA = (FS_CA_FULL | FS_CA_SRCALPHA) @@ -221,6 +223,12 @@ xa_pixel_to_float4_a8(uint32_t pixel, float *color) color[3] = ((float)a) / 255.; } +static INLINE int +xa_is_solid_fill(const struct xa_picture *pic) +{ + return pic->src_pict && (pic->src_pict->type == xa_src_pict_solid_fill); +} + /* * xa_tgsi.c */ diff --git a/src/gallium/state_trackers/xa/xa_renderer.c b/src/gallium/state_trackers/xa/xa_renderer.c index eeeb431..8a39311 100644 --- a/src/gallium/state_trackers/xa/xa_renderer.c +++ b/src/gallium/state_trackers/xa/xa_renderer.c @@ -570,7 +570,7 @@ renderer_draw_flush(struct xa_context *r) void renderer_begin_textures(struct xa_context *r) { - if (r->has_solid_color) + if (r->has_solid_color || r->has_solid_mask) renderer_set_constants(r, PIPE_SHADER_FRAGMENT, r->solid_color, 4 * sizeof(float)); diff --git a/src/gallium/state_trackers/xa/xa_tgsi.c b/src/gallium/state_trackers/xa/xa_tgsi.c index 25701fa..1425dc3 100644 --- a/src/gallium/state_trackers/xa/xa_tgsi.c +++ b/src/gallium/state_trackers/xa/xa_tgsi.c @@ -452,6 +452,7 @@ create_fs(struct pipe_context *pipe, unsigned fs_traits) unsigned src_luminance = (fs_traits & FS_SRC_LUMINANCE) != 0; unsigned mask_luminance = (fs_traits & FS_MASK_LUMINANCE) != 0; unsigned dst_luminance = (fs_traits & FS_DST_LUMINANCE) != 0; + unsigned solid_mask = (fs_traits & FS_SOLID_MASK) != 0; unsigned cur_sampler = 0; #if 0 @@ -493,11 +494,15 @@ create_fs(struct pipe_context *pipe, unsigned fs_traits) } if (has_mask) { - mask_sampler = ureg_DECL_sampler(ureg, cur_sampler); - cur_sampler++; - mask_pos = ureg_DECL_fs_input(ureg, - TGSI_SEMANTIC_GENERIC, 1, - TGSI_INTERPOLATE_PERSPECTIVE); + if (!solid_mask) { + mask_sampler = ureg_DECL_sampler(ureg, cur_sampler); + cur_sampler++; + mask_pos = ureg_DECL_fs_input(ureg, + TGSI_SEMANTIC_GENERIC, 1, + TGSI_INTERPOLATE_PERSPECTIVE); + } else { + mask_pos = ureg_DECL_constant(ureg, 0); + } } #if 0 /* unused right now */ dst_sampler = ureg_DECL_sampler(ureg, 2); @@ -554,16 +559,18 @@ create_fs(struct pipe_context *pipe, unsigned fs_traits) } if (has_mask) { - mask = ureg_DECL_temporary(ureg); - xrender_tex(ureg, mask, mask_pos, mask_sampler, imm0, - mask_repeat_none, mask_swizzle, mask_set_alpha); - /* src IN mask */ - - src_in_mask(ureg, (dst_luminance) ? src : out, ureg_src(src), - ureg_src(mask), - comp_alpha_mask, mask_luminance); - - ureg_release_temporary(ureg, mask); + if (!solid_mask) { + mask = ureg_DECL_temporary(ureg); + xrender_tex(ureg, mask, mask_pos, mask_sampler, imm0, + mask_repeat_none, mask_swizzle, mask_set_alpha); + src_in_mask(ureg, (dst_luminance) ? src : out, ureg_src(src), + ureg_src(mask), comp_alpha_mask, mask_luminance); + + ureg_release_temporary(ureg, mask); + } else { + src_in_mask(ureg, (dst_luminance) ? src : out, ureg_src(src), + mask_pos, comp_alpha_mask, mask_luminance); + } } if (dst_luminance) { -- 1.8.3.2
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev