MantisBT - Open CASCADE
View Issue Details
0030119Open CASCADE[OCCT] OCCT:Visualizationpublic2018-09-10 11:482019-02-21 00:20
mnv 
apn 
normalfeature 
verifiedfixed 
 
[OCCT] 7.4.0* 
Not needed
0030119: Visualization, OpenGl_ShaderManager - implement mechanism generating in/out section of shader programs
It's desired to have functionality for generating source code for in/out section of shader programs, which will be collect var names and generate target source code in one place.
Not required
No tags attached.
related to 0029076verified apn Open CASCADE Visualization - implement element shrinking Shader 
parent of 0030384verified apn Community Visualization - Won't display line with dot and dash style on Android 
Issue History
2018-09-10 11:48mnvNew Issue
2018-09-10 11:48mnvAssigned To => kgv
2018-09-10 11:48mnvAssigned Tokgv => mnv
2018-09-10 11:48mnvStatusnew => assigned
2018-09-10 11:58gitNote Added: 0079079
2018-09-10 14:42gitNote Added: 0079085
2018-09-10 15:34gitNote Added: 0079089
2018-09-11 08:56mnvNote Added: 0079108
2018-09-11 08:56mnvAssigned Tomnv => kgv
2018-09-11 08:56mnvStatusassigned => resolved
2018-09-11 08:56mnvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=19885#r19885
2018-09-11 11:02kgvNote Added: 0079111
2018-09-11 11:02kgvAssigned Tokgv => mnv
2018-09-11 11:02kgvStatusresolved => assigned
2018-09-26 14:36gitNote Added: 0079409
2018-09-26 15:03gitNote Added: 0079411
2018-09-27 08:55gitNote Added: 0079428
2018-09-27 13:42mnvNote Added: 0079441
2018-09-27 13:42mnvAssigned Tomnv => kgv
2018-09-27 13:42mnvStatusassigned => resolved
2018-09-27 13:59kgvSeverityminor => feature
2018-09-27 13:59kgvSummaryVisualization - implement mechanism for generating in/out section of shader programs. => Visualization, OpenGl_ShaderManager - implement mechanism generating in/out section of shader programs
2018-10-11 14:02gitNote Added: 0079886
2018-10-11 14:15gitNote Added: 0079887
2018-10-11 14:21gitNote Added: 0079888
2018-10-15 15:56gitNote Added: 0079965
2018-10-22 20:07gitNote Added: 0080208
2018-10-22 22:04gitNote Added: 0080209
2018-10-22 23:45kgvNote Added: 0080210
2018-10-22 23:45kgvAssigned Tokgv => bugmaster
2018-10-22 23:45kgvStatusresolved => reviewed
2018-10-22 23:45kgvRelationship addedrelated to 0029076
2018-10-23 11:08apnTest case number => Not needed
2018-10-23 11:08apnNote Added: 0080220
2018-10-23 11:08apnStatusreviewed => tested
2018-10-28 13:20apnChangeset attached => occt master 3b4c6945
2018-10-28 13:20apnAssigned Tobugmaster => apn
2018-10-28 13:20apnStatustested => verified
2018-10-28 13:20apnResolutionopen => fixed
2018-10-28 16:13gitNote Added: 0080416
2018-10-28 16:13gitNote Added: 0080417
2018-10-28 16:14gitNote Added: 0080428
2019-02-21 00:20kgvRelationship addedparent of 0030384

Notes
(0079079)
git   
2018-09-10 11:58   
Branch CR30119 has been created by mnv.

SHA-1: c0c56870aa54d56e98a6d6053e24d9a0bf09c2b8


Detailed log of new commits:

Author: mnv
Date: Fri Sep 7 10:18:46 2018 +0300

    0030119: Visualization - implement mechanism for generating in/out section of shader programs.
    
    Added function which generate in/out part of shaders source code from prepared list of variables.
(0079085)
git   
2018-09-10 14:42   
Branch CR30119 has been updated forcibly by mnv.

SHA-1: 7b1e3aacc7b2cb460eef4308bd4e7f02d698b80a
(0079089)
git   
2018-09-10 15:34   
Branch CR30119 has been updated forcibly by mnv.

SHA-1: 3d6d57d57262fee535392aad129c32c98cf4964c
(0079108)
mnv   
2018-09-11 08:56   
Patch is ready for review
(0079111)
kgv   
2018-09-11 11:02   
+//! List of variable of shader program.
+typedef NCollection_Vector<TCollection_AsciiString> OpenGl_ShaderVarList;

I still don't see an answer to the question, why NCollection_Vector is used here.

+  Standard_EXPORT void prepareShadersOutSrc (TCollection_AsciiString&    theSrcVertOut,
+                                             TCollection_AsciiString&    theSrcFragOut,
+                                             const OpenGl_ShaderVarList& theVarList);

Should be static or const method.

-      aSrcVertExtraOut +=
-        EOL"THE_SHADER_OUT vec2 ScreenSpaceCoord;";
+      aVarList.Append ("vec2 ScreenSpaceCoord");
       aSrcFragExtraOut +=
-        EOL"THE_SHADER_IN  vec2 ScreenSpaceCoord;"
         EOL"uniform int   uPattern;"
         EOL"uniform float uFactor;";

Please generalize approach to cover uniform variables as well (probably, these can be specified per-stage).

+  if (!aVarList.IsEmpty())
+  {
+    prepareShadersOutSrc (aSrcVertExtraOut, aSrcFragExtraOut, aVarList);
+  }

This looks awkward to keep dedicated variables for that - aSrcVertExtraOut and aSrcFragExtraOut are probably should gone away.

prepareShadersOutSrc() can be redefined to be called per-shader stage (take enumeration).
Or even better, Graphic3d_ShaderObject::CreateFromSource() can be wrapped by OpenGl_ShaderObject/OpenGl_ShaderManager to take additional arguments (in/out variables, uniform variables).
(0079409)
git   
2018-09-26 14:36   
Branch CR30119 has been updated forcibly by mnv.

SHA-1: dce5f089792f1199c8cc4e0ecd9a9b1ac9167a6c
(0079411)
git   
2018-09-26 15:03   
Branch CR30119 has been updated forcibly by mnv.

SHA-1: a5bc3aef487c15a3928c3111fd430d77650739ae
(0079428)
git   
2018-09-27 08:55   
Branch CR30119 has been updated forcibly by mnv.

SHA-1: 7a6f109f987b0a879b592a756d7f5b81f4e0dc99
(0079441)
mnv   
2018-09-27 13:42   
Patch is ready for review.
http://jenkins-test-12.nnov.opencascade.com/view/CR30119-master-MNV/view/ALL/ [^]
(0079886)
git   
2018-10-11 14:02   
Branch CR30119_1 has been created by mnv.

SHA-1: f3be2cb43dc3bf33a6e8080e80fdfd09c0647f14


Detailed log of new commits:

Author: mnv
Date: Fri Sep 7 10:18:46 2018 +0300

    0030119: Visualization - implement mechanism for generating in/out section of shader programs.
    
    Added functionality which generate in/out part of shaders source code from prepared list of variables.
(0079887)
git   
2018-10-11 14:15   
Branch CR30119_1 has been updated forcibly by mnv.

SHA-1: a4e9f20c1f1a42589006f2cdbdfbc1d311c0885a
(0079888)
git   
2018-10-11 14:21   
Branch CR30119_1 has been updated forcibly by mnv.

SHA-1: de15358417492fed963a77ae96c0347fa2d047b9
(0079965)
git   
2018-10-15 15:56   
Branch CR30119_1 has been updated forcibly by mnv.

SHA-1: ba91a5d576536c48fa3bfcd1a232fef2337f1650
(0080208)
git   
2018-10-22 20:07   
Branch CR30119_1 has been updated forcibly by kgv.

SHA-1: f856ee605986c81b59f3857728b98ab248816147
(0080209)
git   
2018-10-22 22:04   
Branch CR30119_2 has been created by kgv.

SHA-1: fb4dea0c406931e5238d5cc75ddf06e3c68deba5


Detailed log of new commits:

Author: mnv
Date: Fri Sep 7 10:18:46 2018 +0300

    0030119: Visualization - implement mechanism for generating in/out section of shader programs
    
    Added functionality which generate in/out part of shaders source code from prepared list of variables.
(0080210)
kgv   
2018-10-22 23:45   
Please take the patch (reviewed with amendments).

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR30119_2-master-KGV [^]
(0080220)
apn   
2018-10-23 11:08   
Combination -
OCCT branch : CR30119_2 SHA - fb4dea0c406931e5238d5cc75ddf06e3c68deba5
Products branch : master SHA - 35af85def09c66ceeaf90b4e4fb8b54e68d5e98c
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: 17629.539999999823 / 17520.90999999988 [+0.62%]
Products
Total CPU difference: 7459.220000000069 / 7462.09000000004 [-0.04%]
Windows-64-VC14:
OCCT
Total CPU difference: 17688.563387498496 / 17666.582846598394 [+0.12%]
Products
Total CPU difference: 8382.495333599978 / 8372.402068899986 [+0.12%]

Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0080416)
git   
2018-10-28 16:13   
Branch CR30119_2 has been deleted by inv.

SHA-1: fb4dea0c406931e5238d5cc75ddf06e3c68deba5
(0080417)
git   
2018-10-28 16:13   
Branch CR30119_1 has been deleted by inv.

SHA-1: f856ee605986c81b59f3857728b98ab248816147
(0080428)
git   
2018-10-28 16:14   
Branch CR30119 has been deleted by inv.

SHA-1: 7a6f109f987b0a879b592a756d7f5b81f4e0dc99