i965/vs: Fix flaky texture swizzling
authorChris Forbes <chrisf@ijw.co.nz>
Tue, 23 Jul 2013 19:21:22 +0000 (07:21 +1200)
committerChris Forbes <chrisf@ijw.co.nz>
Fri, 26 Jul 2013 18:34:29 +0000 (06:34 +1200)
If any component used the ZERO or ONE swizzle, its corresponding member
in the `swizzle` array would never be initialized. We *mostly* got away
with this, except when that memory happened to contain a value that
clobbered another channel when combined using BRW_SWIZZLE4().

NOTE: This is a candidate for stable branches.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index 3eb43a877504bfdab91806254042fd3d0e7c3016..1d86b33e8e894bd04b99ab767b1bf7cac29eef90 100644 (file)
@@ -2506,7 +2506,7 @@ vec4_visitor::swizzle_result(ir_texture *ir, src_reg orig_val, int sampler)
    }
 
    int zero_mask = 0, one_mask = 0, copy_mask = 0;
-   int swizzle[4];
+   int swizzle[4] = {0};
 
    for (int i = 0; i < 4; i++) {
       switch (GET_SWZ(s, i)) {