소스 검색

GL Renderer: Remove erroneous glEnable(GL_TEXTURE_2D) calls

In OpenGL 3, texturing is always enabled, and this call is invalid.
While it produced no effect in the rest of the execution, it wouldn't
have the intended effect of disabling texturing for that unit. Instead
bind a null texture to the unit.
Yuri Kunde Schlesner 11 년 전
부모
커밋
e5c4fe0098
1개의 변경된 파일5개의 추가작업 그리고 8개의 파일을 삭제
  1. 5 8
      src/video_core/renderer_opengl/gl_state.cpp

+ 5 - 8
src/video_core/renderer_opengl/gl_state.cpp

@@ -147,20 +147,17 @@ void OpenGLState::Apply() {
 
     // Textures
     for (unsigned texture_index = 0; texture_index < ARRAY_SIZE(texture_units); ++texture_index) {
-        if (texture_units[texture_index].enabled_2d != cur_state.texture_units[texture_index].enabled_2d) {
+        if (texture_units[texture_index].enabled_2d != cur_state.texture_units[texture_index].enabled_2d ||
+            texture_units[texture_index].texture_2d != cur_state.texture_units[texture_index].texture_2d) {
+
             glActiveTexture(GL_TEXTURE0 + texture_index);
 
             if (texture_units[texture_index].enabled_2d) {
-                glEnable(GL_TEXTURE_2D);
+                glBindTexture(GL_TEXTURE_2D, texture_units[texture_index].texture_2d);
             } else {
-                glDisable(GL_TEXTURE_2D);
+                glBindTexture(GL_TEXTURE_2D, 0);
             }
         }
-
-        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);
-        }
     }
 
     // Framebuffer