From 4ca624f8e09bff1a4f681c54486e327605b8274d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 30 Dec 2011 10:52:16 +0000 Subject: u_format: fix inv_swizzles generation inv_swizzles is used in lp_tile_soa.py to create lp_tile_soa.c, we overwrite swizzles if they are already set. This results in the i8 format getting alpha instead of red, and the l8 format getting blue instead of red. Fixes fbo-alphatest-formats, fbo-alphatest-formats ARB_texture_float, and fbo-alphatest-formats EXT_texture_snorm on llvmpipe. Signed-off-by: Dave Airlie --- src/gallium/auxiliary/util/u_format_parse.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py index 73a4bcb2100..3a39e5ba524 100755 --- a/src/gallium/auxiliary/util/u_format_parse.py +++ b/src/gallium/auxiliary/util/u_format_parse.py @@ -196,10 +196,11 @@ class Format: def inv_swizzles(self): '''Return an array[4] of inverse swizzle terms''' + '''Only pick the first matching value to avoid l8 getting blue and i8 getting alpha''' inv_swizzle = [None]*4 for i in range(4): swizzle = self.swizzles[i] - if swizzle < 4: + if swizzle < 4 and inv_swizzle[swizzle] == None: inv_swizzle[swizzle] = i return inv_swizzle -- cgit v1.2.3