Bug 169999

Summary: texImage2D for a half-float texture only accepts null
Product: WebKit Reporter: Florian Bösch <pyalot>
Component: WebGLAssignee: Dean Jackson <dino>
Status: RESOLVED FIXED    
Severity: Normal CC: alonzakai, cdumez, dino, esprehn+autocc, ews-watchlist, graouts, gyuyoung.kim, jonlee, jonobrandel, jujjyl, justin_fan, kdmitrenko, kondapallykalyan, marcin.ignac, nkronlage, simon.fraser, stefan, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 10   
Hardware: iPhone / iPad   
OS: iOS 10   
Attachments:
Description Flags
Patch
simon.fraser: review+
EWS run 2 none

Description Florian Bösch 2017-03-23 01:42:10 PDT
Calling texImage2D for a half-float texture only accepts null on iOS. The WebGL specification states that acceptable values are null,

- The specification states that texImage2D for half-float has to accept null, Uint16Array, <image>, <video> and <canvas>: https://www.khronos.org/registry/webgl/extensions/OES_texture_half_float/
- The conformance test for WebGL tests for the upload behavior fails on iOS: https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/oes-texture-half-float.html
Comment 1 Marcin Ignac 2017-04-19 06:26:29 PDT
Just run into the same issue as well. The conformance suite fails in

Version 10.1 (12603.1.30.0.34)
Release 27 (Safari 10.2, WebKit 12604.1.15.2)
Comment 2 Radar WebKit Bug Importer 2017-04-19 12:08:45 PDT
<rdar://problem/31713571>
Comment 3 stefan 2018-01-16 07:14:44 PST
Tested on OSX/macOS 10.12, Safari Technology Preview (Release 47, Safari 11.1, WebKit 12605.1.19.1)

-go to https://files.unity3d.com/stefan/bugs/webkit_errors/index.html
--this is just a default empty scene from lates Unity (2017.3)
-open browser console
-see the following error being logged twice:
--WebGL: INVALID_OPERATION: texImage2D: type HALF_FLOAT_OES but ArrayBufferView is not NULL

-appears to have no visual effects on the scene
-error is not being thrown on latest Firefox or Chrome on same OSX
Comment 4 jonobr1 2018-10-21 23:55:40 PDT
I'm running into the same issue as well. Found in this bug: https://bugs.webkit.org/show_bug.cgi?id=183321
Comment 5 jujjyl 2019-08-07 08:03:06 PDT
Unity3D engine runs into this issue as well.

Safari 8 - Safari 12 are affected.

Tested as a workaround to use GL.texImage2D(..., null); to create an uninitialized texture, but then immediately afterwards using GL.texSubImage2D(..., /*type=*/0x8d61/*GL_HALF_FLOAT_OES*/, uint16Array); to upload the content, but unfortunately that fails too, i.e. GL.texSubImage2D() neither allows passing a half-float array.

Also tried a workaround to pass a Float32Array, or a Float64Array instead of a Uint16Array, wishfully thinking that perhaps the error message would be wrong, and half-float textures could be populated by submitting another array type instead, but that does not work either.

As result, Unity3D support of half-float textures is disabled, which prevents Safari from running new Unity3D content, which utilize half-floats.
Comment 6 Dean Jackson 2019-10-17 18:28:51 PDT
Created attachment 381258 [details]
Patch
Comment 7 Dean Jackson 2019-10-17 18:31:59 PDT
*** Bug 183321 has been marked as a duplicate of this bug. ***
Comment 8 Dean Jackson 2019-10-18 14:43:55 PDT
Created attachment 381332 [details]
EWS run 2
Comment 9 Dean Jackson 2019-10-18 15:30:28 PDT
Committed r251303: <https://trac.webkit.org/changeset/251303>