View Issue Details

IDProjectCategoryView StatusLast Update
0032067Open CASCADEOCCT:Visualizationpublic2021-01-30 02:16
Reporterkgv Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version7.6.0 
Target Version7.6.0Fixed in Version7.6.0 
Summary0032067: Visualization, TKOpenGl - shadowmap GLSL compilation error on WebGL 2.0
DescriptionThe following compilation error occurs in Microsoft Edge browser (88.0.705.41) with hardware acceleration turned OFF:
EGLVersion: 1.4 Emscripten EGL
EGLVendor: Emscripten
EGLClientAPIs: OpenGL_ES
GLvendor: WebKit
GLdevice: WebKit WebGL
GLunmaskedVendor: Google Inc.
GLunmaskedDevice: Google SwiftShader
GLversion: OpenGL ES 3.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium)) [GLSL: OpenGL ES GLSL ES 3.00 (WebGL GLSL ES 3.00 (OpenGL ES GLSL ES 3.0 Chromium))]
Max texture size: 8192
Max FBO dump size: 8192x8192
Max combined texture units: 32
Max MSAA samples: 0
Viewport: 583x464
GLextensions: EXT_color_buffer_float EXT_color_buffer_half_float EXT_float_blend EXT_texture_filter_anisotropic OES_texture_float_linear WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_s3tc WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_lose_context WEBGL_multi_draw GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_float_blend GL_EXT_texture_filter_anisotropic GL_OES_texture_float_linear GL_WEBGL_compressed_texture_etc GL_WEBGL_compressed_texture_etc1 GL_WEBGL_compressed_texture_s3tc GL_WEBGL_debug_renderer_info GL_WEBGL_debug_shaders GL_WEBGL_lose_context GL_WEBGL_multi_draw
ResolutionRatio: 1.33333
Display scale: 1

TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
  
1: #version 300 es
528: //! Function computes directional light shadow attenuation (1.0 means no shadow).
529: float occDirectionalLightShadow (in int  theId,
530:                                  in vec3 theNormal)
531: {
532:   vec4 aPosLightSpace = PosLightSpace[theId];
533:   vec3 aLightDir = vec3 (occWorldViewMatrix * vec4 (occLight_Position (theId), 0.0));
534:   vec3 aProjCoords = (aPosLightSpace.xyz / aPosLightSpace.w) * 0.5 + vec3 (0.5);
535:   float aCurrentDepth = aProjCoords.z;
536:   if (abs(aProjCoords.x) > 1.0 || abs(aProjCoords.y) > 1.0 || aCurrentDepth > 1.0) { return 1.0; }
537:   vec2 aTexelSize = vec2 (occShadowMapSizeBias.x);
538:   float aBias = max (occShadowMapSizeBias.y * (1.0 - dot (theNormal, aLightDir)), occShadowMapSizeBias.y * 0.1);
539:   float aShadow = 0.0;
540:   for (int aPosIter = 0; aPosIter < 16; ++aPosIter)
541:   {
542:     float aClosestDepth = occTexture2D (occShadowMapSamplers[theId], aProjCoords.xy + occPoissonDisk16[aPosIter] * aTexelSize).r;
543:     aShadow += (aCurrentDepth - aBias) > aClosestDepth ? 1.0 : 0.0;
544:   }
545:   return 1.0 - aShadow / 16.0;
546: }
....
occt-webgl-sample.js:9 TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
  Failed to compile Fragment Shader [occt_phong-pbr-ls_D-0000]. Compilation log:
ERROR: 0:542: '[' : array index for samplers must be constant integral expressions


There is no such issue with hardware-accelerated WebGL implementations.



Other issues with WebGL 1.0:
409: const vec2 occPoissonDisk16[16] = vec2[](
...
TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
  Failed to compile Fragment Shader [occt_phong-ls_D-0000]. Compilation log:
ERROR: 0:409: '[]' : implicitly sized array supported in GLSL ES 3.00 and above only
ERROR: 0:409: '[]' : array constructor supported in GLSL ES 3.00 and above only
ERROR: 0:409: '[]' : first-class arrays (array initializer) supported in GLSL ES 3.00 and above only


And WebGL 1.0 (not fixed by the patch - has to implement a fallback with hard-coded light source index):
420: float occDirectionalLightShadow (in sampler2D theShadow,
421: in int theId,
422: in vec3 theNormal)
423: {
424: vec4 aPosLightSpace = PosLightSpace[theId];
...
TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
Failed to compile Fragment Shader [occt_phong-ls_D-0000]. Compilation log:
ERROR: 0:424: '[]' : Index expression must be constant
Steps To ReproduceN/A

pload MODELING VISUALIZATION
box b  0 0 0 1 2 3
box bb -4 -4 0 8 8 0 -preview
vgldebug -debug 1 -glslWarn 1 -extraMsg 1
vcaps -maxVersion 2 1
vinit View1
vdisplay -dispMode 1 b bb
vfit
vrenderparams -shadingModel phong
vlight -change 0 -castShadows 1  -head 0 -direction 0.1 0.1 -1


Result on Radeon:
TKOpenGl | Type: Portability | ID: 0 | Severity: Low | Message:
  Fragment Shader [occt_phong-ls_D-0000] compilation log:
WARNING: 0:413: warning(#253) Unsized array constructors are not supported in implicit GLSL version number 110
TagsNo tags attached.
Test case numberNot required

Relationships

child of 0032039 closedbugmaster Visualization, TKOpenGl - implement simple shadow mapping for a direct light source 

Activities

kgv

2021-01-19 22:38

developer   ~0098230

Please raise the patch
- OCCT branch: CR32067.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR32067-master-KGV

bugmaster

2021-01-23 12:50

administrator   ~0098372

Combination -
OCCT branch : IR-2021-01-22
master SHA - 8948e18df815e356c59a750bd2711cb4a7914cec
a206de37fbfa0bf71bd534ae47192bbec23b8522
Products branch : IR-2021-01-22 SHA - 7cb485e51cb439852e1e1e0726af89f51d6d6db0
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: 17720.020000000055 / 17721.200000000135 [-0.01%]
Products
Total CPU difference: 12428.380000000123 / 12412.630000000105 [+0.13%]
Windows-64-VC14:
OCCT
Total CPU difference: 19367.234375 / 19300.265625 [+0.35%]
Products
Total CPU difference: 13821.875 / 13740.03125 [+0.60%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

Related Changesets

occt: master fe2a8faa

2021-01-19 15:19:26

kgv


Committer: bugmaster Details Diff
0032067: Visualization, TKOpenGl - shadowmap GLSL compilation error on WebGL 3.0

Shadowmap sampler is now passed as a dedicated argument
to occDirectionalLightShadow() to workaround strict GLSL syntax validator.
Fixed texture coordinates clamping range.

Shadow antialiasing is disabled on OpenGL ES 2.0.
Affected Issues
0032067
mod - src/OpenGl/OpenGl_ShaderManager.cxx Diff File
mod - src/Shaders/DirectionalLightShadow.glsl Diff File
mod - src/Shaders/Shaders_DirectionalLightShadow_glsl.pxx Diff File

Issue History

Date Modified Username Field Change
2021-01-19 18:17 kgv New Issue
2021-01-19 18:17 kgv Assigned To => kgv
2021-01-19 22:38 kgv Note Added: 0098230
2021-01-19 22:38 kgv Assigned To kgv => bugmaster
2021-01-19 22:38 kgv Status new => resolved
2021-01-19 22:38 kgv Status resolved => reviewed
2021-01-19 22:38 kgv Relationship added child of 0032039
2021-01-19 22:39 kgv Description Updated
2021-01-19 22:39 kgv Description Updated
2021-01-20 20:53 kgv Description Updated
2021-01-20 20:56 kgv Steps to Reproduce Updated
2021-01-23 12:50 bugmaster Note Added: 0098372
2021-01-23 12:50 bugmaster Status reviewed => tested
2021-01-23 13:03 bugmaster Test case number => Not required
2021-01-23 14:14 bugmaster Changeset attached => occt master fe2a8faa
2021-01-23 14:14 bugmaster Status tested => verified
2021-01-23 14:14 bugmaster Resolution open => fixed
2021-01-30 02:16 kgv Summary Visualization, TKOpenGl - shadowmap GLSL compilation error on WebGL 3.0 => Visualization, TKOpenGl - shadowmap GLSL compilation error on WebGL 2.0