Hello Carsten and Gerrit,

I have some need for a compute shader and therefore I have learned its usage in 
OpenSG land. As a result I have some examples that I would like to see in 
OpenSG and some patches to the code base.

Let me first give you some information about the patches:

1. Main CMakeLists.txt file:
I have added a statement that allows you to bring boilerplate examples into the 
Examples/Advanced folder. I have added five examples into this folder because 
IMHO these are not simple anymore.

2. Source/Base/Base/OSGPolygon.cpp
Removed a compiler warning.

3. Source/Contrib/ComputeBase/ComputeShader/OSGComputeShaderAlgorithm.fcd
3.0. Added some documentation
3.1. Added a ChunkMaterial attribute that allows the use of 
ShaderStorageBufferObjs and UniformBufferObjs in conjunction to the 
TextureImageChunk. This allows you to bring multiple of these chunks into the 
compute shader.
3.2. Added the possible use of a glMemoryBarrier at the end of the computation.
3.3. Added the possible use of a variable work group size.

For 3.2 and 3.3 the following ARB must be available: 
GL_ARB_shader_image_load_store and GL_ARB_compute_variable_group_size
These provide the glMemoryBarrier and the glDispatchComputeGroupSizeARB APIs 
that are used.

ATTENTION: I have not added these to the OSGGLEXT.h and OSGGLFuncProtos.h 
files, because I do not work with them. I hope that this is Ok, and not too 
much of a burden to you.

4. 
Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoIntegralBufferRefProperty.cpp
 and
    
Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorBufferRefProperty.cpp
At first, I was going to use these but decided otherwise. However, I think that 
their implementation is not correct with respect to the GL id.

5. Source/System/State/Base/OSGShaderStorageBufferObjChunk.cpp
    Source/System/State/Base/OSGShaderStorageBufferObjStdLayoutChunk.cpp
    Source/System/State/Shader/Variables/OSGShaderVariables.inl
I have changed the usage of calls like
hasExtOrVersion(_extUniformBufferObject, 0x0310);
getExtIdGPUShader4(), 0x0330, 0x0200))

to

hasExtOrVersion(_extUniformBufferObject, 0x0301);
getExtIdGPUShader4(), 0x0303, 0x0200))

That is the form found elsewhere in the code base. Could you confirm that this 
is the correct usage pattern?

6. Source/System/State/Base/OSGShaderStorageBufferObjRefChunk.fcd
This one is new and it allows you to bind a shader storage buffer object from 
an ordinary array buffer provided by the geo properties. This works fine if the 
array layout is compatible to the std430 layout format. That is the case for 
Pnt4f, Vec4f and Vec1f vector properties.

The compute shader examples I have written are numbers 1 to 5 and are of 
growing complexity. The first three build on the CSM compute shader example. 
Especially the first one is just a plain translation into C++ world. The second 
one is slight variation and uses a ShaderProgram instead of providing the 
source code directly to the ComputeShaderChunk. The third uses a 
ShaderStorageBufferObjChunk to provide some coloring into the compute shader. 
The fourth is a variation of the well known cylinder/torus example, but uses a 
compute shader to modify the material database which is a 
ShaderStorageBufferObjChunk. The fifth example uses the new 
ShaderStorageBufferObjRelChunk. It is a simple particle simulation, that does 
allows me to run as much as 6.000.000 particles in the simulation.

This contribution builds up on the last one I have send to the list (cc. to 
Carsten; mail still pending on the list, awaits moderation), e.g. it uses the 
MultiPropertySSBOChunk. However, the diff is against my last clone of the 
OpenSG master.

Best regards,
Johannes

Attachment: OpenSG1.azip
Description: OpenSG1.azip

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to