aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_opengl/gl_state.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-11-24 19:36:30 -0500
committerGitHub <noreply@github.com>2019-11-24 19:36:30 -0500
commitb03242067d9ba9e3ad9804d2ccfe596f45da6ba6 (patch)
tree386c8566d385869702b34ddb00ff58f7e8e275bf /src/video_core/renderer_opengl/gl_state.cpp
parentb7031b2b9d6c886b0d5c39994e3b978af8370ea6 (diff)
parentdc2e83fa31a7bd3a7e1f1deb6f41cdb62be5f46e (diff)
Merge pull request #3098 from ReinUsesLisp/shader-invalidations
gl_shader_cache: Miscellaneous changes to shaders
Diffstat (limited to 'src/video_core/renderer_opengl/gl_state.cpp')
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index ccbe5912e..39b3986d3 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -417,14 +417,24 @@ void OpenGLState::ApplyClipControl() {
}
void OpenGLState::ApplyTextures() {
- if (const auto update = UpdateArray(cur_state.textures, textures)) {
- glBindTextures(update->first, update->second, textures.data() + update->first);
+ const std::size_t size = std::size(textures);
+ for (std::size_t i = 0; i < size; ++i) {
+ if (UpdateValue(cur_state.textures[i], textures[i])) {
+ // BindTextureUnit doesn't support binding null textures, skip those binds.
+ // TODO(Rodrigo): Stop using null textures
+ if (textures[i] != 0) {
+ glBindTextureUnit(static_cast<GLuint>(i), textures[i]);
+ }
+ }
}
}
void OpenGLState::ApplySamplers() {
- if (const auto update = UpdateArray(cur_state.samplers, samplers)) {
- glBindSamplers(update->first, update->second, samplers.data() + update->first);
+ const std::size_t size = std::size(samplers);
+ for (std::size_t i = 0; i < size; ++i) {
+ if (UpdateValue(cur_state.samplers[i], samplers[i])) {
+ glBindSampler(static_cast<GLuint>(i), samplers[i]);
+ }
}
}