Skip to content

svga: fix bitwise/logical and mixup

Thomas Andersen requested to merge phomes/mesa:svga-bitwise-and-fix into main

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)) ...

indirect_files is a bitmask of enum tgsi_file_type. The 0 value of that enum is TGSI_FILE_NULL.

Due to using a logical && and the right side being a constant means that it will only ever return true in the case that indirect_files is TGSI_FILE_NULL.

The result is that the intended initialization 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: ba37d408 ("svga: Performance fixes")

Merge request reports