GraphicsContext3D::activeTexture should not be called with zero-based index
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Aug 2015 00:27:00 +0000 (00:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Aug 2015 00:27:00 +0000 (00:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148020

Patch by Jinyoung Hur <hur.ims@navercorp.com> on 2015-08-19
Reviewed by Alex Christensen.

Source/WebCore:

GraphicsContext3D::activeTexture should be called with an argument that is greater than or equal to
GraphicsContext3D::TEXTURE0.

Test: fast/canvas/webgl/texture-complete.html

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::checkTextureCompleteness):

LayoutTests:

Insert WebGLRenderingContext.activeTexture call during the texture complete test to verify
a meaningless change of the active texture doesn't make any gl errors.

* fast/canvas/webgl/texture-complete.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188666 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/texture-complete-expected.txt
LayoutTests/fast/canvas/webgl/texture-complete.html
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

index fe0490c..306a54f 100644 (file)
@@ -1,3 +1,15 @@
+2015-08-19  Jinyoung Hur  <hur.ims@navercorp.com>
+
+        GraphicsContext3D::activeTexture should not be called with zero-based index
+        https://bugs.webkit.org/show_bug.cgi?id=148020
+
+        Reviewed by Alex Christensen.
+
+        Insert WebGLRenderingContext.activeTexture call during the texture complete test to verify
+        a meaningless change of the active texture doesn't make any gl errors.
+
+        * fast/canvas/webgl/texture-complete.html:
+
 2015-08-19  Zalan Bujtas  <zalan@apple.com>
 
         outline-style: auto leaves bits behind on strava's flyby view.
index 8b5ff70..ce1841a 100644 (file)
@@ -2,6 +2,9 @@
 Checks that a texture that is not -texture-complete- does not draw if filtering needs mips
 
 PASS texture that is not -texture-complete- when TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255
+PASS getError was expected value: NO_ERROR : Should be no errors from setup.
+PASS meaningless change of the active texture should not affect the black-texture fallback.
+PASS getError was expected value: NO_ERROR : Should be no errors from setup.
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 2864d6b..7e32b73 100644 (file)
@@ -90,6 +90,13 @@ function init()
   checkBuffer(0,0,0,255,
       "texture that is not -texture-complete- when " +
       "TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255");
+  glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
+
+  gl.activeTexture(gl.TEXTURE1);
+  checkBuffer(0,0,0,255,
+      "meaningless change of the active texture should not affect the black-texture fallback.");
+  glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
+  gl.activeTexture(gl.TEXTURE0);
 
   function checkBuffer(r, g, b, a, msg) {
     gl.clearColor(1,1,1,1);
index d739045..2490ab9 100644 (file)
@@ -1,3 +1,18 @@
+2015-08-19  Jinyoung Hur  <hur.ims@navercorp.com>
+
+        GraphicsContext3D::activeTexture should not be called with zero-based index
+        https://bugs.webkit.org/show_bug.cgi?id=148020
+
+        Reviewed by Alex Christensen.
+
+        GraphicsContext3D::activeTexture should be called with an argument that is greater than or equal to 
+        GraphicsContext3D::TEXTURE0.
+
+        Test: fast/canvas/webgl/texture-complete.html
+
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::checkTextureCompleteness):
+
 2015-08-19  Chris Dumez  <cdumez@apple.com>
 
         Avoid double hash lookup in our JS bindings named property getter code
index 0bc1c6c..40539d6 100644 (file)
@@ -4035,10 +4035,10 @@ void WebGLRenderingContextBase::checkTextureCompleteness(const char* functionNam
         if ((m_textureUnits[ii].texture2DBinding && m_textureUnits[ii].texture2DBinding->needToUseBlackTexture(extensions))
             || (m_textureUnits[ii].textureCubeMapBinding && m_textureUnits[ii].textureCubeMapBinding->needToUseBlackTexture(extensions))) {
             if (ii != m_activeTextureUnit) {
-                m_context->activeTexture(ii);
+                m_context->activeTexture(ii + GraphicsContext3D::TEXTURE0);
                 resetActiveUnit = true;
             } else if (resetActiveUnit) {
-                m_context->activeTexture(ii);
+                m_context->activeTexture(ii + GraphicsContext3D::TEXTURE0);
                 resetActiveUnit = false;
             }
             WebGLTexture* tex2D;
@@ -4061,7 +4061,7 @@ void WebGLRenderingContextBase::checkTextureCompleteness(const char* functionNam
         }
     }
     if (resetActiveUnit)
-        m_context->activeTexture(m_activeTextureUnit);
+        m_context->activeTexture(m_activeTextureUnit + GraphicsContext3D::TEXTURE0);
 }
 
 void WebGLRenderingContextBase::createFallbackBlackTextures1x1()