diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-29 16:17:13 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-30 14:11:03 +0300 |
commit | 8527d84d3588563123bfad7ccbdeeff62ee90bdb (patch) | |
tree | 51ccbaa3c129c62a54af5aed43b55b9c89b901e6 /source/blender/gpu/opengl/gl_state.hh | |
parent | 4f395c84fe9f05b59b81be36b464521bcf92331e (diff) |
GPUState: Move Scissor and Viewport state to framebuffer
This way it is way clearer what each viewport state is. There is
no more save and reset. The scissor test is also saved per
framebuffer.
The only rule to remember is that the viewport state (size and
origin) is reset for both the viewport and scissor when a texture
is attached or detached from an attachment slot.
Diffstat (limited to 'source/blender/gpu/opengl/gl_state.hh')
-rw-r--r-- | source/blender/gpu/opengl/gl_state.hh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/gpu/opengl/gl_state.hh b/source/blender/gpu/opengl/gl_state.hh index 8e806cb3e7a..c25e384fcd7 100644 --- a/source/blender/gpu/opengl/gl_state.hh +++ b/source/blender/gpu/opengl/gl_state.hh @@ -31,11 +31,17 @@ namespace blender { namespace gpu { +class GLFrameBuffer; + /** * State manager keeping track of the draw state and applying it before drawing. * Opengl Implementation. **/ class GLStateManager : public GPUStateManager { + public: + /** Anothter reference to tje active framebuffer. */ + GLFrameBuffer *active_fb; + private: /** Current state of the GL implementation. Avoids resetting the whole state for every change. */ GPUState current_; @@ -46,8 +52,7 @@ class GLStateManager : public GPUStateManager { public: GLStateManager(); - void set_state(const GPUState &state) override; - void set_mutable_state(const GPUStateMutable &state) override; + void apply_state(void) override; private: static void set_write_mask(const eGPUWriteMask value); @@ -62,6 +67,9 @@ class GLStateManager : public GPUStateManager { static void set_shadow_bias(const bool enable); static void set_blend(const eGPUBlend value); + void set_state(const GPUState &state); + void set_mutable_state(const GPUStateMutable &state); + MEM_CXX_CLASS_ALLOC_FUNCS("GLStateManager") }; |