svga: fix bitwise/logical and mixup
authorThomas H.P. Andersen <phomes@gmail.com>
Sun, 1 Aug 2021 10:52:56 +0000 (12:52 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 24 Nov 2021 01:59:36 +0000 (01:59 +0000)
The function need_temp_reg_initialization looks suspecious.

It will only ever return true if we get past this if:
if (!(emit->info.indirect_files && (1u << TGSI_FILE_TEMPORARY)) ...

Using the logical && means the intended initialization done
based on the result of this check is not performed.

This code was both introduced and altered in MR 5317.
ccb4ea5a introduces the function.
ba37d408 is a collection of performance improvements and misc
fixes. This altered the if from using bitwise to logical and.

This commit changes it back to bitwise.

Spotted from a compile warning.

Fixes: ba37d408da3 ("svga: Performance fixes")

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12157>

src/gallium/drivers/svga/svga_tgsi_vgpu10.c

index 8989a57..a9435a0 100644 (file)
@@ -1450,7 +1450,7 @@ static boolean
 need_temp_reg_initialization(struct svga_shader_emitter_v10 *emit,
                              unsigned index)
 {
-   if (!(emit->info.indirect_files && (1u << TGSI_FILE_TEMPORARY))
+   if (!(emit->info.indirect_files & (1u << TGSI_FILE_TEMPORARY))
        && emit->current_loop_depth == 0) {
       if (!emit->temp_map[index].initialized &&
           emit->temp_map[index].index < emit->num_shader_temps) {