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.
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
|
||||
namespace blender::gpu {
|
||||
|
||||
class GLStateManager;
|
||||
|
||||
/**
|
||||
* Implementation of FrameBuffer object using OpenGL.
|
||||
**/
|
||||
@@ -42,6 +44,8 @@ class GLFrameBuffer : public FrameBuffer {
|
||||
GLuint fbo_id_ = 0;
|
||||
/** Context the handle is from. Framebuffers are not shared accros contexts. */
|
||||
GLContext *context_ = NULL;
|
||||
/** State Manager of the same contexts. */
|
||||
GLStateManager *state_manager_ = NULL;
|
||||
/** Copy of the GL state. Contains ONLY color attachments enums for slot binding. */
|
||||
GLenum gl_attachments_[GPU_FB_MAX_COLOR_ATTACHMENT];
|
||||
/** Internal framebuffers are immutable. */
|
||||
@@ -92,6 +96,8 @@ class GLFrameBuffer : public FrameBuffer {
|
||||
int dst_offset_x,
|
||||
int dst_offset_y) override;
|
||||
|
||||
void apply_state(void);
|
||||
|
||||
private:
|
||||
void init(void);
|
||||
void update_attachments(void);
|
||||
|
||||
Reference in New Issue
Block a user