Title: [131261] trunk/Source/WebCore
Revision
131261
Author
[email protected]
Date
2012-10-13 10:55:36 -0700 (Sat, 13 Oct 2012)

Log Message

Add warning for unrenderable textures
https://bugs.webkit.org/show_bug.cgi?id=99235

Patch by Gregg Tavares <[email protected]> on 2012-10-13
Reviewed by Kenneth Russell.

Unrenderable textures are often hard to debug. Adds a message to that
appears in the _javascript_ console to help developers find the issue.

No new tests as no new functionality.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::drawArrays):
(WebCore::WebGLRenderingContext::drawElements):
(WebCore::WebGLRenderingContext::handleNPOTTextures):
* html/canvas/WebGLRenderingContext.h:
(WebGLRenderingContext):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (131260 => 131261)


--- trunk/Source/WebCore/ChangeLog	2012-10-13 17:04:00 UTC (rev 131260)
+++ trunk/Source/WebCore/ChangeLog	2012-10-13 17:55:36 UTC (rev 131261)
@@ -1,3 +1,23 @@
+2012-10-13  Gregg Tavares  <[email protected]>
+
+        Add warning for unrenderable textures
+        https://bugs.webkit.org/show_bug.cgi?id=99235
+
+        Reviewed by Kenneth Russell.
+
+        Unrenderable textures are often hard to debug. Adds a message to that
+        appears in the _javascript_ console to help developers find the issue.
+
+        No new tests as no new functionality.
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore):
+        (WebCore::WebGLRenderingContext::drawArrays):
+        (WebCore::WebGLRenderingContext::drawElements):
+        (WebCore::WebGLRenderingContext::handleNPOTTextures):
+        * html/canvas/WebGLRenderingContext.h:
+        (WebGLRenderingContext):
+
 2012-10-13  Geoffrey Garen  <[email protected]>
 
         Not reviewed.

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (131260 => 131261)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2012-10-13 17:04:00 UTC (rev 131260)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2012-10-13 17:55:36 UTC (rev 131261)
@@ -1911,12 +1911,12 @@
     if (!isGLES2Compliant())
         vertexAttrib0Simulated = simulateVertexAttrib0(first + count - 1);
     if (!isGLES2NPOTStrict())
-        handleNPOTTextures(true);
+        handleNPOTTextures("drawArrays", true);
     m_context->drawArrays(mode, first, count);
     if (!isGLES2Compliant() && vertexAttrib0Simulated)
         restoreStatesAfterVertexAttrib0Simulation();
     if (!isGLES2NPOTStrict())
-        handleNPOTTextures(false);
+        handleNPOTTextures("drawArrays", false);
     cleanupAfterGraphicsCall(true);
 }
 
@@ -1990,12 +1990,12 @@
         vertexAttrib0Simulated = simulateVertexAttrib0(numElements);
     }
     if (!isGLES2NPOTStrict())
-        handleNPOTTextures(true);
+        handleNPOTTextures("drawElements", true);
     m_context->drawElements(mode, count, type, static_cast<GC3Dintptr>(offset));
     if (!isGLES2Compliant() && vertexAttrib0Simulated)
         restoreStatesAfterVertexAttrib0Simulation();
     if (!isGLES2NPOTStrict())
-        handleNPOTTextures(false);
+        handleNPOTTextures("drawElements", false);
     cleanupAfterGraphicsCall(true);
 }
 
@@ -4570,7 +4570,7 @@
     return WebGLGetInfo(Int32Array::create(value, length));
 }
 
-void WebGLRenderingContext::handleNPOTTextures(bool prepareToDraw)
+void WebGLRenderingContext::handleNPOTTextures(const char* functionName, bool prepareToDraw)
 {
     bool resetActiveUnit = false;
     for (unsigned ii = 0; ii < m_textureUnits.size(); ++ii) {
@@ -4586,6 +4586,9 @@
             WebGLTexture* tex2D;
             WebGLTexture* texCubeMap;
             if (prepareToDraw) {
+                String msg(String("texture bound to texture unit ") + String::number(ii)
+                    + " is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'");
+                printGLWarningToConsole(functionName, msg.utf8().data());
                 tex2D = m_blackTexture2D.get();
                 texCubeMap = m_blackTextureCubeMap.get();
             } else {

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h (131260 => 131261)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h	2012-10-13 17:04:00 UTC (rev 131260)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h	2012-10-13 17:55:36 UTC (rev 131261)
@@ -541,7 +541,7 @@
                            GC3Denum format, GC3Denum type,
                            Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode&);
 
-    void handleNPOTTextures(bool prepareToDraw);
+    void handleNPOTTextures(const char*, bool);
 
     void createFallbackBlackTextures1x1();
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to