Bug 171432

Summary: gl.readPixels with type gl.FLOAT does not work
Product: WebKit Reporter: aaron.montag
Component: WebGLAssignee: Dean Jackson <dino>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, dino, esprehn+autocc, ews-watchlist, graouts, graouts, gyuyoung.kim, kondapallykalyan, michael.herzog, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 10   
Hardware: Mac   
OS: macOS 10.12   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews122 for ios-simulator-wk2
none
Patch graouts: review+

Description aaron.montag 2017-04-28 08:22:38 PDT
Although floating point textures are supported through the "OES_texture_float" extension, reading back the pixels with

gl.readPixels(x, y, width, height, gl.RGBA, gl.FLOAT, pixels);

throws an error:

"WebGL: INVALID_ENUM: readPixels: invalid type"

A running example: https://cindyjs.org/examples/cindygl/34_cpuimagergba.html (It works with recent versions of Chromium and Firefox)
Comment 1 Radar WebKit Bug Importer 2017-04-29 10:05:51 PDT
<rdar://problem/31905150>
Comment 2 Michael Herzog 2019-02-14 03:31:38 PST
One of the three.js example demonstrates the bug, too. It is broken since a while now. A fix for this issue would be great.

https://threejs.org/examples/webgl_read_float_buffer.html
Comment 3 Dean Jackson 2019-03-29 17:57:25 PDT
Created attachment 366336 [details]
Patch
Comment 4 EWS Watchlist 2019-03-29 17:59:58 PDT
Attachment 366336 [details] did not pass style-queue:


ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3545:  One line control clauses should not use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3547:  One line control clauses should not use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3563:  Extra space before )  [whitespace/parens] [2]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3564:  Extra space before )  [whitespace/parens] [2]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3565:  Extra space before )  [whitespace/parens] [2]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3566:  Extra space before )  [whitespace/parens] [2]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3567:  Extra space before )  [whitespace/parens] [2]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3569:  Extra space before )  [whitespace/parens] [2]
Total errors found: 8 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 EWS Watchlist 2019-03-29 22:23:30 PDT
Comment on attachment 366336 [details]
Patch

Attachment 366336 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/11709880

New failing tests:
fast/canvas/webgl/readPixels-float.html
Comment 6 EWS Watchlist 2019-03-29 22:23:31 PDT
Created attachment 366357 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 7 Dean Jackson 2019-03-30 12:39:54 PDT
Created attachment 366365 [details]
Patch
Comment 8 EWS Watchlist 2019-03-30 12:42:48 PDT
Attachment 366365 [details] did not pass style-queue:


ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3545:  One line control clauses should not use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3547:  One line control clauses should not use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3563:  Extra space before )  [whitespace/parens] [2]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3564:  Extra space before )  [whitespace/parens] [2]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3565:  Extra space before )  [whitespace/parens] [2]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3566:  Extra space before )  [whitespace/parens] [2]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3567:  Extra space before )  [whitespace/parens] [2]
ERROR: Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3569:  Extra space before )  [whitespace/parens] [2]
Total errors found: 8 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Antoine Quint 2019-03-30 14:28:42 PDT
Comment on attachment 366365 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=366365&action=review

> Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3547
> +        }

Style checker isn’t happy here, with reason!
Comment 10 Dean Jackson 2019-03-30 15:03:24 PDT
Comment on attachment 366365 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=366365&action=review

>> Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3547
>> +        }
> 
> Style checker isn’t happy here, with reason!

Nope, that's a style checker issue. This single line is a macro that's expanded to multiple statements.
Comment 11 Dean Jackson 2019-03-30 15:07:36 PDT
Committed r243681: <https://trac.webkit.org/changeset/243681>