GPUSelect: Avoid assert caused by clearing without a depth mask

This should not cause any problem since the depth test is required
in order to draw to the depth buffer and this is not altered by
this change.

To be on the safe side, we still restor the mask after altering it.
This commit is contained in:
Clément Foucault 2020-08-25 12:15:15 +02:00
parent 5f86a10477
commit e51c428be6
Notes: blender-bot 2023-02-14 05:59:31 +01:00
Referenced by issue #80094, Various Asserts during selection
1 changed files with 5 additions and 0 deletions

View File

@ -518,8 +518,13 @@ bool gpu_select_pick_load_id(uint id, bool end)
SWAP(DepthBufCache *, ps->gl.rect_depth, ps->gl.rect_depth_test);
if (g_pick_state.mode == GPU_SELECT_PICK_ALL) {
/* (fclem) This is to be on the safe side. I don't know if this is required. */
bool prev_depth_mask = GPU_depth_mask_get();
/* we want new depths every time */
GPU_depth_mask(true);
GPU_clear_depth(1.0f);
GPU_depth_mask(prev_depth_mask);
}
}
}