Title: [110477] trunk/Source/WebCore
Revision
110477
Author
[email protected]
Date
2012-03-12 14:15:23 -0700 (Mon, 12 Mar 2012)

Log Message

Make texImage2D error for wrong size ArrayBufferView more helpful
https://bugs.webkit.org/show_bug.cgi?id=80868

It took me about 30 minutes to figure out my texImage2D was failing
not because my ArrayBufferView was too small but because the default
alignment is 4. A better error message might help devs find this issue
faster.

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

No new tests as no new functionality.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::validateTexFuncData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (110476 => 110477)


--- trunk/Source/WebCore/ChangeLog	2012-03-12 21:08:22 UTC (rev 110476)
+++ trunk/Source/WebCore/ChangeLog	2012-03-12 21:15:23 UTC (rev 110477)
@@ -1,3 +1,21 @@
+2012-03-12  Gregg Tavares  <[email protected]>
+
+        Make texImage2D error for wrong size ArrayBufferView more helpful
+        https://bugs.webkit.org/show_bug.cgi?id=80868
+        
+        It took me about 30 minutes to figure out my texImage2D was failing
+        not because my ArrayBufferView was too small but because the default
+        alignment is 4. A better error message might help devs find this issue
+        faster.
+
+        Reviewed by Kenneth Russell.
+
+        No new tests as no new functionality.
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore):
+        (WebCore::WebGLRenderingContext::validateTexFuncData):
+
 2012-03-12  Tim Horton  <[email protected]>
 
         Infinite repaint loop with SVGImageCache and deferred repaint timers

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (110476 => 110477)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2012-03-12 21:08:22 UTC (rev 110476)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2012-03-12 21:15:23 UTC (rev 110477)
@@ -4755,6 +4755,13 @@
         return false;
     }
     if (pixels->byteLength() < totalBytesRequired) {
+        if (m_unpackAlignment != 1) {
+          error = m_context->computeImageSizeInBytes(format, type, width, height, 1, &totalBytesRequired, 0);
+          if (pixels->byteLength() == totalBytesRequired) {
+            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "ArrayBufferView not big enough for request with UNPACK_ALIGNMENT > 1");
+            return false;
+          }
+        }
         synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "ArrayBufferView not big enough for request");
         return false;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to