gl.readPixels with type gl.FLOAT does not work
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Mar 2019 22:07:21 +0000 (22:07 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Mar 2019 22:07:21 +0000 (22:07 +0000)
commite07957a9eea17979e54f40fa951b90a111af8b95
treedb93309324b47dc5ca4f9aba21e26c4ead3daa3e
parent22326636be90f7cacc575ed16374f564308797e5
gl.readPixels with type gl.FLOAT does not work
https://bugs.webkit.org/show_bug.cgi?id=171432
<rdar://problem/31905150>

Reviewed by Antoine Quint.

Source/WebCore:

Our validation code was identifying readPixels of
type FLOAT as invalid, for three reasons:
- we didn't support the FLOAT type at all.
- we only allowed the combination of RGBA and
UNSIGNED_BYTE in WebGL 1 [*].
- if we had a framebuffer of format RGBA, we assumed
we could only read into a Uint8 ArrayBuffer.

[*] This bug isn't completely fixed, so I opened
https://bugs.webkit.org/show_bug.cgi?id=196418

Test: fast/canvas/webgl/readPixels-float.html

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::readPixels):
- flip the logic in a conditional that was clearly wrong yet
  thankfully had no impact.
- support type FLOAT when the relevant extension is enabled.
- allow FLOAT as a valid type (see new bug above)
- create a new macro for CHECK_COMPONENT_COUNT
- update the existing macros to not be case statements,
  so that we can put logic in the switch.

LayoutTests:

New test that exercises reading a framebuffer object
with a floating point texture attached.

* platform/ios/TestExpectations: Skip this test on iOS, where floating-point
FBOs are not supported.
* fast/canvas/webgl/readPixels-float-expected.txt: Added.
* fast/canvas/webgl/readPixels-float.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243681 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/readPixels-float-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/webgl/readPixels-float.html [new file with mode: 0644]
LayoutTests/platform/ios/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp