summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-11-23 22:39:31 +0800
committerChia-I Wu <olv@lunarg.com>2010-12-01 11:23:51 +0800
commitd873f1f5b63e7243c20751e92389e4189d39fd42 (patch)
tree674424e26c148cbb7346fb6f3fec049caa892d65
parent56f02cedfaca9755d2855ec3fe075ccfe5e85c0a (diff)
downloadexternal_mesa3d-d873f1f5b63e7243c20751e92389e4189d39fd42.zip
external_mesa3d-d873f1f5b63e7243c20751e92389e4189d39fd42.tar.gz
external_mesa3d-d873f1f5b63e7243c20751e92389e4189d39fd42.tar.bz2
st/vega: Fix image sampler views for alpha-only formats.
For alpha-only VG formats, R = G = B = 1.0.
-rw-r--r--src/gallium/state_trackers/vega/image.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c
index 303e979..c5421f8 100644
--- a/src/gallium/state_trackers/vega/image.c
+++ b/src/gallium/state_trackers/vega/image.c
@@ -272,6 +272,13 @@ struct vg_image * image_create(VGImageFormat format,
debug_assert(newtex);
u_sampler_view_default_template(&view_templ, newtex, newtex->format);
+ /* R, G, and B are treated as 1.0 for alpha-only formats in OpenVG */
+ if (newtex->format == PIPE_FORMAT_A8_UNORM) {
+ view_templ.swizzle_r = PIPE_SWIZZLE_ONE;
+ view_templ.swizzle_g = PIPE_SWIZZLE_ONE;
+ view_templ.swizzle_b = PIPE_SWIZZLE_ONE;
+ }
+
view = pipe->create_sampler_view(pipe, newtex, &view_templ);
/* want the texture to go away if the view is freed */
pipe_resource_reference(&newtex, NULL);