From 15eec7f8b985852219e842ef434f80b6cf9ed165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Thu, 5 Nov 2020 14:12:02 +0100 Subject: Fix T80842 Grease Pencil: Subtract mode is not working as expected The blend equation was not set correctly inside the GL Module since the refactor. --- source/blender/gpu/opengl/gl_state.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/gpu') diff --git a/source/blender/gpu/opengl/gl_state.cc b/source/blender/gpu/opengl/gl_state.cc index 3a474da8b8e..5483f889a8a 100644 --- a/source/blender/gpu/opengl/gl_state.cc +++ b/source/blender/gpu/opengl/gl_state.cc @@ -437,6 +437,13 @@ void GLStateManager::set_blend(const eGPUBlend value) } } + if (value == GPU_BLEND_SUBTRACT) { + glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); + } + else { + glBlendEquation(GL_FUNC_ADD); + } + /* Always set the blend function. This avoid a rendering error when blending is disabled but * GPU_BLEND_CUSTOM was used just before and the frame-buffer is using more than 1 color target. */ -- cgit v1.2.3 From c3e832144b0d22e3da883330212247808a9db2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Thu, 5 Nov 2020 17:59:07 +0100 Subject: GPU: Fix valgrind warnings about branching on uninitialized variables --- source/blender/gpu/intern/gpu_framebuffer_private.hh | 6 +++--- source/blender/gpu/intern/gpu_immediate_private.hh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/gpu') diff --git a/source/blender/gpu/intern/gpu_framebuffer_private.hh b/source/blender/gpu/intern/gpu_framebuffer_private.hh index 87f0f3823e6..7afa56bfe3d 100644 --- a/source/blender/gpu/intern/gpu_framebuffer_private.hh +++ b/source/blender/gpu/intern/gpu_framebuffer_private.hh @@ -100,10 +100,10 @@ class FrameBuffer { /** Debug name. */ char name_[DEBUG_NAME_LEN]; /** Frame-buffer state. */ - int viewport_[4]; - int scissor_[4]; + int viewport_[4] = {0}; + int scissor_[4] = {0}; bool scissor_test_ = false; - bool dirty_state_; + bool dirty_state_ = true; public: FrameBuffer(const char *name); diff --git a/source/blender/gpu/intern/gpu_immediate_private.hh b/source/blender/gpu/intern/gpu_immediate_private.hh index e6c11120d7e..9fcbe2bdc0b 100644 --- a/source/blender/gpu/intern/gpu_immediate_private.hh +++ b/source/blender/gpu/intern/gpu_immediate_private.hh @@ -47,7 +47,7 @@ class Immediate { /** Current draw call specification. */ GPUPrimType prim_type = GPU_PRIM_NONE; - GPUVertFormat vertex_format; + GPUVertFormat vertex_format = {}; GPUShader *shader = NULL; /** Enforce strict vertex count (disabled when using immBeginAtMost). */ bool strict_vertex_len = true; -- cgit v1.2.3