View Issue Details

IDProjectCategoryView StatusLast Update
0028826Open CASCADEOCCT:Visualizationpublic2017-11-21 08:12
Reporterkgv Assigned Tomkv 
PriorityhighSeverityblock 
Status closedResolutionfixed 
Product Version7.2.0 
Target Version7.2.0Fixed in Version7.2.0 
Summary0028826: Visualization, TKOpenGl - fix compatibility with strict OpenGL ES drivers
DescriptionThe following GLSL compilation occurs on Galaxy Tab S2 9.7 (Mali-T760 MP6) after 0027925 improvement:
08:59 TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
      #version 300 es
      precision highp float;
      precision highp int;
      // This section enables extensions used in OCCT GLSL programs
      #define OCC_ENABLE_draw_buffers
      #extension GL_OES_sample_variables : enable
      ...
      #ifdef VERTEX_SHADER
        THE_ATTRIBUTE vec4 occVertex;
        THE_ATTRIBUTE vec3 occNormal;
        THE_ATTRIBUTE vec4 occTexCoord;
        THE_ATTRIBUTE vec4 occVertColor;
      #elif (__VERSION__ >= 130)
        out vec4 occFragColor;
        #ifdef OCC_ENABLE_draw_buffers
          out vec4 occFragCoverage;
        #endif
      #else
        #ifdef OCC_ENABLE_draw_buffers
          #define occFragColor    gl_FragData[0]
          #define occFragCoverage gl_FragData[1]
        #else
          #define occFragColor gl_FragColor
        #endif
      ...
08:59 TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
      Failed to compile shader object. Compilation log:
      0:6: P0001: Extension directive must occur before any non-preprocessor tokens

The reason is that precision statements are coming before #extension.

Another error occurs in case on similar device with different driver version:
11:56 TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
      Failed to compile shader object. Compilation log:
      0:60: S0060: Multiple output variables defined. Location must be specified for all outputs.

The reason is that location of output variables occFragColor and occFragCoverage is undefined by GLES ES specification.

Note that it is not required enabling OIT to have this error.
As result, OCCT 3D Viewer does not display anything on the screen.

The 3rd error is generated on this device (after fixing previous issues) while enabling OIT:
14:39 TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
        Initialization of float texture framebuffer for use with
        blended order-independent transparency rendering algorithm has failed.
        Blended order-independent transparency will not be available.

GL_INVALID_ENUM on calling glTexImage2D() with 0x8D61 (GL_HALF_FLOAT_OES) data type.
The reason is that GL_HALF_FLOAT_OES (GL_EXT_color_buffer_half_float/OES_texture_half_float)
has value different from GL_HALF_FLOAT (core).

The following error has been occurred once after introduction occFragColorArray, but can not be reproduced:
15:50 TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
        Failed to link program object! Linker log:
      Error: Output occFragColorArray cannot find a suitable location/component.
      Error: Linking failed.
Steps To ReproduceN/A
TagsNo tags attached.
Test case numberNot needed

Attached Files

  • as1-oc-214.log (61,436 bytes)
  • as1-oc-214_2.log (61,417 bytes)
  • Penrose_2.log (2,211 bytes)
  • Penrose_3.log (1,566 bytes)

Relationships

parent of 0029337 closedapn Visualization, TKOpenGl - visual artifacts on Intel Broadwell GPU 
child of 0027925 closedbugmaster Visualization - implement order-independent transparency algorithm within rasterization rendering 

Activities

kgv

2017-06-08 10:44

developer  

as1-oc-214.log (61,436 bytes)

git

2017-06-08 10:44

administrator   ~0067211

Branch CR28826 has been created by kgv.

SHA-1: f45306586960bc7a6ab7b36b773bc275712c5f9e


Detailed log of new commits:

Author: kgv
Date: Thu Jun 8 10:44:17 2017 +0300

    0028826: Visualization, TKOpenGl - fix compatibility with strict OpenGL ES drivers
    
    OpenGl_ShaderProgram::Initialize() - precision declarations have been moved
    after the list of enabled extensions.

kgv

2017-06-08 12:06

developer  

as1-oc-214_2.log (61,417 bytes)

git

2017-06-08 12:36

administrator   ~0067217

Branch CR28826 has been updated by kgv.

SHA-1: 0c2fa3953ffc857ddcc915f5c9d8437f823e0364


Detailed log of new commits:

Author: kgv
Date: Thu Jun 8 12:36:16 2017 +0300

    Declarations.glsl - the fragment shader outputs have been re-declared as array
    for proper assignment of default locations (draw buffers).

git

2017-06-08 12:37

administrator   ~0067218

Branch CR28826_1 has been created by kgv.

SHA-1: d2ca3c9e3e8a35b05071619739da6ad3e25f732b


Detailed log of new commits:

Author: kgv
Date: Thu Jun 8 10:44:17 2017 +0300

    0028826: Visualization, TKOpenGl - fix compatibility with strict OpenGL ES drivers
    
    OpenGl_ShaderProgram::Initialize() - precision declarations have been moved
    after the list of enabled extensions.
    
    Declarations.glsl - the fragment shader outputs have been re-declared as array
    for proper assignment of default locations (draw buffers).

kgv

2017-06-08 12:49

developer   ~0067219

Last edited: 2017-06-08 12:54

 #elif (__VERSION__ >= 130)
-  out vec4 occFragColor;
   #ifdef OCC_ENABLE_draw_buffers
-    out vec4 occFragCoverage;
+    out vec4 occFragColorArray[2];
+    #define occFragColor    occFragColorArray[0]
+    #define occFragCoverage occFragColorArray[1]
+  #else
+    out vec4 occFragColor;
   #endif
 #else

Within OpenGL ES 3.0 (GLSL ES 3.0), declaring multiple outputs without specifying location (index of output draw buffer) is invalid case:
> If there is more than one output, the location must be specified for all outputs.
The location can be specified through layout, e.g.:
  layout(location = 0) out vec4 occFragColor;
  layout(location = 1) out vec4 occFragCoverage;

however desktop OpenGL supports this syntax only since GLSL 3.3 (OpenGL 3.3), while in previous versions location can be specified only through C API
call glBindFragDataLocation(), which has been never existed in OpenGL ES.

Instead of supporting even more code paths for each version, it is proposed declaring fragment output as an array,
which should be supported by all versions and guaranties sequential implicit layout (as in case of older gl_FragData array).

kgv

2017-06-08 15:34

developer  

Penrose_2.log (2,211 bytes)

git

2017-06-08 15:42

administrator   ~0067226

Branch CR28826_1 has been updated by kgv.

SHA-1: c6c0e19c896692e69ccad4daa22dfd085f839d81


Detailed log of new commits:

Author: kgv
Date: Thu Jun 8 15:42:41 2017 +0300

    OpenGl_FrameBuffer - GL_HALF_FLOAT is now used instead of GL_HALF_FLOAT_OES
    when functionality is available in core.

git

2017-06-08 15:44

administrator   ~0067227

Branch CR28826_2 has been created by kgv.

SHA-1: 14da17aa01a94eae15741d61f1f75b34400d8a3b


Detailed log of new commits:

Author: kgv
Date: Thu Jun 8 10:44:17 2017 +0300

    0028826: Visualization, TKOpenGl - fix compatibility with strict OpenGL ES drivers
    
    OpenGl_ShaderProgram::Initialize() - precision declarations have been moved
    after the list of enabled extensions.
    
    Declarations.glsl - the fragment shader outputs have been re-declared as array
    for proper assignment of default locations (draw buffers).
    
    OpenGl_FrameBuffer - GL_HALF_FLOAT is now used instead of GL_HALF_FLOAT_OES
    when functionality is available in core.

kgv

2017-06-08 16:25

developer  

Penrose_3.log (1,566 bytes)

git

2017-06-08 18:01

administrator   ~0067234

Branch CR28826_2 has been updated by kgv.

SHA-1: f0482b391acbd1dcb7517e365b0d7dea6e37873d


Detailed log of new commits:

Author: kgv
Date: Thu Jun 8 18:01:25 2017 +0300

    OpenGl_Texture - fixed initialization of Image_Format_RGB32 image format on OpenGL ES 3+.

git

2017-06-08 18:04

administrator   ~0067235

Branch CR28826_3 has been created by kgv.

SHA-1: 122a00dff8b12d103db0594a54333e6c4bbff1e1


Detailed log of new commits:

Author: kgv
Date: Thu Jun 8 10:44:17 2017 +0300

    0028826: Visualization, TKOpenGl - fix compatibility with strict OpenGL ES drivers
    
    OpenGl_ShaderProgram::Initialize() - precision declarations have been moved
    after the list of enabled extensions.
    
    Declarations.glsl - the fragment shader outputs have been re-declared as array
    for proper assignment of default locations (draw buffers).
    
    OpenGl_FrameBuffer - GL_HALF_FLOAT is now used instead of GL_HALF_FLOAT_OES on OpenGL ES 3.2+.
    OpenGl_Texture - fixed initialization of Image_Format_RGB32 image format on OpenGL ES 3.0+.

kgv

2017-06-08 18:04

developer   ~0067237

Patch is ready for review.

apl

2017-06-12 15:57

developer   ~0067289

Dear bugmaster,

Please test the patch.

git

2017-06-13 12:02

administrator   ~0067309

Branch CR28826_3 has been updated forcibly by mkv.

SHA-1: 177781da922e123b9e04f1b3da223dfa8734f29d

mkv

2017-06-13 15:31

tester   ~0067321

Dear BugMaster,
Branch CR28826_3 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: 177781da922e123b9e04f1b3da223dfa8734f29d

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 64 (64 on master)
Windows: 0 (0 on master)
MacOS : 1206

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
occt component :
Total MEMORY difference: 92294265 / 92104077 [+0.21%]
Total CPU difference: 18849.590000000124 / 18989.35000000035 [-0.74%]
products component :
Total MEMORY difference: 33687707 / 33656232 [+0.09%]
Total CPU difference: 6370.030000000071 / 6179.4300000000685 [+3.08%]
Testing on Windows:
occt component :
Total MEMORY difference: 58686576 / 58684365 [+0.00%]
Total CPU difference: 17461.0515290987 / 17488.726106498834 [-0.16%]
products component :
Total MEMORY difference: 24263944 / 24224898 [+0.16%]
Total CPU difference: 6144.770189299654 / 6164.207913899648 [-0.32%]

There are no differences in images found by testdiff.

mkv

2017-06-13 15:31

tester   ~0067322

Dear BugMaster,
Branch CR28826_3 is TESTED.

git

2017-07-03 08:45

administrator   ~0067883

Branch CR28826 has been deleted by kgv.

SHA-1: 0c2fa3953ffc857ddcc915f5c9d8437f823e0364

git

2017-07-03 08:45

administrator   ~0067884

Branch CR28826_1 has been deleted by kgv.

SHA-1: c6c0e19c896692e69ccad4daa22dfd085f839d81

git

2017-07-03 08:45

administrator   ~0067885

Branch CR28826_2 has been deleted by kgv.

SHA-1: f0482b391acbd1dcb7517e365b0d7dea6e37873d

git

2017-07-03 08:45

administrator   ~0067886

Branch CR28826_3 has been deleted by kgv.

SHA-1: 177781da922e123b9e04f1b3da223dfa8734f29d

Related Changesets

occt: master 177781da

2017-06-08 07:44:17

kgv


Committer: mkv Details Diff
0028826: Visualization, TKOpenGl - fix compatibility with strict OpenGL ES drivers

OpenGl_ShaderProgram::Initialize() - precision declarations have been moved
after the list of enabled extensions.

Declarations.glsl - the fragment shader outputs have been re-declared as array
for proper assignment of default locations (draw buffers).

OpenGl_FrameBuffer - GL_HALF_FLOAT is now used instead of GL_HALF_FLOAT_OES on OpenGL ES 3.2+.
OpenGl_Texture - fixed initialization of Image_Format_RGB32 image format on OpenGL ES 3.0+.
Affected Issues
0028826
mod - src/OpenGl/OpenGl_FrameBuffer.cxx Diff File
mod - src/OpenGl/OpenGl_GlFunctions.hxx Diff File
mod - src/OpenGl/OpenGl_GraphicDriver.cxx Diff File
mod - src/OpenGl/OpenGl_ShaderProgram.cxx Diff File
mod - src/OpenGl/OpenGl_Texture.cxx Diff File
mod - src/OpenGl/OpenGl_View_Redraw.cxx Diff File
mod - src/Shaders/Declarations.glsl Diff File
mod - src/Shaders/Shaders_Declarations_glsl.pxx Diff File

Issue History

Date Modified Username Field Change
2017-06-08 10:22 kgv New Issue
2017-06-08 10:22 kgv Assigned To => kgv
2017-06-08 10:22 kgv Relationship added child of 0027925
2017-06-08 10:39 kgv Description Updated
2017-06-08 10:44 kgv File Added: as1-oc-214.log
2017-06-08 10:44 git Note Added: 0067211
2017-06-08 12:06 kgv File Added: as1-oc-214_2.log
2017-06-08 12:07 kgv Description Updated
2017-06-08 12:08 kgv Description Updated
2017-06-08 12:36 git Note Added: 0067217
2017-06-08 12:37 git Note Added: 0067218
2017-06-08 12:49 kgv Note Added: 0067219
2017-06-08 12:49 kgv Note Edited: 0067219
2017-06-08 12:53 kgv Note Edited: 0067219
2017-06-08 12:53 kgv Note Edited: 0067219
2017-06-08 12:54 kgv Note Edited: 0067219
2017-06-08 15:34 kgv File Added: Penrose_2.log
2017-06-08 15:39 kgv Description Updated
2017-06-08 15:42 git Note Added: 0067226
2017-06-08 15:44 git Note Added: 0067227
2017-06-08 16:25 kgv File Added: Penrose_3.log
2017-06-08 16:35 kgv Description Updated
2017-06-08 18:01 git Note Added: 0067234
2017-06-08 18:04 git Note Added: 0067235
2017-06-08 18:04 kgv Note Added: 0067237
2017-06-08 18:04 kgv Assigned To kgv => apl
2017-06-08 18:04 kgv Status new => resolved
2017-06-08 18:04 kgv Priority normal => high
2017-06-08 18:28 kgv Description Updated
2017-06-12 15:57 apl Note Added: 0067289
2017-06-12 15:57 apl Assigned To apl => bugmaster
2017-06-12 15:57 apl Status resolved => reviewed
2017-06-13 11:43 mkv Assigned To bugmaster => mkv
2017-06-13 12:02 git Note Added: 0067309
2017-06-13 15:31 mkv Note Added: 0067321
2017-06-13 15:31 mkv Note Added: 0067322
2017-06-13 15:31 mkv Assigned To mkv => bugmaster
2017-06-13 15:31 mkv Status reviewed => tested
2017-06-13 15:31 mkv Test case number => Not needed
2017-06-16 17:17 mkv Changeset attached => occt master 177781da
2017-06-16 17:17 mkv Assigned To bugmaster => mkv
2017-06-16 17:17 mkv Status tested => verified
2017-06-16 17:17 mkv Resolution open => fixed
2017-07-03 08:45 git Note Added: 0067883
2017-07-03 08:45 git Note Added: 0067884
2017-07-03 08:45 git Note Added: 0067885
2017-07-03 08:45 git Note Added: 0067886
2017-09-29 16:18 aiv Fixed in Version => 7.2.0
2017-09-29 16:28 aiv Status verified => closed
2017-11-21 08:12 kgv Relationship added parent of 0029337