summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_shader.c
diff options
context:
space:
mode:
authorThomas Hellstrom <[email protected]>2017-05-30 15:51:06 +0200
committerThomas Hellstrom <[email protected]>2017-06-07 19:43:54 +0200
commitdf4d6003dc75395f8ded57fdf59046f0d008eea3 (patch)
tree51a33d450ef26838b0352defdce6bf1938a4dc08 /src/gallium/drivers/svga/svga_shader.c
parentc2138a066cf75491e45df53cd799feb23027dae0 (diff)
svga: Fix imported surface view creation
When deciding to create a view with or without an alpha channel we need to look at the SVGA3D format and not the PIPE format. This fixes the glx-tfp piglit test for dri3/xa. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_shader.c')
-rw-r--r--src/gallium/drivers/svga/svga_shader.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/gallium/drivers/svga/svga_shader.c b/src/gallium/drivers/svga/svga_shader.c
index 669672de643..795531773bf 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -215,7 +215,6 @@ svga_init_shader_key_common(const struct svga_context *svga,
key->tex[i].swizzle_r = view->swizzle_r;
key->tex[i].swizzle_g = view->swizzle_g;
key->tex[i].swizzle_b = view->swizzle_b;
- key->tex[i].swizzle_a = view->swizzle_a;
/* If we have a non-alpha view into an svga3d surface with an
* alpha channel, then explicitly set the alpha channel to 1
@@ -223,13 +222,11 @@ svga_init_shader_key_common(const struct svga_context *svga,
* in the svga texture key, since the imported format is
* stored here and it may differ from the gallium format.
*/
- if (!util_format_has_alpha(view->format)) {
- enum svga3d_block_desc block_desc =
- svga3dsurface_get_desc(svga_texture(view->texture)->key.format)->
- block_desc;
-
- if (block_desc & SVGA3DBLOCKDESC_ALPHA)
- key->tex[i].swizzle_a = PIPE_SWIZZLE_1;
+ if (!util_format_has_alpha(view->format) &&
+ svga_texture_device_format_has_alpha(view->texture)) {
+ key->tex[i].swizzle_a = PIPE_SWIZZLE_1;
+ } else {
+ key->tex[i].swizzle_a = view->swizzle_a;
}
}
}