turnip: fix off-by-one in border color bitset

BITSET_FFS reserves 0 for no bit set.  BITSET_CLEAR just below cleared
the wrong bit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16567>
This commit is contained in:
Chia-I Wu 2022-05-17 15:49:03 -07:00 committed by Marge Bot
parent b8799a499e
commit 2410993ef6
1 changed files with 2 additions and 1 deletions

View File

@ -2611,7 +2611,8 @@ tu_init_sampler(struct tu_device *device,
if (pCreateInfo->borderColor == VK_BORDER_COLOR_FLOAT_CUSTOM_EXT ||
pCreateInfo->borderColor == VK_BORDER_COLOR_INT_CUSTOM_EXT) {
mtx_lock(&device->mutex);
border_color = BITSET_FFS(device->custom_border_color);
border_color = BITSET_FFS(device->custom_border_color) - 1;
assert(border_color < TU_BORDER_COLOR_COUNT);
BITSET_CLEAR(device->custom_border_color, border_color);
mtx_unlock(&device->mutex);
tu6_pack_border_color(device->global_bo->map + gb_offset(bcolor[border_color]),