View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0032081 | Open CASCADE | OCCT:Visualization | public | 2021-01-24 12:18 | 2021-02-15 09:34 |
Reporter | kgv | Assigned To | bugmaster | ||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Platform | Mac | OS | OS | ||
Product Version | 7.5.0 | ||||
Target Version | 7.6.0 | Fixed in Version | 7.6.0 | ||
Summary | 0032081: Visualization - WebGL sample errors when run in Safari browser with WebGL 1.0 | ||||
Description | Running WebGL sample in Safari browser v.14.0 (reproduced on both macOS / iOS) produces numerous OpenGL errors and doen't show anything on the screen. The problems starts from the fact, that Safari still doesn't support WebGL 2.0. However, WebGL sample is expected to run in both WebGL 1.0 and 2.0 modes, preferring the second option when available - managed by "-s USE_WEBGL2=1" Emscripten option. This works as expected in other tested browsers (Firefox, Chromium-based), but in Safari glGetString(GL_VERSION) returns a peculiar thing: > "OpenGL ES 3.0 (WebGL 1.0)" pretending that OpenGL ES 3.0 is available and implemented on top of WebGL 1.0. Of course, this cannot be true (WebGL 1.0 can barely used to implement OpenGL ES 3.0), and even detecting such string in OCCT to fallback to OpenGL ES 2.0 doesn't help, as even built-in GL functions implemented by Emscripten SDK misbehavior in attempt to use WebGL 2.0 features like glBufferSubData() implementation optimizations: function _glBufferSubData(target, offset, size, data) { if (GL.currentContext.version >= 2) { // WebGL 2 provides new garbage-free entry points to call to WebGL. // Use those always when possible. GLctx.bufferSubData(target, offset, HEAPU8, data, size); return; } GLctx.bufferSubData(target, offset, HEAPU8.subarray(data, data+size)); } As result, it is merely possible to run OCCT WebGL sample in Safari with "-s USE_WEBGL2=1" option, even with some hacks-workarounds in OCCT code. After some tests it was observed that replacing "-s USE_WEBGL2=1" flag with > "-s MAX_WEBGL_VERSION=2" produces expected behavior in Safari. It looks like a bug in Emscripten as it is unclear how/why USE_WEBGL2=1 and MAX_WEBGL_VERSION=2 flags should be different, and changelog doesn't mention USE_WEBGL2 deprecation - it just no more referred in main documentation, although obviously still processed somehow. Nevertheless, it is proposed using "MAX_WEBGL_VERSION=2" option in WebGL sample following actual Emscripten documentation. USE_WEBGL2=1 has been added in Emscripten v1.25.2 (10/16/2014) - Added experimental WebGL 2.0 support with the linker flag -s USE_WEBGL2=1 (#2873). and deprecated probably since Emscripten v1.39.5 (12/20/2019): https://github.com/emscripten-core/emscripten/pull/10020 | ||||
Steps To Reproduce | Run WebGL sample in Safari.NbLogicalProcessors: 1 Warning! OpenGL context reports version 3.0 but WebGL 2.0 was unavailable Fallback to OpenGL ES 2.0 will be used instead of reported version EGLVersion: 1.4 Emscripten EGL EGLVendor: Emscripten EGLClientAPIs: OpenGL_ES GLvendor: WebKit GLdevice: WebKit WebGL GLunmaskedVendor: Apple Inc. GLunmaskedDevice: Apple GPU GLversion: OpenGL ES 3.0 (WebGL 1.0) GLSL: OpenGL ES GLSL ES 1.00 (WebGL GLSL ES 1.0 (1.0)) Max texture size: 16384 Max FBO dump size: 8192x8192 Max combined texture units: 32 Max MSAA samples: 0 Viewport: 1294x430 GLextensions: EXT_blend_minmax EXT_sRGB EXT_frag_depth OES_texture_float OES_texture_float_linear OES_texture_half_float OES_texture_half_float_linear OES_standard_derivatives EXT_shader_texture_lod EXT_texture_filter_anisotropic OES_vertex_array_object OES_element_index_uint WEBGL_lose_context WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_depth_texture WEBGL_draw_buffers ANGLE_instanced_arrays WEBGL_debug_shaders WEBGL_debug_renderer_info EXT_color_buffer_half_float WEBGL_color_buffer_float GL_EXT_blend_minmax GL_EXT_sRGB GL_EXT_frag_depth GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_standard_derivatives GL_EXT_shader_texture_lod GL_EXT_texture_filter_anisotropic GL_OES_vertex_array_object GL_OES_element_index_uint GL_WEBGL_lose_context GL_WEBGL_compressed_texture_s3tc GL_WEBGL_compressed_texture_s3tc_srgb GL_WEBGL_depth_texture GL_WEBGL_draw_buffers GL_ANGLE_instanced_arrays GL_WEBGL_debug_shaders GL_WEBGL_debug_renderer_info GL_EXT_color_buffer_half_float GL_WEBGL_color_buffer_float ResolutionRatio: 1.33333 Display scale: 1 Font_FontMgr, error: unable to find any font! TKOpenGl | Type: Error | ID: 0 | Severity: High | Message: Error: 2D texture 4096x32 IF: GL_ALPHA PF: GL_ALPHA DT: GL_UNSIGNED_BYTE can not be created with error GL_INVALID_OPERATION. ... [Error] WebGL: INVALID_VALUE: bufferSubData: offset out of range Error: glBufferData() failed with GL_INVALID_OPERATION TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message: VBO creation for Primitive Array has failed for 24 vertices. Out of memory? | ||||
Additional information and documentation updates | In Safari 14 with experimental WebGL 2.0 disabled, canvas.getContext("webgl2") returns NULL first time. However calling the same method after creation of WebGL 1.0 context suddenly returns non-NULL context! This is inconsistent with other browsers and causes Emscripten to misbehave if context creation routines are called multiple times (with intention to re-use existing context). https://github.com/emscripten-core/emscripten/issues/13295 | ||||
Tags | No tags attached. | ||||
Test case number | Not required | ||||
related to | 0032082 | closed | kgv | Open CASCADE | Visualization, TKOpenGl - improve formatting of error messages |
related to | 0032083 | closed | bugmaster | Open CASCADE | Visualization, TKOpenGl - PBR rendering is unavailable on Apple A12 Bionic (iPad) |
related to | 0032084 | closed | bugmaster | Open CASCADE | Visualization - WebGL sample errors when run in Safari browser with experimental WebGL 2.0 option |
|
Branch CR32081_0 has been created by kgv. SHA-1: b91233e111e1c3fda973a8bd4f0d1a24044b368b Detailed log of new commits: Author: kgv Date: Wed Jan 27 02:32:13 2021 +0300 0032081: Visualization - WebGL sample errors when run in Safari browser with WebGL 1.0 Use "#define occLight_Index(theId) 0" hack to allow compiling a single light source PBR shading program on OpenGL ES 2.0 disallowing non-constant index expressions. PBR lookup table is now automatically resized to RGBA format when RG texture format is unsupported (OpenGL ES 2.0). OpenGl_ShaderManager now allows compiling PBR shaders using WebGL 1.0 + GL_EXT_shader_texture_lod extension. PBR baking GLSL program now uses mod() instead of % operator for compatibility. Vertex shader has been redisigned to use if/else to avoid non-constant index expressions. OpenGl_PBREnvironment now uses GL_FRAMEBUFFER instead of GL_DRAW_FRAMEBUFFER for compatibility with OpenGL ES 2.0. |
|
Branch CR32081_0 has been updated forcibly by kgv. SHA-1: 78093ba577c4a6aa5a9b78850f646409a691ad69 |
|
Branch CR32081_0 has been updated forcibly by kgv. SHA-1: cfc2658af7b27faf7955c130e0e4d18faafde525 |
|
Branch CR32081_1 has been created by kgv. SHA-1: fcfc4ad9f1999b674beed22bbde9489a09252e7d Detailed log of new commits: Author: kgv Date: Wed Jan 27 02:32:13 2021 +0300 0032081: Visualization - WebGL sample errors when run in Safari browser with WebGL 1.0 Use "#define occLight_Index(theId) 0" hack to allow compiling a single light source PBR shading program on OpenGL ES 2.0 disallowing non-constant index expressions. PBR lookup table is now automatically resized to RGBA format when RG texture format is unsupported (OpenGL ES 2.0). OpenGl_ShaderManager now allows compiling PBR shaders using WebGL 1.0 + GL_EXT_shader_texture_lod extension. PBR baking GLSL program now uses mod() instead of % operator for compatibility. Vertex shader has been redisigned to use if/else to avoid non-constant index expressions. OpenGl_PBREnvironment now uses GL_FRAMEBUFFER instead of GL_DRAW_FRAMEBUFFER for compatibility with OpenGL ES 2.0. |
|
Branch CR32081_1 has been updated forcibly by kgv. SHA-1: 2f518422fca97bdaed584f953cbff24164d3760e |
|
Branch CR32081_1 has been updated forcibly by kgv. SHA-1: 7a70b3bc040bf39e81820a22eecd78af7c3c7a15 |
|
Branch CR32081_1 has been updated forcibly by kgv. SHA-1: 2d5b4fbcd38a55371763f8e8cd9cc5de122d9347 |
|
Branch CR32081_1 has been updated forcibly by kgv. SHA-1: fabc6d1a3b7a09280276d22582bc57e71cc30803 |
|
Branch CR32081_1 has been updated forcibly by kgv. SHA-1: 92da683b236a85d60bf409568a5bab40b99edc04 |
|
Branch CR32081_2 has been created by kgv. SHA-1: 4a1878a96ff29fd2602692b804dbc42631f33409 Detailed log of new commits: Author: kgv Date: Sun Jan 24 18:31:54 2021 +0300 0032081: Visualization - WebGL sample errors when run in Safari browser with WebGL 1.0 "MAX_WEBGL_VERSION=2" Emscripten option is now used for building sample instead of deprecated "USE_WEBGL2=1". Added "#define occLight_Index(theId) 0" workaround allowing to compile a single light source PBR shading program on OpenGL ES 2.0, as it disallows non-constant index expressions (even trivially deducable at compile-time). PBR lookup table is now automatically resized to RGBA format when RG texture format is unsupported (OpenGL ES 2.0). OpenGl_ShaderManager now allows compiling PBR shaders using WebGL 1.0 + GL_EXT_shader_texture_lod extension. PBR IBL baking GLSL program has been redisigned to use if/else to avoid non-constant index expressions. Diffuse baking implements packing float values into a temporary RGBA8 texture as a fallback solution on WebGL 1.0 implementations supporting float textures but not as FBO render targets. OpenGl_PBREnvironment now uses GL_FRAMEBUFFER instead of GL_DRAW_FRAMEBUFFER for compatibility with OpenGL ES 2.0. |
|
Patch is ready for review - OCCT branch: CR32081_2. http://jenkins-test-12.nnov.opencascade.com:8080/view/CR32081_2-master-KGV/ |
|
The patch was reviewed without remarks |
|
Branch CR32081_3 has been created by kgv. SHA-1: 522c6bdc2e413a23963cfb0ffbe6665e538729d5 Detailed log of new commits: Author: kgv Date: Fri Jan 29 04:59:41 2021 +0300 0032081: Visualization - WebGL sample errors when run in Safari browser with WebGL 1.0 "MAX_WEBGL_VERSION=2" Emscripten option is now used for building sample instead of deprecated "USE_WEBGL2=1". Author: kgv Date: Sun Jan 24 18:31:54 2021 +0300 0032083: Visualization, TKOpenGl - PBR rendering is unavailable on Apple A12 Bionic (iPad) Added "#define occLight_Index(theId) 0" workaround allowing to compile a single light source PBR shading program on OpenGL ES 2.0, as it disallows non-constant index expressions (even trivially deducable at compile-time). PBR lookup table is now automatically resized to RGBA format when RG texture format is unsupported (OpenGL ES 2.0). OpenGl_ShaderManager now allows compiling PBR shaders using WebGL 1.0 + GL_EXT_shader_texture_lod extension. PBR IBL baking GLSL program has been redisigned to use if/else to avoid non-constant index expressions. Diffuse baking implements packing float values into a temporary RGBA8 texture as a fallback solution on WebGL 1.0 implementations supporting float textures but not as FBO render targets. OpenGl_PBREnvironment now uses GL_FRAMEBUFFER instead of GL_DRAW_FRAMEBUFFER for compatibility with OpenGL ES 2.0. |
|
Dear bugmaster, the patch has been updated to fix regression reproducible only in OpenGL ES context - please take branch CR32081_3 for integration (with CR32083). |
|
Combination - OCCT branch : IR-2021-01-29 master SHA - 4ad4054c9029106ee8d3dffe9155bacf3969829b a206de37fbfa0bf71bd534ae47192bbec23b8522 Products branch : IR-2021-01-29 SHA - c3b72814422d9716b8d67e200cc31db4c554346e was compiled on Linux, MacOS and Windows platforms and tested in optimize mode. Number of compiler warnings: No new/fixed warnings Regressions/Differences/Improvements: No regressions/differences CPU differences: Debian80-64: OCCT Total CPU difference: 17780.76000000008 / 17796.17000000006 [-0.09%] Products Total CPU difference: 11509.04000000011 / 12430.450000000123 [-7.41%] Windows-64-VC14: OCCT Total CPU difference: 19390.859375 / 19444.171875 [-0.27%] Products Total CPU difference: 12815.171875 / 13824.375 [-7.30%] Image differences : No differences that require special attention Memory differences : No differences that require special attention |
|
Branch CR32081_3 has been deleted by inv. SHA-1: 522c6bdc2e413a23963cfb0ffbe6665e538729d5 |
|
Branch CR32081_2 has been deleted by inv. SHA-1: 4a1878a96ff29fd2602692b804dbc42631f33409 |
|
Branch CR32081_1 has been deleted by inv. SHA-1: 92da683b236a85d60bf409568a5bab40b99edc04 |
|
Branch CR32081_0 has been deleted by inv. SHA-1: cfc2658af7b27faf7955c130e0e4d18faafde525 |
occt: master a0073def 2021-01-29 01:59:41 Committer: bugmaster Details Diff |
0032081: Visualization - WebGL sample errors when run in Safari browser with WebGL 1.0 "MAX_WEBGL_VERSION=2" Emscripten option is now used for building sample instead of deprecated "USE_WEBGL2=1". |
Affected Issues 0032081 |
|
mod - samples/webgl/CMakeLists.txt | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-01-24 12:18 | kgv | New Issue | |
2021-01-24 12:18 | kgv | Assigned To | => kgv |
2021-01-24 12:20 | kgv | Steps to Reproduce Updated | |
2021-01-24 12:20 | kgv | Description Updated | |
2021-01-24 12:22 | kgv | Description Updated | |
2021-01-24 12:23 | kgv | Steps to Reproduce Updated | |
2021-01-24 12:26 | kgv | Steps to Reproduce Updated | |
2021-01-24 12:29 | kgv | Relationship added | related to 0032082 |
2021-01-24 12:37 | kgv | Description Updated | |
2021-01-24 12:50 | kgv | Description Updated | |
2021-01-25 00:53 | kgv | Relationship added | related to 0032084 |
2021-01-25 10:18 | kgv | Summary | Visualization - WebGL sample errors when run in Safari browser => Visualization - WebGL sample errors when run in Safari browser with WebGL 1.0 |
2021-01-27 02:31 | git | Note Added: 0098428 | |
2021-01-27 03:08 | git | Note Added: 0098429 | |
2021-01-27 14:09 | git | Note Added: 0098437 | |
2021-01-27 16:31 | git | Note Added: 0098440 | |
2021-01-27 17:37 | git | Note Added: 0098443 | |
2021-01-27 18:09 | git | Note Added: 0098445 | |
2021-01-27 18:33 | git | Note Added: 0098448 | |
2021-01-27 22:25 | git | Note Added: 0098450 | |
2021-01-27 22:47 | git | Note Added: 0098452 | |
2021-01-28 00:18 | git | Note Added: 0098459 | |
2021-01-28 09:26 | kgv | Note Added: 0098465 | |
2021-01-28 09:26 | kgv | Assigned To | kgv => osa |
2021-01-28 09:26 | kgv | Status | new => resolved |
2021-01-28 10:08 |
|
Note Added: 0098467 | |
2021-01-28 10:08 |
|
Assigned To | osa => bugmaster |
2021-01-28 10:08 |
|
Status | resolved => reviewed |
2021-01-29 04:59 | git | Note Added: 0098490 | |
2021-01-29 05:02 | kgv | Note Added: 0098492 | |
2021-01-29 05:03 | kgv | Relationship added | related to 0032083 |
2021-01-30 16:31 | bugmaster | Note Added: 0098526 | |
2021-01-30 16:31 | bugmaster | Status | reviewed => tested |
2021-01-30 16:33 | bugmaster | Test case number | => Not required |
2021-01-30 16:50 | bugmaster | Changeset attached | => occt master a0073def |
2021-01-30 16:50 | bugmaster | Status | tested => verified |
2021-01-30 16:50 | bugmaster | Resolution | open => fixed |
2021-01-30 17:16 | git | Note Added: 0098539 | |
2021-01-30 17:16 | git | Note Added: 0098543 | |
2021-01-30 17:16 | git | Note Added: 0098544 | |
2021-01-30 17:16 | git | Note Added: 0098545 | |
2021-02-15 09:34 | kgv | Additional Information Updated |