summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_state.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/renderer_opengl/gl_state.cpp')
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index f25148362..39b3986d3 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -410,15 +410,31 @@ void OpenGLState::ApplyAlphaTest() {
}
}
+void OpenGLState::ApplyClipControl() {
+ if (UpdateValue(cur_state.clip_control.origin, clip_control.origin)) {
+ glClipControl(clip_control.origin, GL_NEGATIVE_ONE_TO_ONE);
+ }
+}
+
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]);
+ }
}
}
@@ -453,6 +469,7 @@ void OpenGLState::Apply() {
ApplyImages();
ApplyPolygonOffset();
ApplyAlphaTest();
+ ApplyClipControl();
}
void OpenGLState::EmulateViewportWithScissor() {