diff options
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_state.h | 85 |
1 files changed, 56 insertions, 29 deletions
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index fe648aff6..032fc43f0 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h @@ -40,17 +40,28 @@ public: } framebuffer_srgb; struct { + bool alpha_to_coverage; // GL_ALPHA_TO_COVERAGE + bool alpha_to_one; // GL_ALPHA_TO_ONE + } multisample_control; + + struct { + bool enabled; // GL_CLAMP_FRAGMENT_COLOR_ARB + } fragment_color_clamp; + + struct { + bool enabled; // viewports arrays are only supported when geometry shaders are enabled. + } geometry_shaders; + + struct { bool enabled; // GL_CULL_FACE GLenum mode; // GL_CULL_FACE_MODE GLenum front_face; // GL_FRONT_FACE } 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 { @@ -58,13 +69,14 @@ public: GLuint index; } primitive_restart; // GL_PRIMITIVE_RESTART - struct { + struct ColorMask { GLboolean red_enabled; GLboolean green_enabled; GLboolean blue_enabled; GLboolean alpha_enabled; - } color_mask; // GL_COLOR_WRITEMASK - + }; + std::array<ColorMask, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets> + color_mask; // GL_COLOR_WRITEMASK struct { bool test_enabled; // GL_STENCIL_TEST struct { @@ -78,7 +90,7 @@ public: } front, back; } stencil; - struct { + struct Blend { bool enabled; // GL_BLEND GLenum rgb_equation; // GL_BLEND_EQUATION_RGB GLenum a_equation; // GL_BLEND_EQUATION_ALPHA @@ -86,14 +98,19 @@ public: 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, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets> 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,20 +155,22 @@ public: GLuint program_pipeline; // GL_PROGRAM_PIPELINE_BINDING } draw; - struct { - bool enabled; // GL_SCISSOR_TEST + struct viewport { GLint x; GLint y; - GLsizei width; - GLsizei height; - } scissor; - - struct { - GLint x; - GLint y; - GLsizei width; - GLsizei height; - } viewport; + GLint width; + GLint height; + GLfloat depth_range_near; // GL_DEPTH_RANGE + GLfloat depth_range_far; // GL_DEPTH_RANGE + struct { + bool enabled; // GL_SCISSOR_TEST + GLint x; + GLint y; + GLsizei width; + GLsizei height; + } scissor; + }; + std::array<viewport, Tegra::Engines::Maxwell3D::Regs::NumViewports> viewports; struct { float size; // GL_POINT_SIZE @@ -173,6 +192,10 @@ public: } /// Apply this state as the current OpenGL state void Apply() const; + /// Apply only the state afecting the framebuffer + void ApplyFramebufferState() const; + /// Apply only the state afecting the vertex buffer + void ApplyVertexBufferState() const; /// Set the initial OpenGL state static void ApplyDefaultState(); /// Resets any references to the given resource @@ -183,6 +206,7 @@ public: OpenGLState& ResetBuffer(GLuint handle); OpenGLState& ResetVertexArray(GLuint handle); OpenGLState& ResetFramebuffer(GLuint handle); + void EmulateViewportWithScissor(); private: static OpenGLState cur_state; @@ -191,10 +215,13 @@ private: static bool s_rgb_used; void ApplySRgb() const; void ApplyCulling() const; + void ApplyColorMask() const; void ApplyDepth() const; void ApplyPrimitiveRestart() const; void ApplyStencilTest() const; - void ApplyScissorTest() const; + void ApplyViewport() const; + void ApplyTargetBlending(std::size_t target, bool force) const; + void ApplyGlobalBlending() const; void ApplyBlending() const; void ApplyLogicOp() const; void ApplyTextures() const; |