Fix #131285: Selecting Empty Space With Select Box Tool Selects Objects

The clearing logic depended on an uninitialized value.
This commit is contained in:
Clément Foucault
2024-12-04 19:15:04 +01:00
parent c255178cc5
commit ddf3a59de5

View File

@@ -218,14 +218,6 @@ struct SelectMap {
select_output_buf.resize(max_uu(ceil_to_multiple_u(select_id_map.size(), 4), 4));
select_output_buf.push_update();
if (info_buf.mode == SelectType::SELECT_ALL) {
/* This mode uses atomicOr and store result as a bitmap. Clear to 0 (no selection). */
GPU_storagebuf_clear(select_output_buf, 0);
}
else {
/* Other modes use atomicMin. Clear to UINT_MAX. */
GPU_storagebuf_clear(select_output_buf, 0xFFFFFFFFu);
}
}
void pre_draw()
@@ -243,6 +235,8 @@ struct SelectMap {
info_buf.mode = SelectType::SELECT_ALL;
info_buf.cursor = int2(0);
disable_depth_test = true;
/* This mode uses atomicOr and store result as a bitmap. Clear to 0 (no selection). */
GPU_storagebuf_clear(select_output_buf, 0);
break;
/* Not sure if these 2 NEAREST are mapped to the right algorithm. */
case GPU_SELECT_NEAREST_FIRST_PASS:
@@ -251,11 +245,15 @@ struct SelectMap {
info_buf.mode = SelectType::SELECT_PICK_ALL;
info_buf.cursor = int2(gpu_select_next_get_pick_area_center());
disable_depth_test = true;
/* Mode uses atomicMin. Clear to UINT_MAX. */
GPU_storagebuf_clear(select_output_buf, 0xFFFFFFFFu);
break;
case GPU_SELECT_PICK_NEAREST:
info_buf.mode = SelectType::SELECT_PICK_NEAREST;
info_buf.cursor = int2(gpu_select_next_get_pick_area_center());
disable_depth_test = true;
/* Mode uses atomicMin. Clear to UINT_MAX. */
GPU_storagebuf_clear(select_output_buf, 0xFFFFFFFFu);
break;
}
info_buf.push_update();