mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
drop support for non separate alpha as it seems to cause issues in some games
This commit is contained in:
parent
81a9c5fe6f
commit
4d1a0a24cc
3 changed files with 35 additions and 61 deletions
|
@ -1077,15 +1077,15 @@ void RasterizerOpenGL::SyncBlendState() {
|
||||||
state.independant_blend.enabled = regs.independent_blend_enable;
|
state.independant_blend.enabled = regs.independent_blend_enable;
|
||||||
if (!state.independant_blend.enabled) {
|
if (!state.independant_blend.enabled) {
|
||||||
auto& blend = state.blend[0];
|
auto& blend = state.blend[0];
|
||||||
blend.enabled = regs.blend.enable[0] != 0;
|
const auto& src = regs.blend;
|
||||||
blend.separate_alpha = regs.blend.separate_alpha;
|
blend.enabled = src.enable[0] != 0;
|
||||||
blend.rgb_equation = MaxwellToGL::BlendEquation(regs.blend.equation_rgb);
|
if (blend.enabled) {
|
||||||
blend.src_rgb_func = MaxwellToGL::BlendFunc(regs.blend.factor_source_rgb);
|
blend.rgb_equation = MaxwellToGL::BlendEquation(src.equation_rgb);
|
||||||
blend.dst_rgb_func = MaxwellToGL::BlendFunc(regs.blend.factor_dest_rgb);
|
blend.src_rgb_func = MaxwellToGL::BlendFunc(src.factor_source_rgb);
|
||||||
if (blend.separate_alpha) {
|
blend.dst_rgb_func = MaxwellToGL::BlendFunc(src.factor_dest_rgb);
|
||||||
blend.a_equation = MaxwellToGL::BlendEquation(regs.blend.equation_a);
|
blend.a_equation = MaxwellToGL::BlendEquation(src.equation_a);
|
||||||
blend.src_a_func = MaxwellToGL::BlendFunc(regs.blend.factor_source_a);
|
blend.src_a_func = MaxwellToGL::BlendFunc(src.factor_source_a);
|
||||||
blend.dst_a_func = MaxwellToGL::BlendFunc(regs.blend.factor_dest_a);
|
blend.dst_a_func = MaxwellToGL::BlendFunc(src.factor_dest_a);
|
||||||
}
|
}
|
||||||
for (std::size_t i = 1; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) {
|
for (std::size_t i = 1; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) {
|
||||||
state.blend[i].enabled = false;
|
state.blend[i].enabled = false;
|
||||||
|
@ -1095,18 +1095,16 @@ void RasterizerOpenGL::SyncBlendState() {
|
||||||
|
|
||||||
for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) {
|
for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) {
|
||||||
auto& blend = state.blend[i];
|
auto& blend = state.blend[i];
|
||||||
|
const auto& src = regs.independent_blend[i];
|
||||||
blend.enabled = regs.blend.enable[i] != 0;
|
blend.enabled = regs.blend.enable[i] != 0;
|
||||||
if (!blend.enabled)
|
if (!blend.enabled)
|
||||||
continue;
|
continue;
|
||||||
blend.separate_alpha = regs.independent_blend[i].separate_alpha;
|
blend.rgb_equation = MaxwellToGL::BlendEquation(src.equation_rgb);
|
||||||
blend.rgb_equation = MaxwellToGL::BlendEquation(regs.independent_blend[i].equation_rgb);
|
blend.src_rgb_func = MaxwellToGL::BlendFunc(src.factor_source_rgb);
|
||||||
blend.src_rgb_func = MaxwellToGL::BlendFunc(regs.independent_blend[i].factor_source_rgb);
|
blend.dst_rgb_func = MaxwellToGL::BlendFunc(src.factor_dest_rgb);
|
||||||
blend.dst_rgb_func = MaxwellToGL::BlendFunc(regs.independent_blend[i].factor_dest_rgb);
|
blend.a_equation = MaxwellToGL::BlendEquation(src.equation_a);
|
||||||
if (blend.separate_alpha) {
|
blend.src_a_func = MaxwellToGL::BlendFunc(src.factor_source_a);
|
||||||
blend.a_equation = MaxwellToGL::BlendEquation(regs.independent_blend[i].equation_a);
|
blend.dst_a_func = MaxwellToGL::BlendFunc(src.factor_dest_a);
|
||||||
blend.src_a_func = MaxwellToGL::BlendFunc(regs.independent_blend[i].factor_source_a);
|
|
||||||
blend.dst_a_func = MaxwellToGL::BlendFunc(regs.independent_blend[i].factor_dest_a);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -309,27 +309,16 @@ void OpenGLState::ApplyGlobalBlending() const {
|
||||||
if (!updated.enabled) {
|
if (!updated.enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (updated.separate_alpha) {
|
if (blend_changed || updated.src_rgb_func != current.src_rgb_func ||
|
||||||
if (blend_changed || updated.src_rgb_func != current.src_rgb_func ||
|
updated.dst_rgb_func != current.dst_rgb_func || updated.src_a_func != current.src_a_func ||
|
||||||
updated.dst_rgb_func != current.dst_rgb_func ||
|
updated.dst_a_func != current.dst_a_func) {
|
||||||
updated.src_a_func != current.src_a_func || updated.dst_a_func != current.dst_a_func) {
|
glBlendFuncSeparate(updated.src_rgb_func, updated.dst_rgb_func, updated.src_a_func,
|
||||||
glBlendFuncSeparate(updated.src_rgb_func, updated.dst_rgb_func, updated.src_a_func,
|
updated.dst_a_func);
|
||||||
updated.dst_a_func);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (blend_changed || updated.rgb_equation != current.rgb_equation ||
|
if (blend_changed || updated.rgb_equation != current.rgb_equation ||
|
||||||
updated.a_equation != current.a_equation) {
|
updated.a_equation != current.a_equation) {
|
||||||
glBlendEquationSeparate(updated.rgb_equation, updated.a_equation);
|
glBlendEquationSeparate(updated.rgb_equation, updated.a_equation);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (blend_changed || updated.src_rgb_func != current.src_rgb_func ||
|
|
||||||
updated.dst_rgb_func != current.dst_rgb_func) {
|
|
||||||
glBlendFunc(updated.src_rgb_func, updated.dst_rgb_func);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (blend_changed || updated.rgb_equation != current.rgb_equation) {
|
|
||||||
glBlendEquation(updated.rgb_equation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,29 +336,17 @@ void OpenGLState::ApplyTargetBlending(std::size_t target, bool force) const {
|
||||||
if (!updated.enabled) {
|
if (!updated.enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (updated.separate_alpha) {
|
if (blend_changed || updated.src_rgb_func != current.src_rgb_func ||
|
||||||
if (blend_changed || updated.src_rgb_func != current.src_rgb_func ||
|
updated.dst_rgb_func != current.dst_rgb_func || updated.src_a_func != current.src_a_func ||
|
||||||
updated.dst_rgb_func != current.dst_rgb_func ||
|
updated.dst_a_func != current.dst_a_func) {
|
||||||
updated.src_a_func != current.src_a_func || updated.dst_a_func != current.dst_a_func) {
|
glBlendFuncSeparateiARB(static_cast<GLuint>(target), updated.src_rgb_func,
|
||||||
glBlendFuncSeparateiARB(static_cast<GLuint>(target), updated.src_rgb_func,
|
updated.dst_rgb_func, updated.src_a_func, updated.dst_a_func);
|
||||||
updated.dst_rgb_func, updated.src_a_func, updated.dst_a_func);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (blend_changed || updated.rgb_equation != current.rgb_equation ||
|
if (blend_changed || updated.rgb_equation != current.rgb_equation ||
|
||||||
updated.a_equation != current.a_equation) {
|
updated.a_equation != current.a_equation) {
|
||||||
glBlendEquationSeparateiARB(static_cast<GLuint>(target), updated.rgb_equation,
|
glBlendEquationSeparateiARB(static_cast<GLuint>(target), updated.rgb_equation,
|
||||||
updated.a_equation);
|
updated.a_equation);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (blend_changed || updated.src_rgb_func != current.src_rgb_func ||
|
|
||||||
updated.dst_rgb_func != current.dst_rgb_func) {
|
|
||||||
glBlendFunciARB(static_cast<GLuint>(target), updated.src_rgb_func,
|
|
||||||
updated.dst_rgb_func);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (blend_changed || updated.rgb_equation != current.rgb_equation) {
|
|
||||||
glBlendEquationiARB(static_cast<GLuint>(target), updated.rgb_equation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,6 @@ public:
|
||||||
|
|
||||||
struct Blend {
|
struct Blend {
|
||||||
bool enabled; // GL_BLEND
|
bool enabled; // GL_BLEND
|
||||||
bool separate_alpha; // Independent blend enabled
|
|
||||||
GLenum rgb_equation; // GL_BLEND_EQUATION_RGB
|
GLenum rgb_equation; // GL_BLEND_EQUATION_RGB
|
||||||
GLenum a_equation; // GL_BLEND_EQUATION_ALPHA
|
GLenum a_equation; // GL_BLEND_EQUATION_ALPHA
|
||||||
GLenum src_rgb_func; // GL_BLEND_SRC_RGB
|
GLenum src_rgb_func; // GL_BLEND_SRC_RGB
|
||||||
|
|
Loading…
Reference in a new issue