mesa: avoid valgrind warning due to opaque only being set sometimes
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 8 Jul 2016 05:35:15 +0000 (01:35 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Fri, 19 Aug 2016 02:48:55 +0000 (22:48 -0400)
Valgrind complains with a "Conditional jump or move depends on
uninitialised value(s)" warning due to opaque being conditionally
initialized. However in the punchthrough_alpha == true case, it is
always initialized, so just flip the condition around to silence the
warning.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/mesa/main/texcompress_etc.c

index f29561cc61ad40df3522214902b885b2644d0e50..d4650109857171d6c114ca05fd3370d513b27227 100644 (file)
@@ -458,10 +458,10 @@ etc2_rgb8_parse_block(struct etc2_block *block,
       /* Use same modifier tables as for etc1 textures if opaque bit is set
        * or if non punchthrough texture format
        */
-      block->modifier_tables[0] = (block->opaque || !punchthrough_alpha) ?
+      block->modifier_tables[0] = (!punchthrough_alpha || block->opaque) ?
                                   etc1_modifier_tables[table1_idx] :
                                   etc2_modifier_tables_non_opaque[table1_idx];
-      block->modifier_tables[1] = (block->opaque || !punchthrough_alpha) ?
+      block->modifier_tables[1] = (!punchthrough_alpha || block->opaque) ?
                                   etc1_modifier_tables[table2_idx] :
                                   etc2_modifier_tables_non_opaque[table2_idx];