I'm learning OpenGL and SharpGL together so please forgive me if any aspect of my query is inaccurate.
I am trying to write a compute shader that updates a texture before that texture is used by a fragment shader. I cannot calculate the pixel colours within the fragment shader since a column of pixels are generated by an iterative algorithm i.e. a pixel colour cannot be determined independently of others.
It seems that after calling glDispatchCompute, I need to call glMemoryBarrier before using the texture since the compute shader would otherwise execute asynchronously. However I cannot find glMemoryBarrier (OpenGL 4.2) or the associated constants defined in the current version of SharpGL.OpenGL (3.1.1.0).
I have considered several solutions that I could implement but in all cases there are issues:
Derive a class from OpenGL and add a MemoryBarrier method. This will not work since my class would not be used by SharpGL.WPF.OpenGLControl.
Create a MemoryBarrier extension method for the OpenGL class. This does not work either as the extension method does not have access to private/protected members of OpenGL such as PreGLCall.
Recompile SharpGL and relevant dependencies myself with an added MemoryBarrier method. While this should be straightforward from what I can tell, I would have to reapply my changes and recompile every time there is a new version of SharpGL.
Make the required changes as above but also commit the changes to the SharpGL repository. I would be happy to do this but it would be my first code contribution to an open source project so any tips/guidelines would be most welcome - for example I have no idea what testing/verification procedures are in place for this project.
Alternatively, if it is easier for a project maintainer to release an updated version of SharpGL (and Nuget packages) with the added function, this would also be much appreciated.
I'm learning OpenGL and SharpGL together so please forgive me if any aspect of my query is inaccurate.
I am trying to write a compute shader that updates a texture before that texture is used by a fragment shader. I cannot calculate the pixel colours within the fragment shader since a column of pixels are generated by an iterative algorithm i.e. a pixel colour cannot be determined independently of others.
It seems that after calling glDispatchCompute, I need to call glMemoryBarrier before using the texture since the compute shader would otherwise execute asynchronously. However I cannot find glMemoryBarrier (OpenGL 4.2) or the associated constants defined in the current version of SharpGL.OpenGL (3.1.1.0).
I have considered several solutions that I could implement but in all cases there are issues:
Alternatively, if it is easier for a project maintainer to release an updated version of SharpGL (and Nuget packages) with the added function, this would also be much appreciated.
Cheers, Fran