From 1f2edba1fbf39a40b07bdf37276d2650655a4edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 17 Jul 2020 19:21:33 +0200 Subject: Cleanup: GPU: Encapsulate scissor test --- source/blender/gpu/GPU_state.h | 1 + source/blender/gpu/intern/gpu_framebuffer.c | 2 +- source/blender/gpu/intern/gpu_state.c | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'source/blender/gpu') 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); -- cgit v1.2.3