summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_state.cpp
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-06-07 01:26:41 +0200
committerSubv <subv2112@gmail.com>2018-06-07 01:36:13 +0200
commit89e81a9be26da83114e600d141085e9b7ac98529 (patch)
treed5fd51e5c2d84a1da1f8900529547de33b653cc1 /src/video_core/renderer_opengl/gl_state.cpp
parentMerge pull request #534 from Subv/multitexturing (diff)
downloadyuzu-89e81a9be26da83114e600d141085e9b7ac98529.tar
yuzu-89e81a9be26da83114e600d141085e9b7ac98529.tar.gz
yuzu-89e81a9be26da83114e600d141085e9b7ac98529.tar.bz2
yuzu-89e81a9be26da83114e600d141085e9b7ac98529.tar.lz
yuzu-89e81a9be26da83114e600d141085e9b7ac98529.tar.xz
yuzu-89e81a9be26da83114e600d141085e9b7ac98529.tar.zst
yuzu-89e81a9be26da83114e600d141085e9b7ac98529.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index f91dfe36a..44f0c8a01 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -50,6 +50,10 @@ OpenGLState::OpenGLState() {
for (auto& texture_unit : texture_units) {
texture_unit.texture_2d = 0;
texture_unit.sampler = 0;
+ texture_unit.swizzle.r = GL_RED;
+ texture_unit.swizzle.g = GL_GREEN;
+ texture_unit.swizzle.b = GL_BLUE;
+ texture_unit.swizzle.a = GL_ALPHA;
}
lighting_lut.texture_buffer = 0;
@@ -200,6 +204,15 @@ void OpenGLState::Apply() const {
if (texture_units[i].sampler != cur_state.texture_units[i].sampler) {
glBindSampler(i, texture_units[i].sampler);
}
+ // Update the texture swizzle
+ if (texture_units[i].swizzle.r != cur_state.texture_units[i].swizzle.r ||
+ texture_units[i].swizzle.g != cur_state.texture_units[i].swizzle.g ||
+ texture_units[i].swizzle.b != cur_state.texture_units[i].swizzle.b ||
+ texture_units[i].swizzle.a != cur_state.texture_units[i].swizzle.a) {
+ std::array<GLint, 4> mask = {texture_units[i].swizzle.r, texture_units[i].swizzle.g,
+ texture_units[i].swizzle.b, texture_units[i].swizzle.a};
+ glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, mask.data());
+ }
}
// Constbuffers