summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Rodolfo Bogado2018-11-18 03:44:48 -0300
committerGravatar Rodolfo Bogado2018-11-18 03:44:48 -0300
commit4d1a0a24cc753d6655b07b74f3f0f098a4d588d1 (patch)
tree6c1e876151b7eba73a38d223c45229a450bb3260 /src
parentfix sampler configuration, thanks to Marcos for his investigation (diff)
downloadyuzu-4d1a0a24cc753d6655b07b74f3f0f098a4d588d1.tar.gz
yuzu-4d1a0a24cc753d6655b07b74f3f0f098a4d588d1.tar.xz
yuzu-4d1a0a24cc753d6655b07b74f3f0f098a4d588d1.zip
drop support for non separate alpha as it seems to cause issues in some games
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp34
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp61
-rw-r--r--src/video_core/renderer_opengl/gl_state.h1
3 files changed, 35 insertions, 61 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 3fe8ceb41..8c92ceb21 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1077,15 +1077,15 @@ void RasterizerOpenGL::SyncBlendState() {
1077 state.independant_blend.enabled = regs.independent_blend_enable; 1077 state.independant_blend.enabled = regs.independent_blend_enable;
1078 if (!state.independant_blend.enabled) { 1078 if (!state.independant_blend.enabled) {
1079 auto& blend = state.blend[0]; 1079 auto& blend = state.blend[0];
1080 blend.enabled = regs.blend.enable[0] != 0; 1080 const auto& src = regs.blend;
1081 blend.separate_alpha = regs.blend.separate_alpha; 1081 blend.enabled = src.enable[0] != 0;
1082 blend.rgb_equation = MaxwellToGL::BlendEquation(regs.blend.equation_rgb); 1082 if (blend.enabled) {
1083 blend.src_rgb_func = MaxwellToGL::BlendFunc(regs.blend.factor_source_rgb); 1083 blend.rgb_equation = MaxwellToGL::BlendEquation(src.equation_rgb);
1084 blend.dst_rgb_func = MaxwellToGL::BlendFunc(regs.blend.factor_dest_rgb); 1084 blend.src_rgb_func = MaxwellToGL::BlendFunc(src.factor_source_rgb);
1085 if (blend.separate_alpha) { 1085 blend.dst_rgb_func = MaxwellToGL::BlendFunc(src.factor_dest_rgb);
1086 blend.a_equation = MaxwellToGL::BlendEquation(regs.blend.equation_a); 1086 blend.a_equation = MaxwellToGL::BlendEquation(src.equation_a);
1087 blend.src_a_func = MaxwellToGL::BlendFunc(regs.blend.factor_source_a); 1087 blend.src_a_func = MaxwellToGL::BlendFunc(src.factor_source_a);
1088 blend.dst_a_func = MaxwellToGL::BlendFunc(regs.blend.factor_dest_a); 1088 blend.dst_a_func = MaxwellToGL::BlendFunc(src.factor_dest_a);
1089 } 1089 }
1090 for (std::size_t i = 1; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) { 1090 for (std::size_t i = 1; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) {
1091 state.blend[i].enabled = false; 1091 state.blend[i].enabled = false;
@@ -1095,18 +1095,16 @@ void RasterizerOpenGL::SyncBlendState() {
1095 1095
1096 for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) { 1096 for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) {
1097 auto& blend = state.blend[i]; 1097 auto& blend = state.blend[i];
1098 const auto& src = regs.independent_blend[i];
1098 blend.enabled = regs.blend.enable[i] != 0; 1099 blend.enabled = regs.blend.enable[i] != 0;
1099 if (!blend.enabled) 1100 if (!blend.enabled)
1100 continue; 1101 continue;
1101 blend.separate_alpha = regs.independent_blend[i].separate_alpha; 1102 blend.rgb_equation = MaxwellToGL::BlendEquation(src.equation_rgb);
1102 blend.rgb_equation = MaxwellToGL::BlendEquation(regs.independent_blend[i].equation_rgb); 1103 blend.src_rgb_func = MaxwellToGL::BlendFunc(src.factor_source_rgb);
1103 blend.src_rgb_func = MaxwellToGL::BlendFunc(regs.independent_blend[i].factor_source_rgb); 1104 blend.dst_rgb_func = MaxwellToGL::BlendFunc(src.factor_dest_rgb);
1104 blend.dst_rgb_func = MaxwellToGL::BlendFunc(regs.independent_blend[i].factor_dest_rgb); 1105 blend.a_equation = MaxwellToGL::BlendEquation(src.equation_a);
1105 if (blend.separate_alpha) { 1106 blend.src_a_func = MaxwellToGL::BlendFunc(src.factor_source_a);
1106 blend.a_equation = MaxwellToGL::BlendEquation(regs.independent_blend[i].equation_a); 1107 blend.dst_a_func = MaxwellToGL::BlendFunc(src.factor_dest_a);
1107 blend.src_a_func = MaxwellToGL::BlendFunc(regs.independent_blend[i].factor_source_a);
1108 blend.dst_a_func = MaxwellToGL::BlendFunc(regs.independent_blend[i].factor_dest_a);
1109 }
1110 } 1108 }
1111} 1109}
1112 1110
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index f6d80614b..d9910c6e8 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -309,27 +309,16 @@ void OpenGLState::ApplyGlobalBlending() const {
309 if (!updated.enabled) { 309 if (!updated.enabled) {
310 return; 310 return;
311 } 311 }
312 if (updated.separate_alpha) { 312 if (blend_changed || updated.src_rgb_func != current.src_rgb_func ||
313 if (blend_changed || updated.src_rgb_func != current.src_rgb_func || 313 updated.dst_rgb_func != current.dst_rgb_func || updated.src_a_func != current.src_a_func ||
314 updated.dst_rgb_func != current.dst_rgb_func || 314 updated.dst_a_func != current.dst_a_func) {
315 updated.src_a_func != current.src_a_func || updated.dst_a_func != current.dst_a_func) { 315 glBlendFuncSeparate(updated.src_rgb_func, updated.dst_rgb_func, updated.src_a_func,
316 glBlendFuncSeparate(updated.src_rgb_func, updated.dst_rgb_func, updated.src_a_func, 316 updated.dst_a_func);
317 updated.dst_a_func); 317 }
318 }
319
320 if (blend_changed || updated.rgb_equation != current.rgb_equation ||
321 updated.a_equation != current.a_equation) {
322 glBlendEquationSeparate(updated.rgb_equation, updated.a_equation);
323 }
324 } else {
325 if (blend_changed || updated.src_rgb_func != current.src_rgb_func ||
326 updated.dst_rgb_func != current.dst_rgb_func) {
327 glBlendFunc(updated.src_rgb_func, updated.dst_rgb_func);
328 }
329 318
330 if (blend_changed || updated.rgb_equation != current.rgb_equation) { 319 if (blend_changed || updated.rgb_equation != current.rgb_equation ||
331 glBlendEquation(updated.rgb_equation); 320 updated.a_equation != current.a_equation) {
332 } 321 glBlendEquationSeparate(updated.rgb_equation, updated.a_equation);
333 } 322 }
334} 323}
335 324
@@ -347,29 +336,17 @@ void OpenGLState::ApplyTargetBlending(std::size_t target, bool force) const {
347 if (!updated.enabled) { 336 if (!updated.enabled) {
348 return; 337 return;
349 } 338 }
350 if (updated.separate_alpha) { 339 if (blend_changed || updated.src_rgb_func != current.src_rgb_func ||
351 if (blend_changed || updated.src_rgb_func != current.src_rgb_func || 340 updated.dst_rgb_func != current.dst_rgb_func || updated.src_a_func != current.src_a_func ||
352 updated.dst_rgb_func != current.dst_rgb_func || 341 updated.dst_a_func != current.dst_a_func) {
353 updated.src_a_func != current.src_a_func || updated.dst_a_func != current.dst_a_func) { 342 glBlendFuncSeparateiARB(static_cast<GLuint>(target), updated.src_rgb_func,
354 glBlendFuncSeparateiARB(static_cast<GLuint>(target), updated.src_rgb_func, 343 updated.dst_rgb_func, updated.src_a_func, updated.dst_a_func);
355 updated.dst_rgb_func, updated.src_a_func, updated.dst_a_func); 344 }
356 }
357
358 if (blend_changed || updated.rgb_equation != current.rgb_equation ||
359 updated.a_equation != current.a_equation) {
360 glBlendEquationSeparateiARB(static_cast<GLuint>(target), updated.rgb_equation,
361 updated.a_equation);
362 }
363 } else {
364 if (blend_changed || updated.src_rgb_func != current.src_rgb_func ||
365 updated.dst_rgb_func != current.dst_rgb_func) {
366 glBlendFunciARB(static_cast<GLuint>(target), updated.src_rgb_func,
367 updated.dst_rgb_func);
368 }
369 345
370 if (blend_changed || updated.rgb_equation != current.rgb_equation) { 346 if (blend_changed || updated.rgb_equation != current.rgb_equation ||
371 glBlendEquationiARB(static_cast<GLuint>(target), updated.rgb_equation); 347 updated.a_equation != current.a_equation) {
372 } 348 glBlendEquationSeparateiARB(static_cast<GLuint>(target), updated.rgb_equation,
349 updated.a_equation);
373 } 350 }
374} 351}
375 352
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index c8d951a7f..bdc743b0f 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -92,7 +92,6 @@ public:
92 92
93 struct Blend { 93 struct Blend {
94 bool enabled; // GL_BLEND 94 bool enabled; // GL_BLEND
95 bool separate_alpha; // Independent blend enabled
96 GLenum rgb_equation; // GL_BLEND_EQUATION_RGB 95 GLenum rgb_equation; // GL_BLEND_EQUATION_RGB
97 GLenum a_equation; // GL_BLEND_EQUATION_ALPHA 96 GLenum a_equation; // GL_BLEND_EQUATION_ALPHA
98 GLenum src_rgb_func; // GL_BLEND_SRC_RGB 97 GLenum src_rgb_func; // GL_BLEND_SRC_RGB