svga: Adjust alpha for S3TC_DXT1_EXT RGB formats
authorNeha Bhende <bhenden@vmware.com>
Mon, 29 Jan 2018 16:32:19 +0000 (09:32 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 30 Jan 2018 04:04:49 +0000 (21:04 -0700)
According to spec, S3TC_DXT1_EXT RGB formats are supposed to be
opaque. Correspoding svga formats are not handling it so explicitly
setting it to 1.0.
This fixes piglit test spec@ext_texture_compression_s3tc@s3tc-targeted
Note: This test is testcase for freedesktop bug 100925

Tested with mtt-piglit and mtt-glretrace on 8,9,10,11 and 15

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/drivers/svga/svga_shader.c

index 9e2b65771cd2dfefa790f7d273ba231061617a2f..c9cc0f739a3b21679c17082ab74b115fbdc67fcb 100644 (file)
@@ -234,6 +234,10 @@ svga_init_shader_key_common(const struct svga_context *svga,
              svga_texture_device_format_has_alpha(view->texture)) ?
             set_alpha : copy_alpha;
 
+         if (view->texture->format == PIPE_FORMAT_DXT1_RGB ||
+             view->texture->format == PIPE_FORMAT_DXT1_SRGB)
+            swizzle_tab = set_alpha;
+
          key->tex[i].swizzle_r = swizzle_tab[view->swizzle_r];
          key->tex[i].swizzle_g = swizzle_tab[view->swizzle_g];
          key->tex[i].swizzle_b = swizzle_tab[view->swizzle_b];