GPUState: Use state setters inside selection code
This fixes T79945 Gizmos don't work in Edit Mode
This commit is contained in:
parent
8228356f50
commit
5f414234dd
Notes:
blender-bot
2023-02-13 21:27:07 +01:00
Referenced by commit e26301f4d1
, Fix T79971 Regression: Transform Gizmos doesnt work anymore
Referenced by issue #80107, Inconsistency in selecting occluded objects with Box selection
Referenced by issue #79971, Regression: Transform Gizmos doesnt work anymore
Referenced by issue #79945, Gizmos don't work in Edit Mode
|
@ -27,6 +27,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "GPU_framebuffer.h"
|
||||
#include "GPU_glew.h"
|
||||
#include "GPU_immediate.h"
|
||||
#include "GPU_select.h"
|
||||
|
@ -317,12 +318,11 @@ void gpu_select_pick_begin(uint (*buffer)[4], uint bufsize, const rcti *input, c
|
|||
/* disable writing to the framebuffer */
|
||||
GPU_color_mask(false, false, false, false);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_TRUE);
|
||||
GPU_depth_mask(true);
|
||||
/* Always use #GL_LEQUAL even though GPU_SELECT_PICK_ALL always clears the buffer. This is
|
||||
* because individual objects themselves might have sections that overlap and we need these
|
||||
* to have the correct distance information. */
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
|
||||
float viewport[4];
|
||||
GPU_viewport_size_get_f(viewport);
|
||||
|
@ -339,7 +339,7 @@ void gpu_select_pick_begin(uint (*buffer)[4], uint bufsize, const rcti *input, c
|
|||
|
||||
/* It's possible we don't want to clear depth buffer,
|
||||
* so existing elements are masked by current z-buffer. */
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
GPU_clear(GPU_DEPTH_BIT);
|
||||
|
||||
/* scratch buffer (read new values here) */
|
||||
ps->gl.rect_depth_test = depth_buf_malloc(rect_len);
|
||||
|
@ -519,7 +519,7 @@ bool gpu_select_pick_load_id(uint id, bool end)
|
|||
|
||||
if (g_pick_state.mode == GPU_SELECT_PICK_ALL) {
|
||||
/* we want new depths every time */
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
GPU_clear(GPU_DEPTH_BIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "GPU_framebuffer.h"
|
||||
#include "GPU_glew.h"
|
||||
#include "GPU_select.h"
|
||||
#include "GPU_state.h"
|
||||
|
@ -112,20 +113,17 @@ void gpu_select_query_begin(
|
|||
if (mode == GPU_SELECT_ALL) {
|
||||
/* glQueries on Windows+Intel drivers only works with depth testing turned on.
|
||||
* See T62947 for details */
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
glDepthMask(GL_TRUE);
|
||||
GPU_depth_test(GPU_DEPTH_ALWAYS);
|
||||
GPU_depth_mask(true);
|
||||
}
|
||||
else if (mode == GPU_SELECT_NEAREST_FIRST_PASS) {
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_TRUE);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
GPU_clear(GPU_DEPTH_BIT);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
GPU_depth_mask(true);
|
||||
}
|
||||
else if (mode == GPU_SELECT_NEAREST_SECOND_PASS) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDepthFunc(GL_EQUAL);
|
||||
GPU_depth_test(GPU_DEPTH_EQUAL);
|
||||
GPU_depth_mask(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue