diff options
Diffstat (limited to 'source/blender/gpu/opengl')
-rw-r--r-- | source/blender/gpu/opengl/gl_context.cc | 4 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_state.cc | 8 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_state.hh | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/gpu/opengl/gl_context.cc b/source/blender/gpu/opengl/gl_context.cc index dd413612879..168799fb3d6 100644 --- a/source/blender/gpu/opengl/gl_context.cc +++ b/source/blender/gpu/opengl/gl_context.cc @@ -30,6 +30,8 @@ #include "gpu_context_private.hh" +#include "gl_state.hh" + #include "gl_backend.hh" /* TODO remove */ #include "gl_context.hh" @@ -54,6 +56,8 @@ GLContext::GLContext(void *ghost_window, GLSharedOrphanLists &shared_orphan_list glBindBuffer(GL_ARRAY_BUFFER, default_attr_vbo_); glBufferData(GL_ARRAY_BUFFER, sizeof(data), data, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); + + state_stack = new GLStateStack(); } GLContext::~GLContext() diff --git a/source/blender/gpu/opengl/gl_state.cc b/source/blender/gpu/opengl/gl_state.cc index c64e4471087..32bc66c4dda 100644 --- a/source/blender/gpu/opengl/gl_state.cc +++ b/source/blender/gpu/opengl/gl_state.cc @@ -41,6 +41,9 @@ void GLStateStack::set_state(GPUState &state) { GPUState changed = state ^ current_; + if (changed.blend != 0) { + set_blend(state.blend); + } if (changed.write_mask != 0) { set_write_mask(state.write_mask); } @@ -101,10 +104,7 @@ void GLStateStack::set_mutable_state(GPUStateMutable &state) (changed.scissor_rect[2] != 0) || (changed.scissor_rect[3] != 0)) { glScissor(UNPACK4(state.scissor_rect)); - if ((state.scissor_rect[0] != state.viewport_rect[0]) || - (state.scissor_rect[1] != state.viewport_rect[1]) || - (state.scissor_rect[2] != state.viewport_rect[2]) || - (state.scissor_rect[3] != state.viewport_rect[3])) { + if ((state.scissor_rect[2] > 0)) { glEnable(GL_SCISSOR_TEST); } else { diff --git a/source/blender/gpu/opengl/gl_state.hh b/source/blender/gpu/opengl/gl_state.hh index ea3ab512431..577e8f9eb1c 100644 --- a/source/blender/gpu/opengl/gl_state.hh +++ b/source/blender/gpu/opengl/gl_state.hh @@ -20,6 +20,8 @@ * \ingroup gpu */ +#include "MEM_guardedalloc.h" + #include "BLI_utildefines.h" #include "gpu_state_private.hh" @@ -52,6 +54,8 @@ class GLStateStack : public GPUStateStack { static void set_provoking_vert(const eGPUProvokingVertex vert); static void set_shadow_bias(const bool enable); static void set_blend(const eGPUBlend value); + + MEM_CXX_CLASS_ALLOC_FUNCS("GLStateStack") }; } // namespace gpu |