Skip to content

Instantly share code, notes, and snippets.

@tobspr
Created June 21, 2014 21:38
Show Gist options
  • Save tobspr/0453682c01d39c57fc94 to your computer and use it in GitHub Desktop.
Save tobspr/0453682c01d39c57fc94 to your computer and use it in GitHub Desktop.
Index: panda/src/glstuff/glGraphicsStateGuardian_src.cxx
===================================================================
RCS file: /cvsroot/panda3d/panda/src/glstuff/glGraphicsStateGuardian_src.cxx,v
retrieving revision 1.471
diff -u -r1.471 glGraphicsStateGuardian_src.cxx
--- panda/src/glstuff/glGraphicsStateGuardian_src.cxx 20 Jun 2014 15:04:39 -0000 1.471
+++ panda/src/glstuff/glGraphicsStateGuardian_src.cxx 21 Jun 2014 21:29:25 -0000
@@ -1115,6 +1115,19 @@
_supports_compute_shaders = true;
}
}
+
+ if (is_at_least_gl_version(4, 2)) {
+ _glMemoryBarrier = (PFNGLMEMORYBARRIEREXTPROC)
+ get_extension_func("glMemoryBarrier");
+
+ if (_glMemoryBarrier != NULL) {
+ cout << "Memory Barrier is supported!\n";
+ } else {
+ cout << "Memory Barrier is NOT supported!\n";
+ }
+ }
+
+
#endif
#ifndef OPENGLES
Index: panda/src/glstuff/glGraphicsStateGuardian_src.h
===================================================================
RCS file: /cvsroot/panda3d/panda/src/glstuff/glGraphicsStateGuardian_src.h,v
retrieving revision 1.191
diff -u -r1.191 glGraphicsStateGuardian_src.h
--- panda/src/glstuff/glGraphicsStateGuardian_src.h 20 Jun 2014 13:17:01 -0000 1.191
+++ panda/src/glstuff/glGraphicsStateGuardian_src.h 21 Jun 2014 21:29:25 -0000
@@ -177,6 +177,9 @@
typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures);
typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
#endif // OPENGLES
+
+typedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers);
+
#endif // __EDG__
////////////////////////////////////////////////////////////////////
@@ -702,6 +705,10 @@
PFNGLBINDIMAGETEXTUREPROC _glBindImageTexture;
PFNGLBINDIMAGETEXTURESPROC _glBindImageTextures;
PFNGLDISPATCHCOMPUTEPROC _glDispatchCompute;
+
+ PFNGLMEMORYBARRIEREXTPROC _glMemoryBarrier;
+
+
#endif // OPENGLES
GLenum _edge_clamp;
Index: panda/src/glstuff/glShaderContext_src.cxx
===================================================================
RCS file: /cvsroot/panda3d/panda/src/glstuff/glShaderContext_src.cxx,v
retrieving revision 1.100
diff -u -r1.100 glShaderContext_src.cxx
--- panda/src/glstuff/glShaderContext_src.cxx 20 Jun 2014 15:04:39 -0000 1.100
+++ panda/src/glstuff/glShaderContext_src.cxx 21 Jun 2014 21:29:26 -0000
@@ -1350,6 +1350,7 @@
void CLP(ShaderContext)::
disable_shader_texture_bindings(GSG *gsg) {
_last_gsg = gsg;
+
if (!valid()) {
return;
}
@@ -1415,6 +1416,9 @@
}
#endif
+
+ gsg->_glMemoryBarrier(GL_ALL_BARRIER_BITS);
+
gsg->report_my_gl_errors();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment