diff --git a/doomsday/engine/portable/include/gl_defer.h b/doomsday/engine/portable/include/gl_defer.h index 90e85e0d4e..5ecb1c3acc 100644 --- a/doomsday/engine/portable/include/gl_defer.h +++ b/doomsday/engine/portable/include/gl_defer.h @@ -73,8 +73,10 @@ void GL_ReleaseReservedNames(void); void GL_DeferTextureUpload(const struct texturecontent_s* content); // Deferring functions for various function signatures. -#define LIBDENG_GL_DEFER1(form, x) void GL_Defer_##form(void (GL_CALL *ptr)(x), x) -#define LIBDENG_GL_DEFER2(form, x, y) void GL_Defer_##form(void (GL_CALL* ptr)(x, y), x, y) +#define LIBDENG_GL_DEFER1(form, x) void GL_Defer_##form(void (GL_CALL *ptr)(x), x) +#define LIBDENG_GL_DEFER2(form, x, y) void GL_Defer_##form(void (GL_CALL* ptr)(x, y), x, y) +#define LIBDENG_GL_DEFER3(form, x, y, z) void GL_Defer_##form(void (GL_CALL* ptr)(x, y, z), x, y, z) +#define LIBDENG_GL_DEFER4(form, x, y, z, w) void GL_Defer_##form(void (GL_CALL* ptr)(x, y, z, w), x, y, z, w) LIBDENG_GL_DEFER1(e, GLenum e); LIBDENG_GL_DEFER2(uintArray, GLsizei count, const GLuint* values); diff --git a/doomsday/engine/portable/include/gl_deferredapi.h b/doomsday/engine/portable/include/gl_deferredapi.h index 6bba4a9300..abe13cd4a1 100644 --- a/doomsday/engine/portable/include/gl_deferredapi.h +++ b/doomsday/engine/portable/include/gl_deferredapi.h @@ -5,6 +5,9 @@ * Redefines GL API functions so that they're replaced with ones that defer the * call when needed. * + * @note Only the GL API functions declared in this file are safe to call from + * outside the main thread! + * * @authors Copyright © 2012 Jaakko Keränen * @authors Copyright © 2012 Daniel Swanson * diff --git a/doomsday/engine/portable/src/gl_defer.c b/doomsday/engine/portable/src/gl_defer.c index 2661f85c8e..f2b8c4194a 100644 --- a/doomsday/engine/portable/src/gl_defer.c +++ b/doomsday/engine/portable/src/gl_defer.c @@ -45,10 +45,10 @@ typedef enum { DTT_FUNC_PTR_UINT_ARRAY, DTT_FUNC_PTR_END, - DEFERREDTASK_TYPES_COUNT + DEFERREDTASK_TYPES_LAST } deferredtask_type_t; -#define VALID_DEFERREDTASK_TYPE(t) ((t) >= DEFERREDTASK_TYPES_FIRST || (t) < DEFERREDTASK_TYPES_COUNT) +#define VALID_DEFERREDTASK_TYPE(t) ((t) >= DEFERREDTASK_TYPES_FIRST || (t) < DEFERREDTASK_TYPES_LAST) typedef struct deferredtask_s { struct deferredtask_s* next; diff --git a/doomsday/engine/portable/src/gl_texmanager.c b/doomsday/engine/portable/src/gl_texmanager.c index cb9c39c882..c6fa7595de 100644 --- a/doomsday/engine/portable/src/gl_texmanager.c +++ b/doomsday/engine/portable/src/gl_texmanager.c @@ -1315,8 +1315,6 @@ void GL_ReleaseSystemTextures(void) VERBOSE( Con_Message("Releasing System textures...\n") ) - LIBDENG_ASSERT_IN_MAIN_THREAD(); - // The rendering lists contain persistent references to texture names. // Which, obviously, can't persist any longer... RL_DeleteLists(); diff --git a/doomsday/engine/portable/src/rend_particle.c b/doomsday/engine/portable/src/rend_particle.c index ee8ccb12a6..aa34c102e4 100644 --- a/doomsday/engine/portable/src/rend_particle.c +++ b/doomsday/engine/portable/src/rend_particle.c @@ -204,8 +204,6 @@ void Rend_ParticleReleaseSystemTextures(void) { if(novideo) return; - LIBDENG_ASSERT_IN_MAIN_THREAD(); - glDeleteTextures(1, (const GLuint*) &pointTex); pointTex = 0; } @@ -214,8 +212,6 @@ void Rend_ParticleReleaseExtraTextures(void) { if(novideo) return; - LIBDENG_ASSERT_IN_MAIN_THREAD(); - glDeleteTextures(NUM_TEX_NAMES, (const GLuint*) ptctexname); memset(ptctexname, 0, sizeof(ptctexname)); } diff --git a/doomsday/engine/portable/src/ui_main.c b/doomsday/engine/portable/src/ui_main.c index 7ba73b18bd..f2aa8ae68a 100644 --- a/doomsday/engine/portable/src/ui_main.c +++ b/doomsday/engine/portable/src/ui_main.c @@ -291,8 +291,6 @@ void UI_LoadTextures(void) void UI_ReleaseTextures(void) { - LIBDENG_ASSERT_IN_MAIN_THREAD(); - glDeleteTextures(NUM_UITEXTURES, (const GLuint*) uiTextures); memset(uiTextures, 0, sizeof(uiTextures)); }