Skip to content

Commit

Permalink
GL: Deferring glEnable() and glDisable()
Browse files Browse the repository at this point in the history
Proof of concept for the GL call deferring. Testing on Unix.
  • Loading branch information
skyjake committed Feb 7, 2012
1 parent 2c999c9 commit b638141
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 2 additions & 0 deletions doomsday/engine/portable/include/sys_opengl.h
Expand Up @@ -53,6 +53,8 @@
# endif
#endif

#include "gl_deferredapi.h"

#include <string.h>

#include "sys_window.h"
Expand Down
16 changes: 6 additions & 10 deletions doomsday/engine/portable/src/gl_deferredapi.c
Expand Up @@ -26,24 +26,20 @@
#include "gl_defer.h"
#include "gl_deferredapi.h"

static int __inline mustDefer(void)
static boolean mustDefer(void)
{
return !Sys_InMainThread();
}

#define GL_CALL1(form, func, p) \
if(mustDefer()) GL_Defer##form(func, p); else func(p);

void Deferred_glEnable(GLenum e)
{
if(mustDefer())
{
GL_Defer1e(glEnable, e);
}
else
{
glEnable(e);
}
GL_CALL1(1e, glEnable, e);
}

void Deferred_glDisable(GLenum e)
{

GL_CALL1(1e, glDisable, e);
}

0 comments on commit b638141

Please sign in to comment.