RESOLVED FIXED 215844
WebGL goes in a bad state where glContext.createProgram() returns null
https://bugs.webkit.org/show_bug.cgi?id=215844
Summary WebGL goes in a bad state where glContext.createProgram() returns null
jujjyl
Reported 2020-08-26 01:42:10 PDT
Running STP through emunittest suite, some of the tests fail with an error TypeError: null is not an object (evaluating 'program.name=id') in Emscripten WebGL library function glCreateProgram: function() { var id = GL.getNewId(GL.programs); var program = GLctx.createProgram(); program.name = id; GL.programs[id] = program; return id; }, Here GLctx is WebGLRenderingContext, and the return of GLctx.createProgram() comes out as null, causing the next line after that to fail. The issue can be reproduced on project http://clb.confined.space/emunittest_unity/Tanks_20191004_152744_wasm_release_profiling.zip
Attachments
Patch (1.38 KB, patch)
2020-08-26 16:58 PDT, James Darpinian
no flags
Patch (9.61 KB, patch)
2020-08-28 17:06 PDT, James Darpinian
no flags
Radar WebKit Bug Importer
Comment 1 2020-08-26 11:17:56 PDT
James Darpinian
Comment 2 2020-08-26 16:49:27 PDT
I'll take this one.
James Darpinian
Comment 3 2020-08-26 16:51:48 PDT
The context is lost. Looks like some texture uploads are triggering some GL errors in ANGLE (probably a different bug), and then GraphicsContextGLOpenGL::reshape() is bailing out because it assumes the GL error was caused by something it did. Easy fix, we can call moveErrorsToSyntheticErrorList() at the top of reshape(). Patch forthcoming.
James Darpinian
Comment 4 2020-08-26 16:58:12 PDT
James Darpinian
Comment 5 2020-08-26 16:59:04 PDT
Comment on attachment 407358 [details] Patch This fixes it. Need to write a test though.
Kenneth Russell
Comment 6 2020-08-26 17:45:18 PDT
Comment on attachment 407358 [details] Patch The fix looks good! Thanks in advance for writing a WebGL conformance test. r+
James Darpinian
Comment 7 2020-08-28 17:06:14 PDT
James Darpinian
Comment 8 2020-08-28 17:07:55 PDT
Comment on attachment 407518 [details] Patch Added a test.
James Darpinian
Comment 9 2020-08-28 23:52:03 PDT
Also I found and fixed the texture upload error issue in bug 215973. Seems like the Unity Tanks demo assumes that S3TC support implies S3TC sRGB support, which is technically wrong but probably should be true these days.
Kenneth Russell
Comment 10 2020-08-31 11:11:43 PDT
Comment on attachment 407518 [details] Patch Great diagnosis, fix and test James! One slight concern - if WebKit's WebGL conformance suite snapshot is rolled forward again using the LayoutTests/webgl/generate-webgl-tests.py script, your changes to LayoutTests/webgl/2.0.0/resources/webgl_test_files/conformance/canvas/render-after-resize-test.html will be overwritten, since that script simply copies the files into the WebKit repository, ignoring whether any changes were made locally. Now, any future rolls of this test snapshot will likely be small, since it's not under active development. Could you still think a little bit about this and decide whether it's worth preventing accidents in this area? Thanks.
James Darpinian
Comment 11 2020-08-31 11:24:00 PDT
True. Maybe I can just update the test in the 2.0.0 snapshot upstream.
James Darpinian
Comment 12 2020-08-31 11:26:44 PDT
Actually it looks like this test isn't included in the upstream 2.0.0 snapshot, so it won't be overwritten by the script.
EWS
Comment 13 2020-08-31 11:28:38 PDT
Committed r266362: <https://trac.webkit.org/changeset/266362> All reviewed patches have been landed. Closing bug and clearing flags on attachment 407518 [details].
Note You need to log in before you can comment on or make changes to this bug.