mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-25 23:47:30 +01:00
Add support for handling non square matrix uniform types in GLSL
Thanks @devsh for the patch. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6072 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
7beeb3d3f8
commit
dbf03c296c
@ -44,7 +44,9 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
|
||||
pGlGetUniformLocationARB(0), pGlGetUniformLocation(0),
|
||||
pGlUniform1fvARB(0), pGlUniform2fvARB(0), pGlUniform3fvARB(0), pGlUniform4fvARB(0),
|
||||
pGlUniform1ivARB(0), pGlUniform2ivARB(0), pGlUniform3ivARB(0), pGlUniform4ivARB(0),
|
||||
pGlUniformMatrix2fvARB(0), pGlUniformMatrix3fvARB(0), pGlUniformMatrix4fvARB(0),
|
||||
pGlUniformMatrix2fvARB(0), pGlUniformMatrix2x3fv(0), pGlUniformMatrix2x4fv(0),
|
||||
pGlUniformMatrix3x2fv(0), pGlUniformMatrix3fvARB(0), pGlUniformMatrix3x4fv(0),
|
||||
pGlUniformMatrix4x2fv(0), pGlUniformMatrix4x3fv(0), pGlUniformMatrix4fvARB(0),
|
||||
pGlGetActiveUniformARB(0), pGlGetActiveUniform(0),
|
||||
pGlPointParameterfARB(0), pGlPointParameterfvARB(0),
|
||||
pGlStencilFuncSeparate(0), pGlStencilOpSeparate(0),
|
||||
@ -465,7 +467,13 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
||||
pGlUniform3ivARB = (PFNGLUNIFORM3IVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniform3ivARB");
|
||||
pGlUniform4ivARB = (PFNGLUNIFORM4IVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniform4ivARB");
|
||||
pGlUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniformMatrix2fvARB");
|
||||
pGlUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC) IRR_OGL_LOAD_EXTENSION("glUniformMatrix2x3fv");
|
||||
pGlUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)IRR_OGL_LOAD_EXTENSION("glUniformMatrix2x4fv");
|
||||
pGlUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)IRR_OGL_LOAD_EXTENSION("glUniformMatrix3x2fv");
|
||||
pGlUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniformMatrix3fvARB");
|
||||
pGlUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)IRR_OGL_LOAD_EXTENSION("glUniformMatrix3x4fv");
|
||||
pGlUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)IRR_OGL_LOAD_EXTENSION("glUniformMatrix4x2fv");
|
||||
pGlUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)IRR_OGL_LOAD_EXTENSION("glUniformMatrix4x3fv");
|
||||
pGlUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniformMatrix4fvARB");
|
||||
pGlGetActiveUniformARB = (PFNGLGETACTIVEUNIFORMARBPROC) IRR_OGL_LOAD_EXTENSION("glGetActiveUniformARB");
|
||||
pGlGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) IRR_OGL_LOAD_EXTENSION("glGetActiveUniform");
|
||||
|
@ -1128,7 +1128,13 @@ class COpenGLExtensionHandler
|
||||
void extGlUniform3iv(GLint loc, GLsizei count, const GLint *v);
|
||||
void extGlUniform4iv(GLint loc, GLsizei count, const GLint *v);
|
||||
void extGlUniformMatrix2fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
|
||||
void extGlUniformMatrix2x3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
|
||||
void extGlUniformMatrix2x4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
|
||||
void extGlUniformMatrix3x2fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
|
||||
void extGlUniformMatrix3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
|
||||
void extGlUniformMatrix3x4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
|
||||
void extGlUniformMatrix4x2fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
|
||||
void extGlUniformMatrix4x3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
|
||||
void extGlUniformMatrix4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
|
||||
void extGlGetActiveUniformARB(GLhandleARB program, GLuint index, GLsizei maxlength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
void extGlGetActiveUniform(GLuint program, GLuint index, GLsizei maxlength, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
@ -1257,7 +1263,13 @@ class COpenGLExtensionHandler
|
||||
PFNGLUNIFORM3IVARBPROC pGlUniform3ivARB;
|
||||
PFNGLUNIFORM4IVARBPROC pGlUniform4ivARB;
|
||||
PFNGLUNIFORMMATRIX2FVARBPROC pGlUniformMatrix2fvARB;
|
||||
PFNGLUNIFORMMATRIX2X3FVPROC pGlUniformMatrix2x3fv;
|
||||
PFNGLUNIFORMMATRIX2X4FVPROC pGlUniformMatrix2x4fv;
|
||||
PFNGLUNIFORMMATRIX3X2FVPROC pGlUniformMatrix3x2fv;
|
||||
PFNGLUNIFORMMATRIX3FVARBPROC pGlUniformMatrix3fvARB;
|
||||
PFNGLUNIFORMMATRIX3X4FVPROC pGlUniformMatrix3x4fv;
|
||||
PFNGLUNIFORMMATRIX4X2FVPROC pGlUniformMatrix4x2fv;
|
||||
PFNGLUNIFORMMATRIX4X3FVPROC pGlUniformMatrix4x3fv;
|
||||
PFNGLUNIFORMMATRIX4FVARBPROC pGlUniformMatrix4fvARB;
|
||||
PFNGLGETACTIVEUNIFORMARBPROC pGlGetActiveUniformARB;
|
||||
PFNGLGETACTIVEUNIFORMPROC pGlGetActiveUniform;
|
||||
@ -1943,6 +1955,36 @@ inline void COpenGLExtensionHandler::extGlUniformMatrix2fv(GLint loc, GLsizei co
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void COpenGLExtensionHandler::extGlUniformMatrix2x3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
|
||||
{
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
if (pGlUniformMatrix2x3fv)
|
||||
pGlUniformMatrix2x3fv(loc, count, transpose, v);
|
||||
else
|
||||
os::Printer::log("glUniformMatrix2x3fv not supported", ELL_ERROR);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void COpenGLExtensionHandler::extGlUniformMatrix2x4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
|
||||
{
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
if (pGlUniformMatrix2x4fv)
|
||||
pGlUniformMatrix2x4fv(loc, count, transpose, v);
|
||||
else
|
||||
os::Printer::log("glUniformMatrix2x4fv not supported", ELL_ERROR);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void COpenGLExtensionHandler::extGlUniformMatrix3x2fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
|
||||
{
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
if (pGlUniformMatrix3x2fv)
|
||||
pGlUniformMatrix3x2fv(loc, count, transpose, v);
|
||||
else
|
||||
os::Printer::log("glUniformMatrix3x2fv not supported", ELL_ERROR);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void COpenGLExtensionHandler::extGlUniformMatrix3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v)
|
||||
{
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
@ -1955,6 +1997,36 @@ inline void COpenGLExtensionHandler::extGlUniformMatrix3fv(GLint loc, GLsizei co
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void COpenGLExtensionHandler::extGlUniformMatrix3x4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
|
||||
{
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
if (pGlUniformMatrix3x4fv)
|
||||
pGlUniformMatrix3x4fv(loc, count, transpose, v);
|
||||
else
|
||||
os::Printer::log("glUniformMatrix3x4fv not supported", ELL_ERROR);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void COpenGLExtensionHandler::extGlUniformMatrix4x2fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
|
||||
{
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
if (pGlUniformMatrix4x2fv)
|
||||
pGlUniformMatrix4x2fv(loc, count, transpose, v);
|
||||
else
|
||||
os::Printer::log("glUniformMatrix4x2fv not supported", ELL_ERROR);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void COpenGLExtensionHandler::extGlUniformMatrix4x3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
|
||||
{
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
if (pGlUniformMatrix4x3fv)
|
||||
pGlUniformMatrix4x3fv(loc, count, transpose, v);
|
||||
else
|
||||
os::Printer::log("glUniformMatrix4x3fv not supported", ELL_ERROR);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void COpenGLExtensionHandler::extGlUniformMatrix4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v)
|
||||
{
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
|
@ -633,9 +633,27 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const f32* flo
|
||||
case GL_FLOAT_MAT2:
|
||||
Driver->extGlUniformMatrix2fv(UniformInfo[index].location, count/4, false, floats);
|
||||
break;
|
||||
case GL_FLOAT_MAT2x3:
|
||||
Driver->extGlUniformMatrix2x3fv(UniformInfo[index].location, count/6, false, floats);
|
||||
break;
|
||||
case GL_FLOAT_MAT2x4:
|
||||
Driver->extGlUniformMatrix2x4fv(UniformInfo[index].location, count/8, false, floats);
|
||||
break;
|
||||
case GL_FLOAT_MAT3x2:
|
||||
Driver->extGlUniformMatrix3x2fv(UniformInfo[index].location, count/6, false, floats);
|
||||
break;
|
||||
case GL_FLOAT_MAT3:
|
||||
Driver->extGlUniformMatrix3fv(UniformInfo[index].location, count/9, false, floats);
|
||||
break;
|
||||
case GL_FLOAT_MAT3x4:
|
||||
Driver->extGlUniformMatrix3x4fv(UniformInfo[index].location, count/12, false, floats);
|
||||
break;
|
||||
case GL_FLOAT_MAT4x2:
|
||||
Driver->extGlUniformMatrix4x2fv(UniformInfo[index].location, count/8, false, floats);
|
||||
break;
|
||||
case GL_FLOAT_MAT4x3:
|
||||
Driver->extGlUniformMatrix4x3fv(UniformInfo[index].location, count/12, false, floats);
|
||||
break;
|
||||
case GL_FLOAT_MAT4:
|
||||
Driver->extGlUniformMatrix4fv(UniformInfo[index].location, count/16, false, floats);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user