dwmkerr / sharpgl

Use OpenGL in .NET applications. SharpGL wraps all modern OpenGL features and offers a powerful scene graph to aid development.
MIT License
759 stars 299 forks source link

Missing OpengGL 4.2 function: glMemoryBarrier #195

Open franolichdesign opened 3 years ago

franolichdesign commented 3 years ago

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