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