diff options
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.h | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 1 |
3 files changed, 20 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() { | |||
| 50 | for (auto& texture_unit : texture_units) { | 50 | for (auto& texture_unit : texture_units) { |
| 51 | texture_unit.texture_2d = 0; | 51 | texture_unit.texture_2d = 0; |
| 52 | texture_unit.sampler = 0; | 52 | texture_unit.sampler = 0; |
| 53 | texture_unit.swizzle.r = GL_RED; | ||
| 54 | texture_unit.swizzle.g = GL_GREEN; | ||
| 55 | texture_unit.swizzle.b = GL_BLUE; | ||
| 56 | texture_unit.swizzle.a = GL_ALPHA; | ||
| 53 | } | 57 | } |
| 54 | 58 | ||
| 55 | lighting_lut.texture_buffer = 0; | 59 | lighting_lut.texture_buffer = 0; |
| @@ -200,6 +204,15 @@ void OpenGLState::Apply() const { | |||
| 200 | if (texture_units[i].sampler != cur_state.texture_units[i].sampler) { | 204 | if (texture_units[i].sampler != cur_state.texture_units[i].sampler) { |
| 201 | glBindSampler(i, texture_units[i].sampler); | 205 | glBindSampler(i, texture_units[i].sampler); |
| 202 | } | 206 | } |
| 207 | // Update the texture swizzle | ||
| 208 | if (texture_units[i].swizzle.r != cur_state.texture_units[i].swizzle.r || | ||
| 209 | texture_units[i].swizzle.g != cur_state.texture_units[i].swizzle.g || | ||
| 210 | texture_units[i].swizzle.b != cur_state.texture_units[i].swizzle.b || | ||
| 211 | texture_units[i].swizzle.a != cur_state.texture_units[i].swizzle.a) { | ||
| 212 | std::array<GLint, 4> mask = {texture_units[i].swizzle.r, texture_units[i].swizzle.g, | ||
| 213 | texture_units[i].swizzle.b, texture_units[i].swizzle.a}; | ||
| 214 | glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, mask.data()); | ||
| 215 | } | ||
| 203 | } | 216 | } |
| 204 | 217 | ||
| 205 | // Constbuffers | 218 | // Constbuffers |
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index 75c08e645..839e50e93 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h | |||
| @@ -85,6 +85,12 @@ public: | |||
| 85 | struct { | 85 | struct { |
| 86 | GLuint texture_2d; // GL_TEXTURE_BINDING_2D | 86 | GLuint texture_2d; // GL_TEXTURE_BINDING_2D |
| 87 | GLuint sampler; // GL_SAMPLER_BINDING | 87 | GLuint sampler; // GL_SAMPLER_BINDING |
| 88 | struct { | ||
| 89 | GLint r; // GL_TEXTURE_SWIZZLE_R | ||
| 90 | GLint g; // GL_TEXTURE_SWIZZLE_G | ||
| 91 | GLint b; // GL_TEXTURE_SWIZZLE_B | ||
| 92 | GLint a; // GL_TEXTURE_SWIZZLE_A | ||
| 93 | } swizzle; | ||
| 88 | } texture_units[32]; | 94 | } texture_units[32]; |
| 89 | 95 | ||
| 90 | struct { | 96 | struct { |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 3440d2190..f33766bfd 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -316,6 +316,7 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x, | |||
| 316 | }}; | 316 | }}; |
| 317 | 317 | ||
| 318 | state.texture_units[0].texture_2d = screen_info.display_texture; | 318 | state.texture_units[0].texture_2d = screen_info.display_texture; |
| 319 | state.texture_units[0].swizzle = {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA}; | ||
| 319 | state.Apply(); | 320 | state.Apply(); |
| 320 | 321 | ||
| 321 | glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices.data()); | 322 | glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices.data()); |