st/xa: Fix format conversion copy alpha channel

When doing format conversion copies between a format without an
alpha channel and a format with an alpha channel, make sure the
destination alpha is set to 1.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
This commit is contained in:
Thomas Hellstrom 2011-12-14 16:02:54 +01:00
parent 11c9459ba0
commit aa7d7656f5
3 changed files with 13 additions and 3 deletions

View File

@ -220,7 +220,9 @@ xa_copy_prepare(struct xa_context *ctx,
int ret = xa_ctx_srf_create(ctx, dst);
if (ret != XA_ERR_NONE)
return ret;
renderer_copy_prepare(ctx, ctx->srf, src->tex);
renderer_copy_prepare(ctx, ctx->srf, src->tex,
src->fdesc.xa_format,
dst->fdesc.xa_format);
ctx->simple_copy = 0;
} else
ctx->simple_copy = 1;

View File

@ -237,7 +237,10 @@ void renderer_bind_destination(struct xa_context *r,
void renderer_init_state(struct xa_context *r);
void renderer_copy_prepare(struct xa_context *r,
struct pipe_surface *dst_surface,
struct pipe_resource *src_texture);
struct pipe_resource *src_texture,
const enum xa_formats src_xa_format,
const enum xa_formats dst_xa_format);
void renderer_copy(struct xa_context *r, int dx,
int dy,
int sx,

View File

@ -413,7 +413,9 @@ renderer_set_constants(struct xa_context *r,
void
renderer_copy_prepare(struct xa_context *r,
struct pipe_surface *dst_surface,
struct pipe_resource *src_texture)
struct pipe_resource *src_texture,
const enum xa_formats src_xa_format,
const enum xa_formats dst_xa_format)
{
struct pipe_context *pipe = r->pipe;
struct pipe_screen *screen = pipe->screen;
@ -474,6 +476,9 @@ renderer_copy_prepare(struct xa_context *r,
fs_traits |= FS_SRC_LUMINANCE;
if (dst_surface->format == PIPE_FORMAT_L8_UNORM)
fs_traits |= FS_DST_LUMINANCE;
if (xa_format_a(dst_xa_format) != 0 &&
xa_format_a(src_xa_format) == 0)
fs_traits |= FS_SRC_SET_ALPHA;
shader = xa_shaders_get(r->shaders, VS_COMPOSITE, fs_traits);
cso_set_vertex_shader_handle(r->cso, shader.vs);