"Implement" shader/program binary functions, but don't allow them

* We want the application to pass us real GLSL shaders so we can do all
  kinds of juicy things to them. This is generally indicated by the program
  having a LINK_STATUS of FALSE or similar, and we can pretty much get that
  by just not passing through the call.
This commit is contained in:
baldurk
2014-11-25 21:03:38 +00:00
parent e6b5516776
commit ee5a81739b
4 changed files with 26 additions and 0 deletions
+2
View File
@@ -517,6 +517,8 @@ class WrappedOpenGL
IMPLEMENT_FUNCTION_SERIALISED(void, glUseProgram(GLuint program));
IMPLEMENT_FUNCTION_SERIALISED(void, glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program));
IMPLEMENT_FUNCTION_SERIALISED(void, glValidateProgram(GLuint program));
IMPLEMENT_FUNCTION_SERIALISED(void, glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length));
IMPLEMENT_FUNCTION_SERIALISED(void, glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length));
IMPLEMENT_FUNCTION_SERIALISED(void, glGenProgramPipelines(GLsizei n, GLuint *pipelines));
IMPLEMENT_FUNCTION_SERIALISED(void, glBindProgramPipeline(GLuint pipeline));
IMPLEMENT_FUNCTION_SERIALISED(void, glActiveShaderProgram(GLuint pipeline, GLuint program));
+2
View File
@@ -266,6 +266,8 @@ struct GLHookSet
PFNGLLINKPROGRAMPROC glLinkProgram;
PFNGLPROGRAMPARAMETERIPROC glProgramParameteri;
PFNGLUSEPROGRAMPROC glUseProgram;
PFNGLSHADERBINARYPROC glShaderBinary;
PFNGLPROGRAMBINARYPROC glProgramBinary;
PFNGLUSEPROGRAMSTAGESPROC glUseProgramStages;
PFNGLVALIDATEPROGRAMPROC glValidateProgram;
PFNGLGENPROGRAMPIPELINESPROC glGenProgramPipelines;
+4
View File
@@ -286,6 +286,8 @@
HookExtension(PFNGLLINKPROGRAMPROC, glLinkProgram); \
HookExtension(PFNGLPROGRAMPARAMETERIPROC, glProgramParameteri); \
HookExtension(PFNGLUSEPROGRAMPROC, glUseProgram); \
HookExtension(PFNGLSHADERBINARYPROC, glShaderBinary); \
HookExtension(PFNGLPROGRAMBINARYPROC, glProgramBinary); \
HookExtension(PFNGLUSEPROGRAMSTAGESPROC, glUseProgramStages); \
HookExtension(PFNGLVALIDATEPROGRAMPROC, glValidateProgram); \
HookExtension(PFNGLGENPROGRAMPIPELINESPROC, glGenProgramPipelines); \
@@ -962,6 +964,8 @@
HookWrapper1(void, glLinkProgram, GLuint, program); \
HookWrapper3(void, glProgramParameteri, GLuint, program, GLenum, pname, GLint, value); \
HookWrapper1(void, glUseProgram, GLuint, program); \
HookWrapper5(void, glShaderBinary, GLsizei, count, const GLuint *, shaders, GLenum, binaryformat, const void *, binary, GLsizei, length); \
HookWrapper4(void, glProgramBinary, GLuint, program, GLenum, binaryFormat, const void *, binary, GLsizei, length); \
HookWrapper3(void, glUseProgramStages, GLuint, pipeline, GLbitfield, stages, GLuint, program); \
HookWrapper1(void, glValidateProgram, GLuint, program); \
HookWrapper2(void, glGenProgramPipelines, GLsizei, n, GLuint *, pipelines); \
@@ -690,6 +690,24 @@ void WrappedOpenGL::glValidateProgramPipeline(GLuint pipeline)
m_Real.glValidateProgramPipeline(pipeline);
}
void WrappedOpenGL::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length)
{
// deliberately don't forward on this call when writing, since we want to coax the app into providing non-binary shaders.
if(m_State < WRITING)
{
m_Real.glShaderBinary(count, shaders, binaryformat, binary, length);
}
}
void WrappedOpenGL::glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
{
// deliberately don't forward on this call when writing, since we want to coax the app into providing non-binary shaders.
if(m_State < WRITING)
{
m_Real.glProgramBinary(program, binaryFormat, binary, length);
}
}
#pragma endregion
#pragma region Program Pipelines