summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Rodolfo Bogado2018-11-13 22:09:01 -0300
committerGravatar Rodolfo Bogado2018-11-17 19:59:33 -0300
commit8ed7e1af2c8d859ca5e1bd05e199b1f14099c8b4 (patch)
treef0903ff885f49b0ccecf3d4023fdd47e067bf072 /src
parentadd missing MirrorOnceBorder support where supported (diff)
downloadyuzu-8ed7e1af2c8d859ca5e1bd05e199b1f14099c8b4.tar.gz
yuzu-8ed7e1af2c8d859ca5e1bd05e199b1f14099c8b4.tar.xz
yuzu-8ed7e1af2c8d859ca5e1bd05e199b1f14099c8b4.zip
add support for fragment_color_clamp
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_3d.h5
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h3
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp7
-rw-r--r--src/video_core/renderer_opengl/gl_state.h4
5 files changed, 24 insertions, 1 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 32780fa9a..f2d69814e 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -706,7 +706,9 @@ public:
706 u32 stencil_front_func_mask; 706 u32 stencil_front_func_mask;
707 u32 stencil_front_mask; 707 u32 stencil_front_mask;
708 708
709 INSERT_PADDING_WORDS(0x3); 709 INSERT_PADDING_WORDS(0x2);
710
711 u32 frag_color_clamp;
710 712
711 union { 713 union {
712 BitField<4, 1, u32> triangle_rast_flip; 714 BitField<4, 1, u32> triangle_rast_flip;
@@ -1142,6 +1144,7 @@ ASSERT_REG_POSITION(stencil_front_func_func, 0x4E4);
1142ASSERT_REG_POSITION(stencil_front_func_ref, 0x4E5); 1144ASSERT_REG_POSITION(stencil_front_func_ref, 0x4E5);
1143ASSERT_REG_POSITION(stencil_front_func_mask, 0x4E6); 1145ASSERT_REG_POSITION(stencil_front_func_mask, 0x4E6);
1144ASSERT_REG_POSITION(stencil_front_mask, 0x4E7); 1146ASSERT_REG_POSITION(stencil_front_mask, 0x4E7);
1147ASSERT_REG_POSITION(frag_color_clamp, 0x4EA);
1145ASSERT_REG_POSITION(screen_y_control, 0x4EB); 1148ASSERT_REG_POSITION(screen_y_control, 0x4EB);
1146ASSERT_REG_POSITION(vb_element_base, 0x50D); 1149ASSERT_REG_POSITION(vb_element_base, 0x50D);
1147ASSERT_REG_POSITION(point_size, 0x546); 1150ASSERT_REG_POSITION(point_size, 0x546);
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 10d407bd2..98799056c 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -582,6 +582,7 @@ void RasterizerOpenGL::DrawArrays() {
582 582
583 ConfigureFramebuffers(state); 583 ConfigureFramebuffers(state);
584 SyncColorMask(); 584 SyncColorMask();
585 SyncFragmentColorClampState();
585 SyncDepthTestState(); 586 SyncDepthTestState();
586 SyncStencilTestState(); 587 SyncStencilTestState();
587 SyncBlendState(); 588 SyncBlendState();
@@ -1032,6 +1033,11 @@ void RasterizerOpenGL::SyncColorMask() {
1032 } 1033 }
1033} 1034}
1034 1035
1036void RasterizerOpenGL::SyncFragmentColorClampState() {
1037 const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
1038 state.fragment_color_clamp.enabled = regs.frag_color_clamp != 0;
1039}
1040
1035void RasterizerOpenGL::SyncBlendState() { 1041void RasterizerOpenGL::SyncBlendState() {
1036 const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; 1042 const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
1037 1043
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 8ef0f6c12..d3fa0b6fc 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -160,6 +160,9 @@ private:
160 /// Syncs the LogicOp state to match the guest state 160 /// Syncs the LogicOp state to match the guest state
161 void SyncLogicOpState(); 161 void SyncLogicOpState();
162 162
163 /// Syncs the the color clamp state
164 void SyncFragmentColorClampState();
165
163 /// Syncs the scissor test state to match the guest state 166 /// Syncs the scissor test state to match the guest state
164 void SyncScissorTest(); 167 void SyncScissorTest();
165 168
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index dd6d946e5..6998dd92b 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -89,6 +89,7 @@ OpenGLState::OpenGLState() {
89 clip_distance = {}; 89 clip_distance = {};
90 90
91 point.size = 1; 91 point.size = 1;
92 fragment_color_clamp.enabled = false;
92} 93}
93 94
94void OpenGLState::ApplyDefaultState() { 95void OpenGLState::ApplyDefaultState() {
@@ -497,6 +498,12 @@ void OpenGLState::Apply() const {
497 if (point.size != cur_state.point.size) { 498 if (point.size != cur_state.point.size) {
498 glPointSize(point.size); 499 glPointSize(point.size);
499 } 500 }
501 if (GLAD_GL_ARB_color_buffer_float) {
502 if (fragment_color_clamp.enabled != cur_state.fragment_color_clamp.enabled) {
503 glClampColor(GL_CLAMP_FRAGMENT_COLOR_ARB,
504 fragment_color_clamp.enabled ? GL_TRUE : GL_FALSE);
505 }
506 }
500 ApplyColorMask(); 507 ApplyColorMask();
501 ApplyViewport(); 508 ApplyViewport();
502 ApplyStencilTest(); 509 ApplyStencilTest();
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index da487461f..6079f6e0b 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -40,6 +40,10 @@ public:
40 } framebuffer_srgb; 40 } framebuffer_srgb;
41 41
42 struct { 42 struct {
43 bool enabled; // GL_CLAMP_FRAGMENT_COLOR_ARB
44 } fragment_color_clamp;
45
46 struct {
43 bool enabled; // viewports arrays are only supported when geometry shaders are enabled. 47 bool enabled; // viewports arrays are only supported when geometry shaders are enabled.
44 } geometry_shaders; 48 } geometry_shaders;
45 49