diff options
-rw-r--r-- | source/blender/editors/screen/screen_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 3 | ||||
-rw-r--r-- | source/blender/gpu/GPU_state.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_state.c | 10 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 8 |
6 files changed, 19 insertions, 9 deletions
diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 3700deb8d77..1608e842376 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -404,7 +404,7 @@ void ED_screen_draw_edges(wmWindow *win) /* It seems that all areas gets smaller when pixelsize is > 1. * So in order to avoid missing pixels we just disable de scissors. */ if (U.pixelsize <= 1.0f) { - glEnable(GL_SCISSOR_TEST); + GPU_scissor_test(true); } UI_GetThemeColor4fv(TH_EDITOR_OUTLINE, col); @@ -429,7 +429,7 @@ void ED_screen_draw_edges(wmWindow *win) GPU_blend(false); if (U.pixelsize <= 1.0f) { - glDisable(GL_SCISSOR_TEST); + GPU_scissor_test(false); } } diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 6b32d879c8d..d0082769575 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -615,8 +615,7 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups, if (load_tex(brush, vc, zoom, col, primary)) { GPU_color_mask(true, true, true, true); - GPU_depth_mask(false); - glDepthFunc(GL_ALWAYS); + GPU_depth_test(false); if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) { GPU_matrix_push(); diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h index 4aa88d2e037..e6b002f211c 100644 --- a/source/blender/gpu/GPU_state.h +++ b/source/blender/gpu/GPU_state.h @@ -55,6 +55,7 @@ void GPU_blend_set_func_separate(eGPUBlendFunction src_rgb, void GPU_depth_range(float near, float far); void GPU_depth_test(bool enable); bool GPU_depth_test_enabled(void); +void GPU_scissor_test(bool enable); void GPU_line_smooth(bool enable); void GPU_line_width(float width); void GPU_point_size(float size); diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index 40c1e6f59b2..c079864126e 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -979,10 +979,10 @@ void GPU_offscreen_bind(GPUOffScreen *ofs, bool save) GPUFrameBuffer *fb = GPU_framebuffer_active_get(); gpuPushFrameBuffer(fb); } - glDisable(GL_SCISSOR_TEST); GPUFrameBuffer *ofs_fb = gpu_offscreen_fb_get(ofs); GPU_framebuffer_bind(ofs_fb); glDisable(GL_FRAMEBUFFER_SRGB); + GPU_scissor_test(false); GPU_shader_set_framebuffer_srgb_target(false); } diff --git a/source/blender/gpu/intern/gpu_state.c b/source/blender/gpu/intern/gpu_state.c index 1e79212fc4e..a339cfb8b5a 100644 --- a/source/blender/gpu/intern/gpu_state.c +++ b/source/blender/gpu/intern/gpu_state.c @@ -146,6 +146,16 @@ void GPU_program_point_size(bool enable) } } +void GPU_scissor_test(bool enable) +{ + if (enable) { + glEnable(GL_SCISSOR_TEST); + } + else { + glDisable(GL_SCISSOR_TEST); + } +} + void GPU_scissor(int x, int y, int width, int height) { glScissor(x, y, width, height); diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index fa335501d60..f6fc97f602b 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -106,7 +106,7 @@ static void wm_paintcursor_draw(bContext *C, ScrArea *area, ARegion *region) if (pc->poll == NULL || pc->poll(C)) { /* Prevent drawing outside region. */ - glEnable(GL_SCISSOR_TEST); + GPU_scissor_test(true); GPU_scissor(region->winrct.xmin, region->winrct.ymin, BLI_rcti_size_x(®ion->winrct) + 1, @@ -121,7 +121,7 @@ static void wm_paintcursor_draw(bContext *C, ScrArea *area, ARegion *region) pc->draw(C, win->eventstate->x, win->eventstate->y, pc->customdata); } - glDisable(GL_SCISSOR_TEST); + GPU_scissor_test(false); } } } @@ -461,7 +461,7 @@ static void wm_draw_region_bind(ARegion *region, int view) /* For now scissor is expected by region drawing, we could disable it * and do the enable/disable in the specific cases that setup scissor. */ - glEnable(GL_SCISSOR_TEST); + GPU_scissor_test(true); GPU_scissor(0, 0, region->winx, region->winy); } @@ -480,7 +480,7 @@ static void wm_draw_region_unbind(ARegion *region) GPU_viewport_unbind(region->draw_buffer->viewport); } else { - glDisable(GL_SCISSOR_TEST); + GPU_scissor_test(false); GPU_offscreen_unbind(region->draw_buffer->offscreen, false); } } |