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-07-17 20:21:33 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-07-18 04:43:52 +0300
commit1f2edba1fbf39a40b07bdf37276d2650655a4edd (patch)
tree8a4421f5b3eeede0cc37cd1dde19d3c9983dfb45 /source/blender/gpu
parentd19b3019d9aee026b7aab738624795da162f6a8b (diff)
Cleanup: GPU: Encapsulate scissor test
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_state.h1
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.c2
-rw-r--r--source/blender/gpu/intern/gpu_state.c10
3 files changed, 12 insertions, 1 deletions
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);