diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-08-30 13:41:28 +0200 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-09-03 20:09:50 +0200 |
commit | ec28f037e6cfe42c3285866572af075e1e72b3e9 (patch) | |
tree | 861ec1bf3da3a500b1e4ea7158aa0c59576884c3 /src/video_core/renderer_opengl/gl_state.cpp | |
parent | citra-qt: Move system shutdown to run inside EmuThread (diff) | |
download | yuzu-ec28f037e6cfe42c3285866572af075e1e72b3e9.tar yuzu-ec28f037e6cfe42c3285866572af075e1e72b3e9.tar.gz yuzu-ec28f037e6cfe42c3285866572af075e1e72b3e9.tar.bz2 yuzu-ec28f037e6cfe42c3285866572af075e1e72b3e9.tar.lz yuzu-ec28f037e6cfe42c3285866572af075e1e72b3e9.tar.xz yuzu-ec28f037e6cfe42c3285866572af075e1e72b3e9.tar.zst yuzu-ec28f037e6cfe42c3285866572af075e1e72b3e9.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_state.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index ba47ce8b8..e02c27fbf 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -44,6 +44,7 @@ OpenGLState::OpenGLState() { for (auto& texture_unit : texture_units) { texture_unit.texture_2d = 0; + texture_unit.sampler = 0; } draw.framebuffer = 0; @@ -154,10 +155,13 @@ void OpenGLState::Apply() { } // Textures - for (unsigned texture_index = 0; texture_index < ARRAY_SIZE(texture_units); ++texture_index) { - if (texture_units[texture_index].texture_2d != cur_state.texture_units[texture_index].texture_2d) { - glActiveTexture(GL_TEXTURE0 + texture_index); - glBindTexture(GL_TEXTURE_2D, texture_units[texture_index].texture_2d); + for (unsigned i = 0; i < ARRAY_SIZE(texture_units); ++i) { + if (texture_units[i].texture_2d != cur_state.texture_units[i].texture_2d) { + glActiveTexture(GL_TEXTURE0 + i); + glBindTexture(GL_TEXTURE_2D, texture_units[i].texture_2d); + } + if (texture_units[i].sampler != cur_state.texture_units[i].sampler) { + glBindSampler(i, texture_units[i].sampler); } } @@ -192,6 +196,14 @@ void OpenGLState::ResetTexture(GLuint id) { } } +void OpenGLState::ResetSampler(GLuint id) { + for (auto& unit : cur_state.texture_units) { + if (unit.sampler == id) { + unit.sampler = 0; + } + } +} + void OpenGLState::ResetProgram(GLuint id) { if (cur_state.draw.shader_program == id) { cur_state.draw.shader_program = 0; |