Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing OpengGL 4.2 function: glMemoryBarrier #195

Open
franolichdesign opened this issue Nov 20, 2020 · 0 comments
Open

Missing OpengGL 4.2 function: glMemoryBarrier #195

franolichdesign opened this issue Nov 20, 2020 · 0 comments

Comments

@franolichdesign
Copy link

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.

Cheers,
Fran

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant