From d3000aac768b657889c4bcfda0c4a8218a3dc8ef Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 15 Nov 2011 12:30:17 -0500 Subject: [PATCH] Documented MOJOSHADER_glBindShaders(). --- mojoshader.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/mojoshader.h b/mojoshader.h index ad43ae29..2c3f4cf7 100644 --- a/mojoshader.h +++ b/mojoshader.h @@ -2705,7 +2705,31 @@ MOJOSHADER_glProgram *MOJOSHADER_glLinkProgram(MOJOSHADER_glShader *vshader, */ void MOJOSHADER_glBindProgram(MOJOSHADER_glProgram *program); -// !!! FIXME: document this. +/* + * This binds individual shaders as if you had linked them with + * MOJOSHADER_glLinkProgram(), and used MOJOSHADER_glBindProgram() on the + * linked result. + * + * MojoShader will handle linking behind the scenes, and keep a cache of + * programs linked here. Programs are removed from this cache when one of the + * invidual shaders in it is deleted, otherwise they remain cached so future + * calls to this function don't need to relink a previously-used shader + * grouping. + * + * This function is for convenience, as the API is closer to how Direct3D + * works, and retrofitting linking into your app can be difficult; + * frequently, you just end up building your own cache, anyhow. + * + * Calling with all shaders set to NULL is equivalent to calling + * MOJOSHADER_glBindProgram(NULL). + * + * 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 requires a valid MOJOSHADER_glContext to have been made current, + * or it will crash your program. See MOJOSHADER_glMakeContextCurrent(). + */ void MOJOSHADER_glBindShaders(MOJOSHADER_glShader *vshader, MOJOSHADER_glShader *pshader);