diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_resource_manager.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 11 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.h | 15 |
5 files changed, 20 insertions, 12 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 0f6dec60b..aadf7e233 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -437,7 +437,7 @@ void RasterizerOpenGL::DrawArrays() { | |||
| 437 | 437 | ||
| 438 | // Unbind textures for potential future use as framebuffer attachments | 438 | // Unbind textures for potential future use as framebuffer attachments |
| 439 | for (auto& texture_unit : state.texture_units) { | 439 | for (auto& texture_unit : state.texture_units) { |
| 440 | texture_unit.texture_2d = 0; | 440 | texture_unit.Unbind(); |
| 441 | } | 441 | } |
| 442 | state.Apply(); | 442 | state.Apply(); |
| 443 | 443 | ||
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 61d670dcb..65158d1c0 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -645,7 +645,7 @@ void CachedSurface::DownloadGLTexture(const MathUtil::Rectangle<u32>& rect, GLui | |||
| 645 | glActiveTexture(GL_TEXTURE0); | 645 | glActiveTexture(GL_TEXTURE0); |
| 646 | glGetTexImage(GL_TEXTURE_2D, 0, tuple.format, tuple.type, &gl_buffer[buffer_offset]); | 646 | glGetTexImage(GL_TEXTURE_2D, 0, tuple.format, tuple.type, &gl_buffer[buffer_offset]); |
| 647 | } else { | 647 | } else { |
| 648 | state.ResetTexture(texture.handle); | 648 | state.UnbindTexture(texture.handle); |
| 649 | state.draw.read_framebuffer = read_fb_handle; | 649 | state.draw.read_framebuffer = read_fb_handle; |
| 650 | state.Apply(); | 650 | state.Apply(); |
| 651 | 651 | ||
diff --git a/src/video_core/renderer_opengl/gl_resource_manager.h b/src/video_core/renderer_opengl/gl_resource_manager.h index 93f9172e7..0fed93ca5 100644 --- a/src/video_core/renderer_opengl/gl_resource_manager.h +++ b/src/video_core/renderer_opengl/gl_resource_manager.h | |||
| @@ -38,7 +38,7 @@ public: | |||
| 38 | if (handle == 0) | 38 | if (handle == 0) |
| 39 | return; | 39 | return; |
| 40 | glDeleteTextures(1, &handle); | 40 | glDeleteTextures(1, &handle); |
| 41 | OpenGLState::GetCurState().ResetTexture(handle).Apply(); | 41 | OpenGLState::GetCurState().UnbindTexture(handle).Apply(); |
| 42 | handle = 0; | 42 | handle = 0; |
| 43 | } | 43 | } |
| 44 | 44 | ||
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 6e5f9a789..d1b3ad958 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp | |||
| @@ -48,12 +48,7 @@ OpenGLState::OpenGLState() { | |||
| 48 | logic_op = GL_COPY; | 48 | logic_op = GL_COPY; |
| 49 | 49 | ||
| 50 | for (auto& texture_unit : texture_units) { | 50 | for (auto& texture_unit : texture_units) { |
| 51 | texture_unit.texture_2d = 0; | 51 | texture_unit.Reset(); |
| 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; | ||
| 57 | } | 52 | } |
| 58 | 53 | ||
| 59 | lighting_lut.texture_buffer = 0; | 54 | lighting_lut.texture_buffer = 0; |
| @@ -338,10 +333,10 @@ void OpenGLState::Apply() const { | |||
| 338 | cur_state = *this; | 333 | cur_state = *this; |
| 339 | } | 334 | } |
| 340 | 335 | ||
| 341 | OpenGLState& OpenGLState::ResetTexture(GLuint handle) { | 336 | OpenGLState& OpenGLState::UnbindTexture(GLuint handle) { |
| 342 | for (auto& unit : texture_units) { | 337 | for (auto& unit : texture_units) { |
| 343 | if (unit.texture_2d == handle) { | 338 | if (unit.texture_2d == handle) { |
| 344 | unit.texture_2d = 0; | 339 | unit.Unbind(); |
| 345 | } | 340 | } |
| 346 | } | 341 | } |
| 347 | if (lighting_lut.texture_buffer == handle) | 342 | if (lighting_lut.texture_buffer == handle) |
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index 839e50e93..2e4cf2226 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h | |||
| @@ -91,6 +91,19 @@ public: | |||
| 91 | GLint b; // GL_TEXTURE_SWIZZLE_B | 91 | GLint b; // GL_TEXTURE_SWIZZLE_B |
| 92 | GLint a; // GL_TEXTURE_SWIZZLE_A | 92 | GLint a; // GL_TEXTURE_SWIZZLE_A |
| 93 | } swizzle; | 93 | } swizzle; |
| 94 | |||
| 95 | void Unbind() { | ||
| 96 | texture_2d = 0; | ||
| 97 | swizzle.r = GL_RED; | ||
| 98 | swizzle.g = GL_GREEN; | ||
| 99 | swizzle.b = GL_BLUE; | ||
| 100 | swizzle.a = GL_ALPHA; | ||
| 101 | } | ||
| 102 | |||
| 103 | void Reset() { | ||
| 104 | Unbind(); | ||
| 105 | sampler = 0; | ||
| 106 | } | ||
| 94 | } texture_units[32]; | 107 | } texture_units[32]; |
| 95 | 108 | ||
| 96 | struct { | 109 | struct { |
| @@ -165,7 +178,7 @@ public: | |||
| 165 | void Apply() const; | 178 | void Apply() const; |
| 166 | 179 | ||
| 167 | /// Resets any references to the given resource | 180 | /// Resets any references to the given resource |
| 168 | OpenGLState& ResetTexture(GLuint handle); | 181 | OpenGLState& UnbindTexture(GLuint handle); |
| 169 | OpenGLState& ResetSampler(GLuint handle); | 182 | OpenGLState& ResetSampler(GLuint handle); |
| 170 | OpenGLState& ResetProgram(GLuint handle); | 183 | OpenGLState& ResetProgram(GLuint handle); |
| 171 | OpenGLState& ResetPipeline(GLuint handle); | 184 | OpenGLState& ResetPipeline(GLuint handle); |