View Issue Details

IDProjectCategoryView StatusLast Update
0031477Open CASCADEOCCT:Visualizationpublic2020-12-02 17:12
Reporterkgv Assigned Tobugmaster  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
Target Version7.5.0Fixed in Version7.5.0 
Summary0031477: Visualization, TKOpenGl - fetch/wrap getBufferSubData() function from WebGL 2.0
DescriptionFetching VBO data back is not fun:

1. OpenGL 1.5+
   - glGetBufferSubData(): YES
   - glMapBufferRange(): YES
2. OpenGL ES 2.0
   - glGetBufferSubData(): NO
   - glMapBufferRange(): NO
3. OpenGL ES 3.0+
   - glGetBufferSubData(): NO
   - glMapBufferRange(): YES
4. WebGL 1.0
   - glGetBufferSubData(): NO
   - glMapBufferRange(): NO
5. WebGL 2.0
   - glGetBufferSubData(): YES
   - glMapBufferRange(): NO

So that:
- Desktop OpenGL gives maximum flexibility
- OpenGL ES 2.0 and WebGL 1.0 give no chance to retrieve data back
- OpenGL ES 3.0+ gives only mapping buffer.
- WebGL 2.0 gives only getBufferSubData().

The reason for WebGL not having glMapBufferRange() is that it was considered difficult implementing different protection levels of mapped buffer on JavaScript level, so that getBufferSubData() just copying data to specified buffer was considered simpler and straightforward. The consequence is, however, is inconsistency between WebGL 2.0 / OpenGL ES 3.0, which are considered close to each other in most other aspects.

It should be checked if Emscripten will be able finding glGetBufferSubData() within WebGL 2.0 or to wrap it manually via EM_ASM_.
void myGetBufferSubData (GLenum theTarget, GLintptr theOffset, GLsizeiptr theSize, void* theData)
{
#ifdef __EMSCRIPTEN__
  EM_ASM_(
  {
    Module.ctx.getBufferSubData($0, $1, HEAPU8.subarray($2, $2 + $3));
  }, theTarget, theOffset, theData, theSize);
#else
  core20fwd->glGetBufferSubData (theTarget, theOffset, theSize, theData);
#endif
}
Steps To ReproduceN/A
TagsNo tags attached.
Test case numberNot required

Relationships

child of 0031583 closedbugmaster Open CASCADE Visualization, OpenGl_Context - load OpenGL ES 3.0 functions 

Activities

git

2020-05-28 19:40

administrator   ~0092389

Branch CR31477 has been created by kgv.

SHA-1: 8504e57a7d0d5e5661e8076826e183ba2faa3730


Detailed log of new commits:

Author: kgv
Date: Thu May 28 19:42:13 2020 +0300

    0031477: Visualization, TKOpenGl - fetch/wrap getBufferSubData() function from WebGL 2.0
    
    Added OpenGl_Context::GetBufferSubData() implementing getBufferSubData() based on capabilities of various APIs.
    Added OpenGl_VertexBuffer::GetSubData() similar to OpenGl_VertexBuffer::SubData().

git

2020-05-28 19:44

administrator   ~0092390

Branch CR31477 has been updated forcibly by kgv.

SHA-1: d470c66049ecc61aedc44a71034642cad5850a38

kgv

2020-05-28 20:38

developer   ~0092391

Last edited: 2020-05-28 22:17

Patch is ready for review in OCCT branch CR31477.

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

osa

2020-05-29 09:34

developer   ~0092392

The patch was reviewed without remarks

bugmaster

2020-05-30 12:02

administrator   ~0092405

Combination -
OCCT branch : IR-2020-05-29
master SHA - d4cefcc0da89dc253d25a6fec1caba622c031fc1
a206de37fbfa0bf71bd534ae47192bbec23b8522
Products branch : IR-2020-05-29 SHA - 0948de4c2124aea8b36e4e2373bac22c08a4c7dc
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: 17173.890000000167 / 17188.26000000018 [-0.08%]
Products
Total CPU difference: 11198.450000000084 / 11217.810000000067 [-0.17%]
Windows-64-VC14:
OCCT
Total CPU difference: 18698.640625 / 18659.515625 [+0.21%]
Products
Total CPU difference: 13034.703125 / 13006.1875 [+0.22%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2020-05-30 12:26

administrator   ~0092409

Branch CR31477 has been deleted by inv.

SHA-1: d470c66049ecc61aedc44a71034642cad5850a38

Related Changesets

occt: master d4cefcc0

2020-05-28 16:42:13

kgv


Committer: bugmaster Details Diff
0031477: Visualization, TKOpenGl - fetch/wrap getBufferSubData() function from WebGL 2.0

Added OpenGl_Context::GetBufferSubData() implementing getBufferSubData() based on capabilities of various APIs.
Added OpenGl_VertexBuffer::GetSubData() similar to OpenGl_VertexBuffer::SubData().
Affected Issues
0031477
mod - src/OpenGl/OpenGl_Context.cxx Diff File
mod - src/OpenGl/OpenGl_Context.hxx Diff File
mod - src/OpenGl/OpenGl_GlCore30.hxx Diff File
mod - src/OpenGl/OpenGl_VertexBuffer.cxx Diff File
mod - src/OpenGl/OpenGl_VertexBuffer.hxx Diff File
mod - src/OpenGl/OpenGl_VertexBufferCompat.cxx Diff File
mod - src/OpenGl/OpenGl_VertexBufferCompat.hxx Diff File

Issue History

Date Modified Username Field Change
2020-04-01 11:04 kgv New Issue
2020-04-01 11:04 kgv Assigned To => kgv
2020-05-28 19:40 git Note Added: 0092389
2020-05-28 19:44 git Note Added: 0092390
2020-05-28 20:38 kgv Note Added: 0092391
2020-05-28 20:38 kgv Assigned To kgv => osa
2020-05-28 20:38 kgv Status new => resolved
2020-05-28 20:39 kgv Relationship added child of 0031583
2020-05-28 20:39 kgv Description Updated
2020-05-28 20:39 kgv Steps to Reproduce Updated
2020-05-28 22:17 kgv Note Edited: 0092391
2020-05-29 09:34 osa Note Added: 0092392
2020-05-29 09:34 osa Assigned To osa => bugmaster
2020-05-29 09:34 osa Status resolved => reviewed
2020-05-30 12:02 bugmaster Note Added: 0092405
2020-05-30 12:02 bugmaster Status reviewed => tested
2020-05-30 12:13 bugmaster Changeset attached => occt master d4cefcc0
2020-05-30 12:13 bugmaster Status tested => verified
2020-05-30 12:13 bugmaster Resolution open => fixed
2020-05-30 12:26 git Note Added: 0092409
2020-07-04 12:31 bugmaster Test case number => Not required
2020-12-02 16:43 emo Fixed in Version => 7.5.0
2020-12-02 17:12 emo Status verified => closed