gl_rasterizer_cache: Guard clause swizzle testing

Co-Authored-By: ReinUsesLisp <reinuseslisp@airmail.cc>
This commit is contained in:
Mat M 2019-01-29 22:01:04 -03:00 committed by ReinUsesLisp
parent 220df45b7d
commit 911587fb8d
1 changed files with 3 additions and 1 deletions

View File

@ -880,7 +880,9 @@ void CachedSurface::UpdateSwizzle(Tegra::Texture::SwizzleSource swizzle_x,
const GLenum new_y = MaxwellToGL::SwizzleSource(swizzle_y); const GLenum new_y = MaxwellToGL::SwizzleSource(swizzle_y);
const GLenum new_z = MaxwellToGL::SwizzleSource(swizzle_z); const GLenum new_z = MaxwellToGL::SwizzleSource(swizzle_z);
const GLenum new_w = MaxwellToGL::SwizzleSource(swizzle_w); const GLenum new_w = MaxwellToGL::SwizzleSource(swizzle_w);
if (swizzle[0] != new_x || swizzle[1] != new_y || swizzle[2] != new_z || swizzle[3] != new_w) { if (swizzle[0] == new_x && swizzle[1] == new_y && swizzle[2] == new_z && swizzle[3] == new_w) {
return;
}
swizzle = {new_x, new_y, new_z, new_w}; swizzle = {new_x, new_y, new_z, new_w};
const auto swizzle_data = reinterpret_cast<const GLint*>(swizzle.data()); const auto swizzle_data = reinterpret_cast<const GLint*>(swizzle.data());
glTextureParameteriv(texture.handle, GL_TEXTURE_SWIZZLE_RGBA, swizzle_data); glTextureParameteriv(texture.handle, GL_TEXTURE_SWIZZLE_RGBA, swizzle_data);