View Issue Details

IDProjectCategoryView StatusLast Update
0024926Open CASCADEOCCT:Visualizationpublic2014-11-11 18:27
ReportersanAssigned Tobugmaster  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
Product Version6.7.1 
Target Version6.8.0Fixed in Version6.8.0 
Summary0024926: MeshVS - improve generation of primitive arrays
DescriptionThe major issue regarding the current implementation of PrsBuilders in MeshVS package is that they produce primitive arrays that result in exactly N calls to glDrawArrays() OpenGL function in wireframe and shading modes, where N is the number of mesh faces.
And this number becomes 2*N when mesh face outlines are visible in shading mode (the default).
An example is MeshVS_MeshPrsBuilder::BuildElements() method, however other builders follow the same practice.
Such a huge number of OpenGL rendering calls is a bad practice.

The following MeshVS improvements are required:

1. Decompose mesh faces into triangles at MeshVS level and use arrays of triangles rather than arrays of polygons with arbitrary vertex number for shaded mesh representation, and arrays of lines instead of arrays of polylines in wireframe mode. Like this, the whole mesh will be drawn with 1-2 OpenGL calls (like it is done in AIS_Shape now).

The array of lines should avoid duplication of the same edges - hash map with pair of integer keys and symmetric hasher can be used for this purpose.

2. Avoid duplication of mesh vertex coordinates data and use glDrawElements() rather than glDrawArrays() - this point is less critical but still it should be analyzed (at least).

Classes to be revised:
MeshVS_ElementalColorPrsBuilder
MeshVS_MeshPrsBuilder
MeshVS_NodalColorPrsBuilder
MeshVS_VectorPrsBuilder (to be checked at least)
Additional information
and documentation updates
Results of performance improvement can be found in perf.pdf attached.
TagsNo tags attached.
Test case numberNot needed

Attached Files

  • perf.pdf (62,497 bytes)

Relationships

related to 0024961 closedbugmaster MeshVS: revision of DRAW commands 
related to 0025463 assignedvpozdyayev Visualization - MeshVS_ElementalColorPrsBuilder produces inefficient structures for elements with unique colors 

Activities

dbp

2014-05-22 16:03

developer   ~0029468

Dear san,

please review the patch in branch CR24926_1.

san

2014-05-26 21:30

developer   ~0029526

Branch CR24926_1 reviewed with the following remarks:
1. As agreed, please add a comment to related MeshVS_*PrsBuilder.cxx (or .cdl) explaining why indexed arrays of primitives are not efficient here.
2. MeshVS_VectorPrsBuilder class still uses polylines and bounds - should be optimized.

dbp

2014-05-28 10:59

developer   ~0029562

Dear san,

please review the patch in branch CR24926_2.

san

2014-05-28 18:28

developer   ~0029587

Branch CR24926_2 reviewed without remarks, ready for testing.

dbp

2014-05-28 18:37

developer  

perf.pdf (62,497 bytes)

dbp

2014-05-28 18:38

developer   ~0029588

Performance comparison is available in attached file 'perf.pdf'.

mkv

2014-06-03 18:41

tester   ~0029658

Dear BugMaster,

Branch CR24926_2 (and products from GIT master) was compiled on Linux platform.
SHA-1: b2d38679a8608f0ef403b35ab616a9f3bdcab3d0

Number of compiler warnings:
occt component :
Linux: 33 (16 on master)

There are new additional compilation warnings:

Handle_Standard_Transient.hxx:145, GNU C Compiler 4 (gcc), Priority: Normal
dereferencing pointer ‘aSVer’ does break strict-aliasing rules

MeshVS_SymmetricPairHasher.hxx:19, GNU C Compiler 4 (gcc), Priority: Normal
suggest parentheses around ‘&&’ within ‘||’

MeshVS_ElementalColorPrsBuilder.cxx:279, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_0D’ not handled in switch

MeshVS_ElementalColorPrsBuilder.cxx:279, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_Node’ not handled in switch

MeshVS_ElementalColorPrsBuilder.cxx:279, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_NONE’ not handled in switch

MeshVS_ElementalColorPrsBuilder.cxx:279, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_All’ not handled in switch

MeshVS_ElementalColorPrsBuilder.cxx:279, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_Element’ not handled in switch

MeshVS_MeshPrsBuilder.cxx:266, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_NONE’ not handled in switch

MeshVS_MeshPrsBuilder.cxx:266, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_All’ not handled in switch

MeshVS_MeshPrsBuilder.cxx:266, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_Element’ not handled in switch

MeshVS_MeshPrsBuilder.cxx:266, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_0D’ not handled in switch

MeshVS_MeshPrsBuilder.cxx:266, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_Node’ not handled in switch

MeshVS_NodalColorPrsBuilder.cxx:245, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_All’ not handled in switch

MeshVS_NodalColorPrsBuilder.cxx:245, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_Element’ not handled in switch

MeshVS_NodalColorPrsBuilder.cxx:245, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_0D’ not handled in switch

MeshVS_NodalColorPrsBuilder.cxx:245, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_Node’ not handled in switch

MeshVS_NodalColorPrsBuilder.cxx:245, GNU C Compiler 4 (gcc), Priority: Normal
enumeration value ‘MeshVS_ET_NONE’ not handled in switch


There is extraction error in products part:

Error : the deferred method TDF_Attribute::Paste(TDF_Attribute,TDF_RelocationTable) must
Error : have an implementation in class OMFCAF_TMesh
Error : Check of OMFCAF has failed
Error : Failed during execution

Info : Failed OMFCAF (xcpp.fill xcpp.src xcpp.header xcpp.template obj.inc obj.comp obj.idep )

dbp

2014-07-07 11:29

developer   ~0029979

Dear san,

compilation warnings were fixed. Please check the patch in branch CR24926_2.

san

2014-07-08 17:29

developer   ~0030009

Branch CR24926_2 reviewed without remarks, ready for testing.

mkv

2014-07-11 15:00

tester   ~0030075

Dear BugMaster,

Branch CR24926_2 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: 57649d8553be049d2fb98aa33999aec6256ba4d5

Number of compiler warnings:

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

products component :
Linux: 11 (11 on master)
Windows: 2 (2 on master)

Regressions/Differences:
http://occt-tests/CR24926-2-master-occt/Debian60-64/bugs/xde/bug23193.html
http://occt-tests/CR24926-2-master-occt/Windows-32-VC9/bugs/xde/bug23193.html
bugs xde(005) bug23193: FAILED

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 350273556 / 349917692
Total CPU difference: 54457.35999999988 / 52501.220000000074

Testing on Windows:
Total MEMORY difference: 376895600 / 377431628
Total CPU difference: 39075.609375 / 39670.796875

There are following differences in images found by testdiff.
http://occt-tests/CR24926-2-master-occt/Debian60-64/diff-Debian60-64.html
http://occt-tests/CR24926-2-master-occt/Windows-32-VC9/diff-Windows-32-VC9.html
IMAGE bugs xde bug2: bug23193_Driver1_Viewer1_View1.png differs

git

2014-07-18 18:44

administrator   ~0030254

Branch CR24926_2 has been updated by dbp.

SHA-1: 6c8d61fa0febf1f06a566def322ba428b950111f

dbp

2014-07-18 18:45

developer   ~0030255

Dear san,

please review bug fix in branch CR24926_2.

san

2014-07-21 20:57

developer   ~0030282

Branch CR24926_2 reviewed without remarks, ready for testing.

git

2014-07-22 11:13

administrator   ~0030283

Branch CR24926_2 has been updated forcibly by mkv.

SHA-1: 040f44d1264e15978162795d9315722e08d98417

mkv

2014-07-23 12:39

tester   ~0030376

Dear BugMaster,

Branch CR24926_2 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: 040f44d1264e15978162795d9315722e08d98417

Number of compiler warnings:

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

products component :
Linux: 11 (11 on master)
Windows: 1 (1 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 351460552 / 351968492
Total CPU difference: 47571.94999999992 / 46305.24

Testing on Windows:
Total MEMORY difference: 238740824 / 239134364
Total CPU difference: 34843.328125 / 35090.21875

There are no differences in images found by testdiff.

git

2014-07-28 16:42

administrator   ~0030442

Branch CR24926_2 has been deleted by inv.

SHA-1: 040f44d1264e15978162795d9315722e08d98417

git

2014-07-28 16:42

administrator   ~0030452

Branch CR24926_1 has been deleted by inv.

SHA-1: 02cf49d36db7602f44ec833ea10e366101b72605

git

2014-07-28 16:42

administrator   ~0030453

Branch CR24926 has been deleted by inv.

SHA-1: a1fe8030f965ca5216b08fc795844f904276e298

Related Changesets

occt: master 37ac4a67

2014-07-24 09:21:54

dbp


Committer: bugmaster Details Diff
0024926: MeshVS - improve generation of primitive arrays

Remove redundant code.

Fix GCC compilation warnings.

Bug fix in MeshVS_ElementalColorPrsBuilder.
Affected Issues
0024926
mod - src/MeshVS/FILES Diff File
mod - src/MeshVS/MeshVS_ElementalColorPrsBuilder.cxx Diff File
mod - src/MeshVS/MeshVS_MeshPrsBuilder.cdl Diff File
mod - src/MeshVS/MeshVS_MeshPrsBuilder.cxx Diff File
mod - src/MeshVS/MeshVS_NodalColorPrsBuilder.cdl Diff File
mod - src/MeshVS/MeshVS_NodalColorPrsBuilder.cxx Diff File
add - src/MeshVS/MeshVS_SymmetricPairHasher.hxx Diff File
mod - src/MeshVS/MeshVS_VectorPrsBuilder.cxx Diff File

Issue History

Date Modified Username Field Change
2014-05-14 20:08 san New Issue
2014-05-14 20:08 san Assigned To => san
2014-05-15 11:44 kgv Description Updated
2014-05-15 13:12 san Assigned To san => duv
2014-05-15 13:12 san Status new => assigned
2014-05-15 13:12 san Target Version => 6.8.0
2014-05-15 14:52 san Description Updated
2014-05-15 15:42 san Description Updated
2014-05-16 18:11 duv Assigned To duv => san
2014-05-16 18:11 duv Assigned To san => dbp
2014-05-21 21:37 kgv Summary MeshVS: improved generation of primitive arrays => MeshVS - improve generation of primitive arrays
2014-05-22 16:03 dbp Note Added: 0029468
2014-05-22 16:03 dbp Assigned To dbp => san
2014-05-22 16:03 dbp Status assigned => feedback
2014-05-26 21:30 san Note Added: 0029526
2014-05-26 21:30 san Assigned To san => dbp
2014-05-26 21:30 san Status feedback => assigned
2014-05-26 21:31 san Relationship added related to 0024961
2014-05-28 10:59 dbp Note Added: 0029562
2014-05-28 10:59 dbp Assigned To dbp => san
2014-05-28 10:59 dbp Status assigned => feedback
2014-05-28 18:28 san Note Added: 0029587
2014-05-28 18:28 san Assigned To san => bugmaster
2014-05-28 18:28 san Status feedback => reviewed
2014-05-28 18:37 dbp File Added: perf.pdf
2014-05-28 18:38 dbp Note Added: 0029588
2014-05-28 18:40 san Additional Information Updated
2014-06-03 11:36 bugmaster Assigned To bugmaster => apn
2014-06-03 18:41 mkv Note Added: 0029658
2014-06-03 18:42 mkv Assigned To apn => dbp
2014-06-03 18:42 mkv Status reviewed => assigned
2014-07-07 11:29 dbp Note Added: 0029979
2014-07-07 11:29 dbp Assigned To dbp => san
2014-07-07 11:29 dbp Status assigned => resolved
2014-07-08 17:29 san Note Added: 0030009
2014-07-08 17:29 san Assigned To san => bugmaster
2014-07-08 17:29 san Status resolved => reviewed
2014-07-09 12:23 mkv Assigned To bugmaster => mkv
2014-07-11 15:00 mkv Note Added: 0030075
2014-07-11 15:01 mkv Test case number => Not needed
2014-07-11 15:01 mkv Assigned To mkv => dbp
2014-07-11 15:01 mkv Status reviewed => assigned
2014-07-18 18:44 git Note Added: 0030254
2014-07-18 18:45 dbp Note Added: 0030255
2014-07-18 18:45 dbp Assigned To dbp => san
2014-07-18 18:45 dbp Status assigned => resolved
2014-07-21 20:57 san Note Added: 0030282
2014-07-21 20:57 san Assigned To san => bugmaster
2014-07-21 20:57 san Status resolved => reviewed
2014-07-22 11:13 git Note Added: 0030283
2014-07-22 12:51 mkv Assigned To bugmaster => mkv
2014-07-23 12:39 mkv Note Added: 0030376
2014-07-23 12:39 mkv Assigned To mkv => bugmaster
2014-07-23 12:39 mkv Status reviewed => tested
2014-07-25 14:45 bugmaster Changeset attached => occt master 37ac4a67
2014-07-25 14:45 bugmaster Status tested => verified
2014-07-25 14:45 bugmaster Resolution open => fixed
2014-07-28 16:42 git Note Added: 0030442
2014-07-28 16:42 git Note Added: 0030452
2014-07-28 16:42 git Note Added: 0030453
2014-11-11 12:46 aiv Fixed in Version => 6.8.0
2014-11-11 12:57 aiv Status verified => closed
2014-11-11 18:27 kgv Relationship added related to 0025463