[Feat] (ProgramState): Implement automatic GLSL uniform management.

- Add SPIRV-Cross/glslang integration for uniform reflection.
- Auto-detect and assign locations for uniforms/samplers.
- Support most types of uniform.
- Implement glUniform* functions with type safety.
- Add MG_Util::Program:
  - GLSL-SPIRV conversion
  - SPIRV uniform reflection
  - Program uniform dumping
This commit is contained in:
BZLZHH
2025-05-03 22:50:41 +08:00
parent dc5f74cdb9
commit 383ec85400
16 changed files with 1696 additions and 171 deletions
@@ -53,7 +53,7 @@ DECLARE_GL_FUNCTION_HEAD(void, ClearColor, GLfloat red, GLfloat green, GLfloat b
DECLARE_GL_FUNCTION_STUB_HEAD(void, ClearDepthf, GLfloat d) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, ClearDepthf, d)
DECLARE_GL_FUNCTION_STUB_HEAD(void, ClearStencil, GLint s) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, ClearStencil, s)
DECLARE_GL_FUNCTION_STUB_HEAD(void, ColorMask, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, ColorMask, red,green,blue,alpha)
DECLARE_GL_FUNCTION_STUB_HEAD(void, CompileShader, GLuint shader) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, CompileShader, shader)
DECLARE_GL_FUNCTION_HEAD(void, CompileShader, GLuint shader) DECLARE_GL_FUNCTION_END_NO_RETURN(void, CompileShader, shader)
DECLARE_GL_FUNCTION_STUB_HEAD(void, CompressedTexImage2D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, CompressedTexImage2D, target,level,internalformat,width,height,border,imageSize,data)
DECLARE_GL_FUNCTION_STUB_HEAD(void, CompressedTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, CompressedTexSubImage2D, target,level,xoffset,yoffset,width,height,format,imageSize,data)
DECLARE_GL_FUNCTION_STUB_HEAD(void, CopyTexImage2D, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, CopyTexImage2D, target,level,internalformat,x,y,width,height,border)
@@ -143,25 +143,25 @@ DECLARE_GL_FUNCTION_STUB_HEAD(void, TexParameterfv, GLenum target, GLenum pname,
DECLARE_GL_FUNCTION_HEAD(void, TexParameteri, GLenum target, GLenum pname, GLint param) DECLARE_GL_FUNCTION_END_NO_RETURN(void, TexParameteri, target,pname,param)
DECLARE_GL_FUNCTION_STUB_HEAD(void, TexParameteriv, GLenum target, GLenum pname, const GLint *params) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, TexParameteriv, target,pname,params)
DECLARE_GL_FUNCTION_HEAD(void, TexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels) DECLARE_GL_FUNCTION_END_NO_RETURN(void, TexSubImage2D, target,level,xoffset,yoffset,width,height,format,type,pixels)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform1f, GLint location, GLfloat v0) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform1f, location,v0)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform1fv, GLint location, GLsizei count, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform1fv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform1i, GLint location, GLint v0) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform1i, location,v0)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform1iv, GLint location, GLsizei count, const GLint *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform1iv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform2f, GLint location, GLfloat v0, GLfloat v1) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform2f, location,v0,v1)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform2fv, GLint location, GLsizei count, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform2fv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform2i, GLint location, GLint v0, GLint v1) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform2i, location,v0,v1)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform2iv, GLint location, GLsizei count, const GLint *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform2iv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform3f, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform3f, location,v0,v1,v2)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform3fv, GLint location, GLsizei count, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform3fv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform3i, GLint location, GLint v0, GLint v1, GLint v2) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform3i, location,v0,v1,v2)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform3iv, GLint location, GLsizei count, const GLint *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform3iv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform4f, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform4f, location,v0,v1,v2,v3)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform4fv, GLint location, GLsizei count, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform4fv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform4i, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform4i, location,v0,v1,v2,v3)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform4iv, GLint location, GLsizei count, const GLint *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform4iv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, UniformMatrix2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, UniformMatrix2fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, UniformMatrix3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, UniformMatrix3fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, UniformMatrix4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, UniformMatrix4fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform1f, GLint location, GLfloat v0) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform1f, location,v0)
DECLARE_GL_FUNCTION_HEAD(void, Uniform1fv, GLint location, GLsizei count, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform1fv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform1i, GLint location, GLint v0) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform1i, location,v0)
DECLARE_GL_FUNCTION_HEAD(void, Uniform1iv, GLint location, GLsizei count, const GLint *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform1iv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform2f, GLint location, GLfloat v0, GLfloat v1) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform2f, location,v0,v1)
DECLARE_GL_FUNCTION_HEAD(void, Uniform2fv, GLint location, GLsizei count, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform2fv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform2i, GLint location, GLint v0, GLint v1) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform2i, location,v0,v1)
DECLARE_GL_FUNCTION_HEAD(void, Uniform2iv, GLint location, GLsizei count, const GLint *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform2iv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform3f, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform3f, location,v0,v1,v2)
DECLARE_GL_FUNCTION_HEAD(void, Uniform3fv, GLint location, GLsizei count, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform3fv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform3i, GLint location, GLint v0, GLint v1, GLint v2) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform3i, location,v0,v1,v2)
DECLARE_GL_FUNCTION_HEAD(void, Uniform3iv, GLint location, GLsizei count, const GLint *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform3iv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform4f, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform4f, location,v0,v1,v2,v3)
DECLARE_GL_FUNCTION_HEAD(void, Uniform4fv, GLint location, GLsizei count, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform4fv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform4i, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform4i, location,v0,v1,v2,v3)
DECLARE_GL_FUNCTION_HEAD(void, Uniform4iv, GLint location, GLsizei count, const GLint *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform4iv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, UniformMatrix2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, UniformMatrix2fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_HEAD(void, UniformMatrix3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, UniformMatrix3fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_HEAD(void, UniformMatrix4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, UniformMatrix4fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_HEAD(void, UseProgram, GLuint program) DECLARE_GL_FUNCTION_END_NO_RETURN(void, UseProgram, program)
DECLARE_GL_FUNCTION_STUB_HEAD(void, ValidateProgram, GLuint program) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, ValidateProgram, program)
DECLARE_GL_FUNCTION_STUB_HEAD(void, VertexAttrib1f, GLuint index, GLfloat x) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, VertexAttrib1f, index,x)
@@ -191,12 +191,12 @@ DECLARE_GL_FUNCTION_STUB_HEAD(void, GetQueryObjectuiv, GLuint id, GLenum pname,
DECLARE_GL_FUNCTION_HEAD(GLboolean, UnmapBuffer, GLenum target) DECLARE_GL_FUNCTION_END(GLboolean, UnmapBuffer, target)
DECLARE_GL_FUNCTION_STUB_HEAD(void, GetBufferPointerv, GLenum target, GLenum pname, void **params) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, GetBufferPointerv, target,pname,params)
DECLARE_GL_FUNCTION_STUB_HEAD(void, DrawBuffers, GLsizei n, const GLenum *bufs) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, DrawBuffers, n,bufs)
DECLARE_GL_FUNCTION_STUB_HEAD(void, UniformMatrix2x3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, UniformMatrix2x3fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, UniformMatrix3x2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, UniformMatrix3x2fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, UniformMatrix2x4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, UniformMatrix2x4fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, UniformMatrix4x2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, UniformMatrix4x2fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, UniformMatrix3x4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, UniformMatrix3x4fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, UniformMatrix4x3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, UniformMatrix4x3fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_HEAD(void, UniformMatrix2x3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, UniformMatrix2x3fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_HEAD(void, UniformMatrix3x2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, UniformMatrix3x2fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_HEAD(void, UniformMatrix2x4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, UniformMatrix2x4fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_HEAD(void, UniformMatrix4x2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, UniformMatrix4x2fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_HEAD(void, UniformMatrix3x4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, UniformMatrix3x4fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_HEAD(void, UniformMatrix4x3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, UniformMatrix4x3fv, location,count,transpose,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, BlitFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, BlitFramebuffer, srcX0,srcY0,srcX1,srcY1,dstX0,dstY0,dstX1,dstY1,mask,filter)
DECLARE_GL_FUNCTION_STUB_HEAD(void, RenderbufferStorageMultisample, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, RenderbufferStorageMultisample, target,samples,internalformat,width,height)
DECLARE_GL_FUNCTION_STUB_HEAD(void, FramebufferTextureLayer, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, FramebufferTextureLayer, target,attachment,texture,level,layer)
@@ -221,14 +221,14 @@ DECLARE_GL_FUNCTION_STUB_HEAD(void, VertexAttribI4iv, GLuint index, const GLint
DECLARE_GL_FUNCTION_STUB_HEAD(void, VertexAttribI4uiv, GLuint index, const GLuint *v) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, VertexAttribI4uiv, index,v)
DECLARE_GL_FUNCTION_STUB_HEAD(void, GetUniformuiv, GLuint program, GLint location, GLuint *params) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, GetUniformuiv, program,location,params)
DECLARE_GL_FUNCTION_STUB_HEAD(GLint, GetFragDataLocation, GLuint program, const GLchar *name) DECLARE_GL_FUNCTION_STUB_END(GLint, GetFragDataLocation, program,name)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform1ui, GLint location, GLuint v0) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform1ui, location,v0)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform2ui, GLint location, GLuint v0, GLuint v1) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform2ui, location,v0,v1)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform3ui, GLint location, GLuint v0, GLuint v1, GLuint v2) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform3ui, location,v0,v1,v2)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform4ui, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform4ui, location,v0,v1,v2,v3)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform1uiv, GLint location, GLsizei count, const GLuint *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform1uiv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform2uiv, GLint location, GLsizei count, const GLuint *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform2uiv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform3uiv, GLint location, GLsizei count, const GLuint *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform3uiv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, Uniform4uiv, GLint location, GLsizei count, const GLuint *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Uniform4uiv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform1ui, GLint location, GLuint v0) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform1ui, location,v0)
DECLARE_GL_FUNCTION_HEAD(void, Uniform2ui, GLint location, GLuint v0, GLuint v1) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform2ui, location,v0,v1)
DECLARE_GL_FUNCTION_HEAD(void, Uniform3ui, GLint location, GLuint v0, GLuint v1, GLuint v2) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform3ui, location,v0,v1,v2)
DECLARE_GL_FUNCTION_HEAD(void, Uniform4ui, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform4ui, location,v0,v1,v2,v3)
DECLARE_GL_FUNCTION_HEAD(void, Uniform1uiv, GLint location, GLsizei count, const GLuint *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform1uiv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform2uiv, GLint location, GLsizei count, const GLuint *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform2uiv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform3uiv, GLint location, GLsizei count, const GLuint *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform3uiv, location,count,value)
DECLARE_GL_FUNCTION_HEAD(void, Uniform4uiv, GLint location, GLsizei count, const GLuint *value) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Uniform4uiv, location,count,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, ClearBufferiv, GLenum buffer, GLint drawbuffer, const GLint *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, ClearBufferiv, buffer,drawbuffer,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, ClearBufferuiv, GLenum buffer, GLint drawbuffer, const GLuint *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, ClearBufferuiv, buffer,drawbuffer,value)
DECLARE_GL_FUNCTION_STUB_HEAD(void, ClearBufferfv, GLenum buffer, GLint drawbuffer, const GLfloat *value) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, ClearBufferfv, buffer,drawbuffer,value)
@@ -130,4 +130,169 @@ namespace MG_GL::GL {
MG_State::SetError(result);
MG_Util::Debug::LogE("Error getting shader param: %s", MG_Util::Debug::GLEnumToString(result));
}
void Uniform1f(GLint location, GLfloat v0) {
MG_Util::Debug::LogD("glUniform1f, location: %d, v0: %f", location, v0);
MG_State::UpdateProgramUniformFloat1(location, v0);
}
void Uniform2f(GLint location, GLfloat v0, GLfloat v1) {
MG_Util::Debug::LogD("glUniform2f, location: %d, v0: %f, v1: %f", location, v0, v1);
MG_State::UpdateProgramUniformFloat2(location, v0, v1);
}
void Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) {
MG_Util::Debug::LogD("glUniform3f, location: %d, v0: %f, v1: %f, v2: %f", location, v0, v1, v2);
MG_State::UpdateProgramUniformFloat3(location, v0, v1, v2);
}
void Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) {
MG_Util::Debug::LogD("glUniform4f, location: %d, v0: %f, v1: %f, v2: %f, v3: %f", location, v0, v1, v2, v3);
MG_State::UpdateProgramUniformFloat4(location, v0, v1, v2, v3);
}
void Uniform1fv(GLint location, GLsizei count, const GLfloat* value) {
MG_Util::Debug::LogD("glUniform1fv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformFloatVector1(location, count, value);
}
void Uniform2fv(GLint location, GLsizei count, const GLfloat* value) {
MG_Util::Debug::LogD("glUniform2fv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformFloatVector2(location, count, value);
}
void Uniform3fv(GLint location, GLsizei count, const GLfloat* value) {
MG_Util::Debug::LogD("glUniform3fv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformFloatVector3(location, count, value);
}
void Uniform4fv(GLint location, GLsizei count, const GLfloat* value) {
MG_Util::Debug::LogD("glUniform4fv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformFloatVector4(location, count, value);
}
void Uniform1i(GLint location, GLint v0) {
MG_Util::Debug::LogD("glUniform1i, location: %d, v0: %d", location, v0);
MG_State::UpdateProgramUniformInt1(location, v0);
}
void Uniform2i(GLint location, GLint v0, GLint v1) {
MG_Util::Debug::LogD("glUniform2i, location: %d, v0: %d, v1: %d", location, v0, v1);
MG_State::UpdateProgramUniformInt2(location, v0, v1);
}
void Uniform3i(GLint location, GLint v0, GLint v1, GLint v2) {
MG_Util::Debug::LogD("glUniform3i, location: %d, v0: %d, v1: %d, v2: %d", location, v0, v1, v2);
MG_State::UpdateProgramUniformInt3(location, v0, v1, v2);
}
void Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) {
MG_Util::Debug::LogD("glUniform4i, location: %d, v0: %d, v1: %d, v2: %d, v3: %d", location, v0, v1, v2, v3);
MG_State::UpdateProgramUniformInt4(location, v0, v1, v2, v3);
}
void Uniform1iv(GLint location, GLsizei count, const GLint* value) {
MG_Util::Debug::LogD("glUniform1iv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformIntVector1(location, count, value);
}
void Uniform2iv(GLint location, GLsizei count, const GLint* value) {
MG_Util::Debug::LogD("glUniform2iv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformIntVector2(location, count, value);
}
void Uniform3iv(GLint location, GLsizei count, const GLint* value) {
MG_Util::Debug::LogD("glUniform3iv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformIntVector3(location, count, value);
}
void Uniform4iv(GLint location, GLsizei count, const GLint* value) {
MG_Util::Debug::LogD("glUniform4iv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformIntVector4(location, count, value);
}
void Uniform1ui(GLint location, GLuint v0) {
MG_Util::Debug::LogD("glUniform1ui, location: %d, v0: %u", location, v0);
MG_State::UpdateProgramUniformUInt1(location, v0);
}
void Uniform2ui(GLint location, GLuint v0, GLuint v1) {
MG_Util::Debug::LogD("glUniform2ui, location: %d, v0: %u, v1: %u", location, v0, v1);
MG_State::UpdateProgramUniformUInt2(location, v0, v1);
}
void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) {
MG_Util::Debug::LogD("glUniform3ui, location: %d, v0: %u, v1: %u, v2: %u", location, v0, v1, v2);
MG_State::UpdateProgramUniformUInt3(location, v0, v1, v2);
}
void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) {
MG_Util::Debug::LogD("glUniform4ui, location: %d, v0: %u, v1: %u, v2: %u, v3: %u", location, v0, v1, v2, v3);
MG_State::UpdateProgramUniformUInt4(location, v0, v1, v2, v3);
}
void Uniform1uiv(GLint location, GLsizei count, const GLuint* value) {
MG_Util::Debug::LogD("glUniform1uiv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformUIntVector1(location, count, value);
}
void Uniform2uiv(GLint location, GLsizei count, const GLuint* value) {
MG_Util::Debug::LogD("glUniform2uiv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformUIntVector2(location, count, value);
}
void Uniform3uiv(GLint location, GLsizei count, const GLuint* value) {
MG_Util::Debug::LogD("glUniform3uiv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformUIntVector3(location, count, value);
}
void Uniform4uiv(GLint location, GLsizei count, const GLuint* value) {
MG_Util::Debug::LogD("glUniform4uiv, location: %d, count: %d", location, count);
MG_State::UpdateProgramUniformUIntVector4(location, count, value);
}
void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
MG_Util::Debug::LogD("glUniformMatrix2fv, location: %d, count: %d, transpose: %d", location, count, transpose);
MG_State::UpdateProgramUniformMatrix2x2Vector(location, count, transpose, value);
}
void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
MG_Util::Debug::LogD("glUniformMatrix3fv, location: %d, count: %d, transpose: %d", location, count, transpose);
MG_State::UpdateProgramUniformMatrix3x3Vector(location, count, transpose, value);
}
void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
MG_Util::Debug::LogD("glUniformMatrix4fv, location: %d, count: %d, transpose: %d", location, count, transpose);
MG_State::UpdateProgramUniformMatrix4x4Vector(location, count, transpose, value);
}
void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
MG_Util::Debug::LogD("glUniformMatrix2x3fv, location: %d, count: %d, transpose: %d", location, count, transpose);
MG_State::UpdateProgramUniformMatrix2x3Vector(location, count, transpose, value);
}
void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
MG_Util::Debug::LogD("glUniformMatrix2x4fv, location: %d, count: %d, transpose: %d", location, count, transpose);
MG_State::UpdateProgramUniformMatrix2x4Vector(location, count, transpose, value);
}
void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
MG_Util::Debug::LogD("glUniformMatrix3x2fv, location: %d, count: %d, transpose: %d", location, count, transpose);
MG_State::UpdateProgramUniformMatrix3x2Vector(location, count, transpose, value);
}
void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
MG_Util::Debug::LogD("glUniformMatrix3x4fv, location: %d, count: %d, transpose: %d", location, count, transpose);
MG_State::UpdateProgramUniformMatrix3x4Vector(location, count, transpose, value);
}
void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
MG_Util::Debug::LogD("glUniformMatrix4x2fv, location: %d, count: %d, transpose: %d", location, count, transpose);
MG_State::UpdateProgramUniformMatrix4x2Vector(location, count, transpose, value);
}
void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
MG_Util::Debug::LogD("glUniformMatrix4x3fv, location: %d, count: %d, transpose: %d", location, count, transpose);
MG_State::UpdateProgramUniformMatrix4x3Vector(location, count, transpose, value);
}
}
@@ -22,6 +22,39 @@ namespace MG_GL::GL {
GLint GetUniformLocation(GLuint program, const GLchar* name);
void GetProgramiv(GLuint program, GLenum pname, GLint* params);
void GetShaderiv(GLuint shader, GLenum pname, GLint* params);
void Uniform1f(GLint location, GLfloat v0);
void Uniform2f(GLint location, GLfloat v0, GLfloat v1);
void Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
void Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
void Uniform1fv(GLint location, GLsizei count, const GLfloat* value);
void Uniform2fv(GLint location, GLsizei count, const GLfloat* value);
void Uniform3fv(GLint location, GLsizei count, const GLfloat* value);
void Uniform4fv(GLint location, GLsizei count, const GLfloat* value);
void Uniform1i(GLint location, GLint v0);
void Uniform2i(GLint location, GLint v0, GLint v1);
void Uniform3i(GLint location, GLint v0, GLint v1, GLint v2);
void Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
void Uniform1iv(GLint location, GLsizei count, const GLint* value);
void Uniform2iv(GLint location, GLsizei count, const GLint* value);
void Uniform3iv(GLint location, GLsizei count, const GLint* value);
void Uniform4iv(GLint location, GLsizei count, const GLint* value);
void Uniform1ui(GLint location, GLuint v0);
void Uniform2ui(GLint location, GLuint v0, GLuint v1);
void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
void Uniform1uiv(GLint location, GLsizei count, const GLuint* value);
void Uniform2uiv(GLint location, GLsizei count, const GLuint* value);
void Uniform3uiv(GLint location, GLsizei count, const GLuint* value);
void Uniform4uiv(GLint location, GLsizei count, const GLuint* value);
void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
}
#endif //MOBILEGL_GL_PROGRAM_H