Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-08-17 00:20:59 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-18 22:30:10 +0300
commitd10f000322914edf83ace36ee2abb2479c2b533b (patch)
treeb33d453cf2e1c5364cea88998103a7008ab31763 /source/blender/gpu/intern/gpu_select_pick.c
parentf30df15edc0b5bfce98809cfa8c2ca96cfe03e97 (diff)
GPUState: Remove gpuPushAttr/gpuPopAttr
And use manual save/restore mechanism. The stack method is not used so much to be considered useful.
Diffstat (limited to 'source/blender/gpu/intern/gpu_select_pick.c')
-rw-r--r--source/blender/gpu/intern/gpu_select_pick.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c
index 0f6f29fab40..29e2615345c 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -282,6 +282,12 @@ typedef struct GPUPickState {
uint *rect_id;
} nearest;
};
+
+ /* Previous state to restore after drawing. */
+ int viewport[4];
+ int scissor[4];
+ eGPUWriteMask write_mask;
+ bool depth_test;
} GPUPickState;
static GPUPickState g_pick_state = {0};
@@ -304,7 +310,9 @@ void gpu_select_pick_begin(uint (*buffer)[4], uint bufsize, const rcti *input, c
/* Restrict OpenGL operations for when we don't have cache */
if (ps->is_cached == false) {
- gpuPushAttr(GPU_DEPTH_BUFFER_BIT | GPU_VIEWPORT_BIT);
+ ps->write_mask = GPU_write_mask_get();
+ ps->depth_test = GPU_depth_test_enabled();
+ GPU_scissor_get(ps->scissor);
/* disable writing to the framebuffer */
GPU_color_mask(false, false, false, false);
@@ -535,8 +543,9 @@ uint gpu_select_pick_end(void)
/* force finishing last pass */
gpu_select_pick_load_id(ps->gl.prev_id, true);
}
- gpuPopAttr();
- GPU_color_mask(true, true, true, true);
+ GPU_write_mask(ps->write_mask);
+ GPU_depth_test(ps->depth_test);
+ GPU_viewport(UNPACK4(ps->viewport));
}
/* assign but never free directly since it may be in cache */