From 145ae369639af6f91a59b8217c5e9ba42b0c5f0b Mon Sep 17 00:00:00 2001 From: Rodolfo Bogado Date: Fri, 2 Nov 2018 00:21:25 -0300 Subject: Implement multi-target viewports and blending --- src/video_core/renderer_opengl/gl_state.h | 52 ++++++++++++++++++------------- 1 file changed, 31 insertions(+), 21 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_state.h') diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index fe648aff6..a027ca33c 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h @@ -46,11 +46,9 @@ public: } cull; struct { - bool test_enabled; // GL_DEPTH_TEST - GLenum test_func; // GL_DEPTH_FUNC - GLboolean write_mask; // GL_DEPTH_WRITEMASK - GLfloat depth_range_near; // GL_DEPTH_RANGE - GLfloat depth_range_far; // GL_DEPTH_RANGE + bool test_enabled; // GL_DEPTH_TEST + GLenum test_func; // GL_DEPTH_FUNC + GLboolean write_mask; // GL_DEPTH_WRITEMASK } depth; struct { @@ -78,22 +76,28 @@ public: } front, back; } stencil; - struct { + struct Blend { bool enabled; // GL_BLEND + bool separate_alpha; // Independent blend enabled GLenum rgb_equation; // GL_BLEND_EQUATION_RGB GLenum a_equation; // GL_BLEND_EQUATION_ALPHA GLenum src_rgb_func; // GL_BLEND_SRC_RGB GLenum dst_rgb_func; // GL_BLEND_DST_RGB GLenum src_a_func; // GL_BLEND_SRC_ALPHA GLenum dst_a_func; // GL_BLEND_DST_ALPHA + }; + std::array blend; - struct { - GLclampf red; - GLclampf green; - GLclampf blue; - GLclampf alpha; - } color; // GL_BLEND_COLOR - } blend; + struct { + bool enabled; + } independant_blend; + + struct { + GLclampf red; + GLclampf green; + GLclampf blue; + GLclampf alpha; + } blend_color; // GL_BLEND_COLOR struct { bool enabled; // GL_LOGIC_OP_MODE @@ -138,6 +142,16 @@ public: GLuint program_pipeline; // GL_PROGRAM_PIPELINE_BINDING } draw; + struct viewport { + GLfloat x; + GLfloat y; + GLfloat width; + GLfloat height; + GLfloat depth_range_near; // GL_DEPTH_RANGE + GLfloat depth_range_far; // GL_DEPTH_RANGE + }; + std::array viewports; + struct { bool enabled; // GL_SCISSOR_TEST GLint x; @@ -146,13 +160,6 @@ public: GLsizei height; } scissor; - struct { - GLint x; - GLint y; - GLsizei width; - GLsizei height; - } viewport; - struct { float size; // GL_POINT_SIZE } point; @@ -194,11 +201,14 @@ private: void ApplyDepth() const; void ApplyPrimitiveRestart() const; void ApplyStencilTest() const; - void ApplyScissorTest() const; + void ApplyViewport() const; + void ApplyTargetBlending(int target, bool force) const; + void ApplyGlobalBlending() const; void ApplyBlending() const; void ApplyLogicOp() const; void ApplyTextures() const; void ApplySamplers() const; + void ApplyScissor() const; }; } // namespace OpenGL -- cgit v1.2.3