From 18940b812a103bcb9aa15004b603c79733477bc2 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 28 Apr 2008 06:00:37 -0400 Subject: [PATCH] Renamed glInit and glDeinit to glCreateContext and glDestroyContext. --HG-- branch : trunk --- finderrors.c | 6 +++--- mojoshader.h | 23 +++++++++++------------ mojoshader_opengl.c | 8 ++++---- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/finderrors.c b/finderrors.c index dbef9a35..cf2207fa 100644 --- a/finderrors.c +++ b/finderrors.c @@ -114,10 +114,10 @@ int main(int argc, char **argv) SDL_GL_LoadLibrary(NULL); SDL_SetVideoMode(640, 480, 0, SDL_OPENGL); MOJOSHADER_glContext *ctx; - ctx = MOJOSHADER_glInit(profile, SDL_GL_GetProcAddress, 0, 0, 0); + ctx = MOJOSHADER_glCreateContext(profile, SDL_GL_GetProcAddress, 0, 0, 0); if (ctx == NULL) { - printf("MOJOSHADER_glInit() fail: %s\n", MOJOSHADER_glGetError()); + printf("MOJOSHADER_glCreateContext() fail: %s\n", MOJOSHADER_glGetError()); SDL_Quit(); return 1; } // if @@ -130,7 +130,7 @@ int main(int argc, char **argv) printf("Saw %d bytecode files.\n", total); #if FINDERRORS_COMPILE_SHADERS - MOJOSHADER_glDeinit(ctx); + MOJOSHADER_glDestroyContext(ctx); SDL_Quit(); #endif } // else diff --git a/mojoshader.h b/mojoshader.h index 40fad638..bf679fc2 100644 --- a/mojoshader.h +++ b/mojoshader.h @@ -359,8 +359,8 @@ typedef struct MOJOSHADER_glProgram MOJOSHADER_glProgram; * You must call this once AFTER you have successfully built your GL context * and made it current. This function will lookup the GL functions it needs * through the callback you supply, after which it may call them at any time - * up until you call MOJOSHADER_glDeinit(). The lookup function is neither - * stored nor used by MojoShader after this function returns. + * up until you call MOJOSHADER_glDestroyContext(). The lookup function is + * neither stored nor used by MojoShader after this function returns. * * (profile) is an OpenGL-specific MojoShader profile, which decides how * Direct3D bytecode shaders get turned into OpenGL programs, and how they @@ -385,14 +385,15 @@ typedef struct MOJOSHADER_glProgram MOJOSHADER_glProgram; * are not thread safe, you should probably only call this from the same * thread that created the GL context. */ -MOJOSHADER_glContext *MOJOSHADER_glInit(const char *profile, +MOJOSHADER_glContext *MOJOSHADER_glCreateContext(const char *profile, void *(*lookup)(const char *fnname), MOJOSHADER_malloc m, MOJOSHADER_free f, void *d); /* * You must call this before using the context that you got from - * MOJOSHADER_glInit(), and must use it when you switch to a new GL context. + * MOJOSHADER_glCreateContext(), and must use it when you switch to a new GL + * context. * * You can only have one MOJOSHADER_glContext per actual GL context, or * undefined behaviour will result. @@ -419,15 +420,13 @@ void MOJOSHADER_glMakeContextCurrent(MOJOSHADER_glContext *ctx); * buffer. Do not keep the pointer around, either, as it's likely to become * invalid as soon as you call into MojoShader again. * - * This is safe to call even if MOJOSHADER_glInit() failed. - * * This call is NOT thread safe! As most OpenGL implementations are not thread * safe, you should probably only call this from the same thread that created * the GL context. * * This call does NOT require a valid MOJOSHADER_glContext to have been made * current. The error buffer is shared between contexts, so you can get - * error results from a failed MOJOSHADER_glInit(). + * error results from a failed MOJOSHADER_glCreateContext(). */ const char *MOJOSHADER_glGetError(void); @@ -699,10 +698,10 @@ void MOJOSHADER_glDeleteShader(MOJOSHADER_glShader *shader); /* * Deinitialize MojoShader's OpenGL shader management. * - * You must call this once, while your GL context is still current, if you - * previously had a successful call to MOJOSHADER_glInit(). This should - * be the last MOJOSHADER_gl* function you call until you've initialized - * again. + * You must call this once, while your GL context (not MojoShader context) is + * still current, if you previously had a successful call to + * MOJOSHADER_glCreateContext(). This should be the last MOJOSHADER_gl* + * function you call until you've prepared a context again. * * This will clean up resources previously allocated, and may call into the GL. * @@ -718,7 +717,7 @@ void MOJOSHADER_glDeleteShader(MOJOSHADER_glShader *shader); * are not thread safe, you should probably only call this from the same * thread that created the GL context. */ -void MOJOSHADER_glDeinit(MOJOSHADER_glContext *ctx); +void MOJOSHADER_glDestroyContext(MOJOSHADER_glContext *ctx); #ifdef __cplusplus } diff --git a/mojoshader_opengl.c b/mojoshader_opengl.c index ef8209db..4a8d5268 100644 --- a/mojoshader_opengl.c +++ b/mojoshader_opengl.c @@ -297,7 +297,7 @@ static int check_extensions(void *(*lookup)(const char *fnname)) } // check_extensions -MOJOSHADER_glContext *MOJOSHADER_glInit(const char *_profile, +MOJOSHADER_glContext *MOJOSHADER_glCreateContext(const char *_profile, void *(*lookup)(const char *fnname), MOJOSHADER_malloc m, MOJOSHADER_free f, void *d) @@ -343,7 +343,7 @@ MOJOSHADER_glContext *MOJOSHADER_glInit(const char *_profile, f(ctx, d); ctx = current_ctx; return NULL; -} // MOJOSHADER_glInit +} // MOJOSHADER_glCreateContext void MOJOSHADER_glMakeContextCurrent(MOJOSHADER_glContext *_ctx) @@ -820,7 +820,7 @@ void MOJOSHADER_glDeleteShader(MOJOSHADER_glShader *shader) } // MOJOSHADER_glDeleteShader -void MOJOSHADER_glDeinit(MOJOSHADER_glContext *_ctx) +void MOJOSHADER_glDestroyContext(MOJOSHADER_glContext *_ctx) { MOJOSHADER_glContext *current_ctx = ctx; ctx = _ctx; @@ -828,7 +828,7 @@ void MOJOSHADER_glDeinit(MOJOSHADER_glContext *_ctx) lookup_entry_points(NULL); Free(ctx); ctx = ((current_ctx == _ctx) ? NULL : current_ctx); -} // MOJOSHADER_glDeinit +} // MOJOSHADER_glDestroyContext // end of mojoshader_opengl.c ...