Mesa (master): svga: move comment, declaration in svga_init_shader_key_common()

Brian Paul brianp at kemper.freedesktop.org
Wed Jul 12 16:58:11 UTC 2017


Module: Mesa
Branch: master
Commit: f62bc96dd6d6e45680e6da51b920e161c4f3959a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f62bc96dd6d6e45680e6da51b920e161c4f3959a

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Jul 11 12:57:46 2017 -0600

svga: move comment, declaration in svga_init_shader_key_common()

put the comment before the relevant code.  Move declaration of
swizzle_tab var to where it's used.

Reviewed-by: Charmaine Lee <charmainel at vmware.com>

---

 src/gallium/drivers/svga/svga_shader.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_shader.c b/src/gallium/drivers/svga/svga_shader.c
index 5ff6f034cf..74c829eefc 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -192,7 +192,6 @@ svga_init_shader_key_common(const struct svga_context *svga,
                             struct svga_compile_key *key)
 {
    unsigned i, idx = 0;
-   const enum pipe_swizzle *swizzle_tab;
 
    assert(shader < ARRAY_SIZE(svga->curr.num_sampler_views));
 
@@ -224,16 +223,16 @@ svga_init_shader_key_common(const struct svga_context *svga,
             }
          }
 
-         swizzle_tab = (view->texture->target != PIPE_BUFFER &&
-                        !util_format_has_alpha(view->format) &&
-                        svga_texture_device_format_has_alpha(view->texture)) ?
-            set_alpha : copy_alpha;
-
          /* If we have a non-alpha view into an svga3d surface with an
           * alpha channel, then explicitly set the alpha channel to 1
           * when sampling. Note that we need to check the
           * actual device format to cover also imported surface cases.
           */
+         const enum pipe_swizzle *swizzle_tab =
+            (view->texture->target != PIPE_BUFFER &&
+             !util_format_has_alpha(view->format) &&
+             svga_texture_device_format_has_alpha(view->texture)) ?
+            set_alpha : copy_alpha;
 
          key->tex[i].swizzle_r = swizzle_tab[view->swizzle_r];
          key->tex[i].swizzle_g = swizzle_tab[view->swizzle_g];




More information about the mesa-commit mailing list