summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorThomas Hellstrom <[email protected]>2011-12-14 16:02:54 +0100
committerThomas Hellstrom <[email protected]>2011-12-15 08:28:09 +0100
commitaa7d7656f50f5c49734e3b0fad0f20a89cd5eb5b (patch)
tree250d503f83275c1243819733408d80364983072d /src/gallium
parent11c9459ba0b0c0afa1ae0ea41b0edaf069fc421a (diff)
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 <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/xa/xa_context.c4
-rw-r--r--src/gallium/state_trackers/xa/xa_priv.h5
-rw-r--r--src/gallium/state_trackers/xa/xa_renderer.c7
3 files changed, 13 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c
index 8290e0fa8b3..8da7c31cf48 100644
--- a/src/gallium/state_trackers/xa/xa_context.c
+++ b/src/gallium/state_trackers/xa/xa_context.c
@@ -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;
diff --git a/src/gallium/state_trackers/xa/xa_priv.h b/src/gallium/state_trackers/xa/xa_priv.h
index d00114f99b5..de4639a41a8 100644
--- a/src/gallium/state_trackers/xa/xa_priv.h
+++ b/src/gallium/state_trackers/xa/xa_priv.h
@@ -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,
diff --git a/src/gallium/state_trackers/xa/xa_renderer.c b/src/gallium/state_trackers/xa/xa_renderer.c
index ef762f0ab49..5496fc04bfe 100644
--- a/src/gallium/state_trackers/xa/xa_renderer.c
+++ b/src/gallium/state_trackers/xa/xa_renderer.c
@@ -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);