Bug 212277 - [ANGLE - iOS] webgl/1.0.3/conformance/extensions/ext-sRGB.html is failing
Summary: [ANGLE - iOS] webgl/1.0.3/conformance/extensions/ext-sRGB.html is failing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kenneth Russell
URL:
Keywords: InRadar
Depends on:
Blocks: 207858
  Show dependency treegraph
 
Reported: 2020-05-22 13:53 PDT by Justin Fan
Modified: 2020-05-22 19:26 PDT (History)
7 users (show)

See Also:


Attachments
Patch (5.20 KB, patch)
2020-05-22 18:21 PDT, Kenneth Russell
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Fan 2020-05-22 13:53:02 PDT
on iOS/Simulator, webgl/1.0.3/conformance/extensions/ext-sRGB.html is failing with the console message *** Error loading shader '[object WebGLShader]':INVALID_ENUM. Doing some digging to find exactly where in ANGLE the error is registered.
Comment 1 Radar WebKit Bug Importer 2020-05-22 13:53:18 PDT
<rdar://problem/63552939>
Comment 2 Justin Fan 2020-05-22 16:04:28 PDT
It appears a context error is being generated in rx::TextureGL::setImageHelper during texImage2D: an rx::CheckError call is handling an "Unexpected driver error." and bailing. Still not able to find what that error IS, though, and my breakpoints in WebKit and ANGLE's error generation functions aren't being hit before this point.
Comment 3 Justin Fan 2020-05-22 16:10:50 PDT
I think some sort of setup code for ANGLE's FunctionsGL is reporting an INVALID_ENUM error before texImage2D is called; the validation path for texImage2D is just stumbling upon it and bailing as a result.
Comment 4 Kenneth Russell 2020-05-22 16:49:58 PDT
I'll investigate this - already set up to do so.
Comment 5 Kenneth Russell 2020-05-22 17:08:49 PDT
Current output of the test:

Canvas.getContext
PASS context exists

Checking sRGB texture support with extension disabled

Checking texture formats
Checking valid formats
PASS not able to create invalid format: ext.SRGB_EXT
PASS not able to create invalid format: ext.SRGB_ALPHA_EXT

Checking invalid formats
PASS not able to create invalid format: ext.SRGB8_ALPHA8_EXT

Checking renderbuffer formats
Checking valid formats
PASS not able to create invalid format: ext.SRGB8_ALPHA8_EXT

Checking invalid formats
PASS not able to create invalid format: ext.SRGB_EXT
PASS not able to create invalid format: ext.SRGB_ALPHA_EXT

Checking sRGB texture support
PASS Successfully enabled EXT_sRGB extension
PASS EXT_sRGB listed as supported and getExtension succeeded

Checking extension constants values
PASS Value of SRGB_EXT was expected value: 35904
PASS Value of SRGB_ALPHA_EXT was expected value: 35906
PASS Value of SRGB8_ALPHA8_EXT was expected value: 35907
PASS Value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT was expected value: 33296

Checking texture formats
Checking valid formats
FAIL getError expected: NO_ERROR. Was INVALID_ENUM : was able to create type ext.SRGB_EXT
FAIL getError expected: NO_ERROR. Was INVALID_ENUM : was able to create type ext.SRGB_ALPHA_EXT

Checking invalid formats
PASS not able to create invalid format: ext.SRGB8_ALPHA8_EXT

Checking renderbuffer formats
Checking valid formats
PASS getError was expected value: NO_ERROR : was able to create type ext.SRGB8_ALPHA8_EXT

Checking invalid formats
PASS not able to create invalid format: ext.SRGB_EXT
PASS not able to create invalid format: ext.SRGB_ALPHA_EXT

Test the conversion of colors from sRGB to linear on texture read
PASS should be 0
PASS should be 13
PASS should be 54
PASS should be 133
PASS should be 255

Test sRGB framebuffer attachments. (Invalid)
FAIL getError expected: NO_ERROR. Was INVALID_ENUM : 
FAIL gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, ext.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT) should be 35904. Was 0.
PASS gl.checkFramebufferStatus(gl.FRAMEBUFFER) is gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT
FAIL getError expected: INVALID_FRAMEBUFFER_OPERATION. Was INVALID_VALUE : 

Test sRGB_ALPHA framebuffer attachments.
FAIL getError expected: NO_ERROR. Was INVALID_ENUM : 
FAIL gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, ext.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT) should be 35904. Was 0.
FAIL gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Was 36054.

Test the conversion of colors from linear to sRGB_ALPHA on framebuffer (texture) write
FAIL getError expected: NO_ERROR. Was INVALID_VALUE : 
PASS should be 0
FAIL getError expected: NO_ERROR. Was INVALID_FRAMEBUFFER_OPERATION : 
PASS should be 63
FAIL getError expected: NO_ERROR. Was INVALID_VALUE : 
PASS should be 127
FAIL getError expected: NO_ERROR. Was INVALID_FRAMEBUFFER_OPERATION : 
PASS should be 191
FAIL getError expected: NO_ERROR. Was INVALID_VALUE : 
PASS should be 255

Test the conversion of colors from linear to sRGB on framebuffer (renderbuffer) write
PASS getError was expected value: NO_ERROR : 
PASS getError was expected value: NO_ERROR : 
PASS gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, ext.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT) is ext.SRGB_EXT
PASS gl.checkFramebufferStatus(gl.FRAMEBUFFER) is gl.FRAMEBUFFER_COMPLETE
PASS should be 0
PASS should be 63
PASS should be 127
PASS should be 191
PASS should be 255

PASS successfullyParsed is true

TEST COMPLETE
Comment 6 Kenneth Russell 2020-05-22 17:23:35 PDT
Justin, your analysis is 100% correct. The error's caught by rx::CheckError in renderergl_utils.cpp. It's 0x0500 - GL_INVALID_ENUM - coming from the call to the driver:

glTexImage2D(GL_TEXTURE_2D, /* level */ 0, GL_SRGB_EXT, 16, 16, 0, GL_SRGB_EXT, GL_UNSIGNED_BYTE, nullptr);

ANGLE needs to translate these constants when running on an ES 3.0 driver that doesn't support GL_EXT_sRGB. Per other investigations on iOS in https://bugs.chromium.org/p/angleproject/issues/detail?id=4591 , these are the extensions the driver supports:

GL_OES_standard_derivatives
GL_EXT_color_buffer_half_float
GL_EXT_debug_label
GL_EXT_debug_marker
GL_EXT_pvrtc_sRGB
GL_EXT_read_format_bgra
GL_EXT_separate_shader_objects
GL_EXT_shader_framebuffer_fetch
GL_EXT_shader_texture_lod
GL_EXT_shadow_samplers
GL_EXT_texture_filter_anisotropic
GL_APPLE_clip_distance
GL_APPLE_color_buffer_packed_float
GL_APPLE_copy_texture_levels
GL_APPLE_rgb_422
GL_APPLE_texture_format_BGRA8888
GL_IMG_read_format
GL_IMG_texture_compression_pvrtc
Comment 7 Kenneth Russell 2020-05-22 17:25:39 PDT
Note that GL_SRGB_EXT == GL_SRGB in ES 3.0 == 0x8C40.
Comment 8 Kenneth Russell 2020-05-22 18:01:43 PDT
Translating the call to:

glTexImage2D(GL_TEXTURE_2D, /* level */ 0, GL_SRGB8, 16, 16, 0, GL_SRGB, GL_UNSIGNED_BYTE, nullptr);

is still generating a GL_INVALID_OPERATION in the driver. Still investigating.
Comment 9 Kenneth Russell 2020-05-22 18:07:12 PDT
Have to translate the format to a non-sRGB format, too.
Comment 10 Kenneth Russell 2020-05-22 18:21:10 PDT
Created attachment 400098 [details]
Patch
Comment 11 EWS Watchlist 2020-05-22 18:21:39 PDT
Note that there are important steps to take when updating ANGLE. See http://trac.webkit.org/wiki/UpdatingANGLE
Comment 12 Kenneth Russell 2020-05-22 18:22:07 PDT
Patch is up for review. This makes ext-sRGB.html pass locally on the iOS Simulator.

Since the CQ doesn't seem to wait for the ios-wk2 bot to finish, I'd like to set the CQ bit on this myself after review, once all the EWS bots have passed.
Comment 13 Kenneth Russell 2020-05-22 18:41:50 PDT
Actually - in case I'm out, Dean, would you mind CQ+'ing this if it passes all the bots? Thanks.
Comment 14 Dean Jackson 2020-05-22 19:09:51 PDT
windows test failure is unrelated (imported/blink/fast/css/fixed-overlaps-absolute-in-clip.html)
Comment 15 EWS 2020-05-22 19:26:33 PDT
Committed r262091: <https://trac.webkit.org/changeset/262091>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 400098 [details].