diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-17 01:34:06 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-18 22:30:10 +0300 |
commit | 482a51aabf596ca1f279ab3b7cb3170c867b4a42 (patch) | |
tree | 67a240114877d3b01f9aba3e0d33cf0c7364ba88 /source/blender/gpu/intern/gpu_state_private.hh | |
parent | d10f000322914edf83ace36ee2abb2479c2b533b (diff) |
Cleanup: GPUState: Remove stack from the state manager and rename it
Diffstat (limited to 'source/blender/gpu/intern/gpu_state_private.hh')
-rw-r--r-- | source/blender/gpu/intern/gpu_state_private.hh | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/source/blender/gpu/intern/gpu_state_private.hh b/source/blender/gpu/intern/gpu_state_private.hh index 31840724ec0..4326c3a73e5 100644 --- a/source/blender/gpu/intern/gpu_state_private.hh +++ b/source/blender/gpu/intern/gpu_state_private.hh @@ -79,6 +79,8 @@ inline GPUState operator^(const GPUState &a, const GPUState &b) /* Mutable state that does not require pipeline change. */ union GPUStateMutable { struct { + /* Viewport State */ + /** TODO put inside GPUFramebuffer. */ /** Offset + Extent of the drawable region inside the framebuffer. */ int viewport_rect[4]; /** Offset + Extent of the scissor region inside the framebuffer. */ @@ -126,41 +128,17 @@ inline GPUStateMutable operator^(const GPUStateMutable &a, const GPUStateMutable return r; } -#define GPU_STATE_STACK_LEN 4 - -class GPUStateStack { - private: - /** Stack of state for quick temporary modification of the state. */ - GPUState stack[GPU_STATE_STACK_LEN]; - GPUStateMutable mutable_stack[GPU_STATE_STACK_LEN]; - int stack_top = 0; - int mutable_stack_top = 0; - +class GPUStateManager { public: - virtual ~GPUStateStack(){}; - - virtual void set_state(GPUState &state) = 0; - virtual void set_mutable_state(GPUStateMutable &state) = 0; + GPUState state; + GPUStateMutable mutable_state; - void push_stack(void); - void pop_stack(void); - - void push_mutable_stack(void); - void pop_mutable_stack(void); + public: + virtual ~GPUStateManager(){}; - inline GPUState &stack_top_get(void); - inline GPUStateMutable &mutable_stack_top_get(void); + virtual void set_state(const GPUState &state) = 0; + virtual void set_mutable_state(const GPUStateMutable &state) = 0; }; -inline GPUState &GPUStateStack::stack_top_get(void) -{ - return stack[stack_top]; -} - -inline GPUStateMutable &GPUStateStack::mutable_stack_top_get(void) -{ - return mutable_stack[mutable_stack_top]; -} - } // namespace gpu } // namespace blender |