diff --git a/src/Magnum/GL/AbstractShaderProgram.cpp b/src/Magnum/GL/AbstractShaderProgram.cpp index 44ab50947..752c0b58b 100644 --- a/src/Magnum/GL/AbstractShaderProgram.cpp +++ b/src/Magnum/GL/AbstractShaderProgram.cpp @@ -427,12 +427,14 @@ void AbstractShaderProgram::dispatchCompute(const Vector3ui& workgroupCount) { } #endif -void AbstractShaderProgram::use() { +void AbstractShaderProgram::use(const GLuint id) { /* Use only if the program isn't already in use */ GLuint& current = Context::current().state().shaderProgram.current; - if(current != _id) glUseProgram(current = _id); + if(current != id) glUseProgram(current = id); } +void AbstractShaderProgram::use() { use(_id); } + void AbstractShaderProgram::attachShader(Shader& shader) { glAttachShader(_id, shader.id()); } @@ -563,620 +565,316 @@ UnsignedInt AbstractShaderProgram::uniformBlockIndexInternal(const Containers::A #endif void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView values) { - (this->*Context::current().state().shaderProgram.uniform1fvImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniform1fvImplementation(_id, location, values.size(), values.data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLfloat* const values) { - use(); +void AbstractShaderProgram::uniform1fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLfloat* const values) { + use(id); glUniform1fv(location, count, values); } -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const GLfloat* const values) { - glProgramUniform1fv(_id, location, count, values); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const GLfloat* const values) { - glProgramUniform1fvEXT(_id, location, count, values); -} -#endif - void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform2fvImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniform2fvImplementation(_id, location, values.size(), values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLfloat>* const values) { - use(); - glUniform2fv(location, count, values[0].data()); +void AbstractShaderProgram::uniform2fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLfloat* const values) { + use(id); + glUniform2fv(location, count, values); } -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<2, GLfloat>* const values) { - glProgramUniform2fv(_id, location, count, values[0].data()); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::Vector<2, GLfloat>* const values) { - glProgramUniform2fvEXT(_id, location, count, values[0].data()); -} -#endif - void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform3fvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLfloat>* const values) { - use(); - glUniform3fv(location, count, values[0].data()); + Context::current().state().shaderProgram.uniform3fvImplementation(_id, location, values.size(), values.data()->data()); } -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<3, GLfloat>* const values) { - glProgramUniform3fv(_id, location, count, values[0].data()); +void AbstractShaderProgram::uniform3fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLfloat* const values) { + use(id); + glUniform3fv(location, count, values); } -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::Vector<3, GLfloat>* const values) { - glProgramUniform3fvEXT(_id, location, count, values[0].data()); -} -#endif void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform4fvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLfloat>* const values) { - use(); - glUniform4fv(location, count, values[0].data()); -} - -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<4, GLfloat>* const values) { - glProgramUniform4fv(_id, location, count, values[0].data()); + Context::current().state().shaderProgram.uniform4fvImplementation(_id, location, values.size(), values.data()->data()); } -#endif -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::Vector<4, GLfloat>* const values) { - glProgramUniform4fvEXT(_id, location, count, values[0].data()); +void AbstractShaderProgram::uniform4fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLfloat* const values) { + use(id); + glUniform4fv(location, count, values); } -#endif void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView values) { - (this->*Context::current().state().shaderProgram.uniform1ivImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniform1ivImplementation(_id, location, values.size(), values.data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLint* values) { - use(); +void AbstractShaderProgram::uniform1ivImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLint* values) { + use(id); glUniform1iv(location, count, values); } -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const GLint* const values) { - glProgramUniform1iv(_id, location, count, values); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const GLint* const values) { - glProgramUniform1ivEXT(_id, location, count, values); -} -#endif - void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform2ivImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLint>* const values) { - use(); - glUniform2iv(location, count, values[0].data()); -} - -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<2, GLint>* const values) { - glProgramUniform2iv(_id, location, count, values[0].data()); + Context::current().state().shaderProgram.uniform2ivImplementation(_id, location, values.size(), values.data()->data()); } -#endif -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::Vector<2, GLint>* const values) { - glProgramUniform2ivEXT(_id, location, count, values[0].data()); +void AbstractShaderProgram::uniform2ivImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLint* const values) { + use(id); + glUniform2iv(location, count, values); } -#endif void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform3ivImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniform3ivImplementation(_id, location, values.size(), values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLint>* const values) { - use(); - glUniform3iv(location, count, values[0].data()); +void AbstractShaderProgram::uniform3ivImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLint* const values) { + use(id); + glUniform3iv(location, count, values); } -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<3, GLint>* const values) { - glProgramUniform3iv(_id, location, count, values[0].data()); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::Vector<3, GLint>* const values) { - glProgramUniform3ivEXT(_id, location, count, values[0].data()); -} -#endif - void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform4ivImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniform4ivImplementation(_id, location, values.size(), values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLint>* const values) { - use(); - glUniform4iv(location, count, values[0].data()); +void AbstractShaderProgram::uniform4ivImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLint* const values) { + use(id); + glUniform4iv(location, count, values); } -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<4, GLint>* const values) { - glProgramUniform4iv(_id, location, count, values[0].data()); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::Vector<4, GLint>* const values) { - glProgramUniform4ivEXT(_id, location, count, values[0].data()); -} -#endif - #ifndef MAGNUM_TARGET_GLES2 void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView values) { - (this->*Context::current().state().shaderProgram.uniform1uivImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniform1uivImplementation(_id, location, values.size(), values.data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLuint* const values) { - use(); +void AbstractShaderProgram::uniform1uivImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLuint* const values) { + use(id); glUniform1uiv(location, count, values); } -#ifndef MAGNUM_TARGET_WEBGL -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const GLuint* const values) { - glProgramUniform1uiv(_id, location, count, values); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const GLuint* const values) { - glProgramUniform1uivEXT(_id, location, count, values); -} -#endif - void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform2uivImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniform2uivImplementation(_id, location, values.size(), values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLuint>* const values) { - use(); - glUniform2uiv(location, count, values[0].data()); +void AbstractShaderProgram::uniform2uivImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLuint* const values) { + use(id); + glUniform2uiv(location, count, values); } -#ifndef MAGNUM_TARGET_WEBGL -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<2, GLuint>* const values) { - glProgramUniform2uiv(_id, location, count, values[0].data()); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::Vector<2, GLuint>* const values) { - glProgramUniform2uivEXT(_id, location, count, values[0].data()); -} -#endif - void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform3uivImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLuint>* const values) { - use(); - glUniform3uiv(location, count, values[0].data()); + Context::current().state().shaderProgram.uniform3uivImplementation(_id, location, values.size(), values.data()->data()); } -#ifndef MAGNUM_TARGET_WEBGL -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<3, GLuint>* const values) { - glProgramUniform3uiv(_id, location, count, values[0].data()); +void AbstractShaderProgram::uniform3uivImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLuint* const values) { + use(id); + glUniform3uiv(location, count, values); } -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::Vector<3, GLuint>* const values) { - glProgramUniform3uivEXT(_id, location, count, values[0].data()); -} -#endif void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform4uivImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLuint>* const values) { - use(); - glUniform4uiv(location, count, values[0].data()); + Context::current().state().shaderProgram.uniform4uivImplementation(_id, location, values.size(), values.data()->data()); } -#ifndef MAGNUM_TARGET_WEBGL -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<4, GLuint>* const values) { - glProgramUniform4uiv(_id, location, count, values[0].data()); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::Vector<4, GLuint>* const values) { - glProgramUniform4uivEXT(_id, location, count, values[0].data()); +void AbstractShaderProgram::uniform4uivImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLuint* const values) { + use(id); + glUniform4uiv(location, count, values); } #endif -#endif #ifndef MAGNUM_TARGET_GLES void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView values) { - (this->*Context::current().state().shaderProgram.uniform1dvImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniform1dvImplementation(_id, location, values.size(), values.data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLdouble* const values) { - use(); +void AbstractShaderProgram::uniform1dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLdouble* const values) { + use(id); glUniform1dv(location, count, values); } -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const GLdouble* const values) { - glProgramUniform1dv(_id, location, count, values); -} - void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform2dvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLdouble>* const values) { - use(); - glUniform2dv(location, count, values[0].data()); + Context::current().state().shaderProgram.uniform2dvImplementation(_id, location, values.size(), values.data()->data()); } -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<2, GLdouble>* const values) { - glProgramUniform2dv(_id, location, count, values[0].data()); +void AbstractShaderProgram::uniform2dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLdouble* const values) { + use(id); + glUniform2dv(location, count, values); } void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform3dvImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniform3dvImplementation(_id, location, values.size(), values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLdouble>* const values) { - use(); - glUniform3dv(location, count, values[0].data()); -} - -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<3, GLdouble>* const values) { - glProgramUniform3dv(_id, location, count, values[0].data()); +void AbstractShaderProgram::uniform3dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLdouble* const values) { + use(id); + glUniform3dv(location, count, values); } void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniform4dvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLdouble>* const values) { - use(); - glUniform4dv(location, count, values[0].data()); + Context::current().state().shaderProgram.uniform4dvImplementation(_id, location, values.size(), values.data()->data()); } -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<4, GLdouble>* const values) { - glProgramUniform4dv(_id, location, count, values[0].data()); +void AbstractShaderProgram::uniform4dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLdouble* const values) { + use(id); + glUniform4dv(location, count, values); } #endif void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix2fvImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniformMatrix2fvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 2, GLfloat>* const values) { - use(); - glUniformMatrix2fv(location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix2fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLfloat* const values) { + use(id); + glUniformMatrix2fv(location, count, transpose, values); } -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 2, GLfloat>* const values) { - glProgramUniformMatrix2fv(_id, location, count, GL_FALSE, values[0].data()); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 2, GLfloat>* const values) { - glProgramUniformMatrix2fvEXT(_id, location, count, GL_FALSE, values[0].data()); -} -#endif - void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix3fvImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniformMatrix3fvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 3, GLfloat>* const values) { - use(); - glUniformMatrix3fv(location, count, GL_FALSE, values[0].data()); -} - -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 3, GLfloat>* const values) { - glProgramUniformMatrix3fv(_id, location, count, GL_FALSE, values[0].data()); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 3, GLfloat>* const values) { - glProgramUniformMatrix3fvEXT(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix3fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLfloat* const values) { + use(id); + glUniformMatrix3fv(location, count, transpose, values); } -#endif void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix4fvImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniformMatrix4fvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 4, GLfloat>* const values) { - use(); - glUniformMatrix4fv(location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix4fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLfloat* const values) { + use(id); + glUniformMatrix4fv(location, count, transpose, values); } -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 4, GLfloat>* const values) { - glProgramUniformMatrix4fv(_id, location, count, GL_FALSE, values[0].data()); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 4, GLfloat>* const values) { - glProgramUniformMatrix4fvEXT(_id, location, count, GL_FALSE, values[0].data()); -} -#endif - #ifndef MAGNUM_TARGET_GLES2 void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix2x3fvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 3, GLfloat>* const values) { - use(); - glUniformMatrix2x3fv(location, count, GL_FALSE, values[0].data()); + Context::current().state().shaderProgram.uniformMatrix2x3fvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -#ifndef MAGNUM_TARGET_WEBGL -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 3, GLfloat>* const values) { - glProgramUniformMatrix2x3fv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix2x3fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLfloat* const values) { + use(id); + glUniformMatrix2x3fv(location, count, transpose, values); } -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 3, GLfloat>* const values) { - glProgramUniformMatrix2x3fvEXT(_id, location, count, GL_FALSE, values[0].data()); -} -#endif void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix3x2fvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 2, GLfloat>* const values) { - use(); - glUniformMatrix3x2fv(location, count, GL_FALSE, values[0].data()); + Context::current().state().shaderProgram.uniformMatrix3x2fvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -#ifndef MAGNUM_TARGET_WEBGL -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 2, GLfloat>* const values) { - glProgramUniformMatrix3x2fv(_id, location, count, GL_FALSE, values[0].data()); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 2, GLfloat>* const values) { - glProgramUniformMatrix3x2fvEXT(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix3x2fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLfloat* const values) { + use(id); + glUniformMatrix3x2fv(location, count, transpose, values); } -#endif void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix2x4fvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 4, GLfloat>* const values) { - use(); - glUniformMatrix2x4fv(location, count, GL_FALSE, values[0].data()); -} - -#ifndef MAGNUM_TARGET_WEBGL -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 4, GLfloat>* const values) { - glProgramUniformMatrix2x4fv(_id, location, count, GL_FALSE, values[0].data()); + Context::current().state().shaderProgram.uniformMatrix2x4fvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -#endif -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 4, GLfloat>* const values) { - glProgramUniformMatrix2x4fvEXT(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix2x4fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLfloat* const values) { + use(id); + glUniformMatrix2x4fv(location, count, transpose, values); } -#endif void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix4x2fvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 2, GLfloat>* const values) { - use(); - glUniformMatrix4x2fv(location, count, GL_FALSE, values[0].data()); + Context::current().state().shaderProgram.uniformMatrix4x2fvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -#ifndef MAGNUM_TARGET_WEBGL -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 2, GLfloat>* const values) { - glProgramUniformMatrix4x2fv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix4x2fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLfloat* const values) { + use(id); + glUniformMatrix4x2fv(location, count, transpose, values); } -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 2, GLfloat>* const values) { - glProgramUniformMatrix4x2fvEXT(_id, location, count, GL_FALSE, values[0].data()); -} -#endif void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix3x4fvImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniformMatrix3x4fvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 4, GLfloat>* const values) { - use(); - glUniformMatrix3x4fv(location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix3x4fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLfloat* const values) { + use(id); + glUniformMatrix3x4fv(location, count, transpose, values); } -#ifndef MAGNUM_TARGET_WEBGL -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 4, GLfloat>* const values) { - glProgramUniformMatrix3x4fv(_id, location, count, GL_FALSE, values[0].data()); -} -#endif - -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 4, GLfloat>* const values) { - glProgramUniformMatrix3x4fvEXT(_id, location, count, GL_FALSE, values[0].data()); -} -#endif - void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix4x3fvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 3, GLfloat>* const values) { - use(); - glUniformMatrix4x3fv(location, count, GL_FALSE, values[0].data()); + Context::current().state().shaderProgram.uniformMatrix4x3fvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -#ifndef MAGNUM_TARGET_WEBGL -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 3, GLfloat>* const values) { - glProgramUniformMatrix4x3fv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix4x3fvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLfloat* const values) { + use(id); + glUniformMatrix4x3fv(location, count, transpose, values); } #endif -#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractShaderProgram::uniformImplementationSSOEXT(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 3, GLfloat>* const values) { - glProgramUniformMatrix4x3fvEXT(_id, location, count, GL_FALSE, values[0].data()); -} -#endif -#endif - #ifndef MAGNUM_TARGET_GLES void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix2dvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 2, GLdouble>* const values) { - use(); - glUniformMatrix2dv(location, count, GL_FALSE, values[0].data()); + Context::current().state().shaderProgram.uniformMatrix2dvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 2, GLdouble>* const values) { - glProgramUniformMatrix2dv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix2dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLdouble* const values) { + use(id); + glUniformMatrix2dv(location, count, transpose, values); } void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix3dvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 3, GLdouble>* const values) { - use(); - glUniformMatrix3dv(location, count, GL_FALSE, values[0].data()); + Context::current().state().shaderProgram.uniformMatrix3dvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 3, GLdouble>* const values) { - glProgramUniformMatrix3dv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix3dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLdouble* const values) { + use(id); + glUniformMatrix3dv(location, count, transpose, values); } void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix4dvImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniformMatrix4dvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 4, GLdouble>* const values) { - use(); - glUniformMatrix4dv(location, count, GL_FALSE, values[0].data()); -} - -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 4, GLdouble>* const values) { - glProgramUniformMatrix4dv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix4dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLdouble* const values) { + use(id); + glUniformMatrix4dv(location, count, transpose, values); } void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix2x3dvImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniformMatrix2x3dvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 3, GLdouble>* const values) { - use(); - glUniformMatrix2x3dv(location, count, GL_FALSE, values[0].data()); -} - -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 3, GLdouble>* const values) { - glProgramUniformMatrix2x3dv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix2x3dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLdouble* const values) { + use(id); + glUniformMatrix2x3dv(location, count, transpose, values); } void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix3x2dvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 2, GLdouble>* const values) { - use(); - glUniformMatrix3x2dv(location, count, GL_FALSE, values[0].data()); + Context::current().state().shaderProgram.uniformMatrix3x2dvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 2, GLdouble>* const values) { - glProgramUniformMatrix3x2dv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix3x2dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLdouble* const values) { + use(id); + glUniformMatrix3x2dv(location, count, transpose, values); } void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix2x4dvImplementation)(location, values.size(), values); + Context::current().state().shaderProgram.uniformMatrix2x4dvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 4, GLdouble>* const values) { - use(); - glUniformMatrix2x4dv(location, count, GL_FALSE, values[0].data()); -} - -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 4, GLdouble>* const values) { - glProgramUniformMatrix2x4dv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix2x4dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLdouble* const values) { + use(id); + glUniformMatrix2x4dv(location, count, transpose, values); } void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix4x2dvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 2, GLdouble>* const values) { - use(); - glUniformMatrix4x2dv(location, count, GL_FALSE, values[0].data()); + Context::current().state().shaderProgram.uniformMatrix4x2dvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 2, GLdouble>* const values) { - glProgramUniformMatrix4x2dv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix4x2dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLdouble* const values) { + use(id); + glUniformMatrix4x2dv(location, count, transpose, values); } void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix3x4dvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 4, GLdouble>* const values) { - use(); - glUniformMatrix3x4dv(location, count, GL_FALSE, values[0].data()); + Context::current().state().shaderProgram.uniformMatrix3x4dvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 4, GLdouble>* const values) { - glProgramUniformMatrix3x4dv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix3x4dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLdouble* const values) { + use(id); + glUniformMatrix3x4dv(location, count, transpose, values); } void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView> values) { - (this->*Context::current().state().shaderProgram.uniformMatrix4x3dvImplementation)(location, values.size(), values); -} - -void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 3, GLdouble>* const values) { - use(); - glUniformMatrix4x3dv(location, count, GL_FALSE, values[0].data()); + Context::current().state().shaderProgram.uniformMatrix4x3dvImplementation(_id, location, values.size(), GL_FALSE, values.data()->data()); } -void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 3, GLdouble>* const values) { - glProgramUniformMatrix4x3dv(_id, location, count, GL_FALSE, values[0].data()); +void AbstractShaderProgram::uniformMatrix4x3dvImplementationDefault(const GLuint id, const GLint location, const GLsizei count, const GLboolean transpose, const GLdouble* const values) { + use(id); + glUniformMatrix4x3dv(location, count, transpose, values); } #endif diff --git a/src/Magnum/GL/AbstractShaderProgram.h b/src/Magnum/GL/AbstractShaderProgram.h index 07cb01f77..9f17ffdf7 100644 --- a/src/Magnum/GL/AbstractShaderProgram.h +++ b/src/Magnum/GL/AbstractShaderProgram.h @@ -1361,139 +1361,56 @@ class MAGNUM_GL_EXPORT AbstractShaderProgram: public AbstractObject { static MAGNUM_GL_LOCAL void cleanLogImplementationAngle(std::string& message); #endif + MAGNUM_GL_LOCAL static void use(GLuint id); void use(); - /* - Currently, there are three supported ways to call glProgramUniform(): - - - EXT_separate_shader_objects (OpenGL ES extension, EXT suffix) - - ARB_separate_shader_objects (desktop GL only, no suffix) - - OpenGL ES 3.1, no suffix - - To avoid copypasta and filesize bloat, this is merged to just two - variants of implementation functions: - - - uniformImplementationSSO() -- functions without suffix, used if - ARB_separate_shader_objects desktop extension or OpenGL ES 3.1 - is available, completely disabled for ES2 - - uniformImplementationSSOEXT() -- functions with EXT suffix, used - if EXT_separate_shader_objects ES 2.0 / ES 3.0 extension is - available - */ - - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const GLfloat* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<3, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<4, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const GLint* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<2, GLint>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<3, GLint>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<4, GLint>* values); + /* To avoid pointless extra function pointer indirections and copypaste + for all suffixed/unsuffixed variants, these are all static with a + signature matching the DSA APIs. On DSA-enabled platforms the + glProgramUniform*() functions are used directly, otherwise these all + use() the shader first and then call the old-style API. */ + MAGNUM_GL_LOCAL static void uniform1fvImplementationDefault(GLuint id, GLint location, GLsizei count, const GLfloat* values); + MAGNUM_GL_LOCAL static void uniform2fvImplementationDefault(GLuint id, GLint location, GLsizei count, const GLfloat* values); + MAGNUM_GL_LOCAL static void uniform3fvImplementationDefault(GLuint id, GLint location, GLsizei count, const GLfloat* values); + MAGNUM_GL_LOCAL static void uniform4fvImplementationDefault(GLuint id, GLint location, GLsizei count, const GLfloat* values); + MAGNUM_GL_LOCAL static void uniform1ivImplementationDefault(GLuint id, GLint location, GLsizei count, const GLint* values); + MAGNUM_GL_LOCAL static void uniform2ivImplementationDefault(GLuint id, GLint location, GLsizei count, const GLint* values); + MAGNUM_GL_LOCAL static void uniform3ivImplementationDefault(GLuint id, GLint location, GLsizei count, const GLint* values); + MAGNUM_GL_LOCAL static void uniform4ivImplementationDefault(GLuint id, GLint location, GLsizei count, const GLint* values); #ifndef MAGNUM_TARGET_GLES2 - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const GLuint* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<2, GLuint>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<3, GLuint>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<4, GLuint>* values); + MAGNUM_GL_LOCAL static void uniform1uivImplementationDefault(GLuint id, GLint location, GLsizei count, const GLuint* values); + MAGNUM_GL_LOCAL static void uniform2uivImplementationDefault(GLuint id, GLint location, GLsizei count, const GLuint* values); + MAGNUM_GL_LOCAL static void uniform3uivImplementationDefault(GLuint id, GLint location, GLsizei count, const GLuint* values); + MAGNUM_GL_LOCAL static void uniform4uivImplementationDefault(GLuint id, GLint location, GLsizei count, const GLuint* values); #endif #ifndef MAGNUM_TARGET_GLES - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const GLdouble* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<2, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<3, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<4, GLdouble>* values); - #endif - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const GLfloat* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<3, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<4, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const GLint* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<2, GLint>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<3, GLint>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<4, GLint>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const GLuint* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<2, GLuint>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<3, GLuint>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<4, GLuint>* values); - #endif - #ifndef MAGNUM_TARGET_GLES - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const GLdouble* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<2, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<3, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::Vector<4, GLdouble>* values); - #endif - #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const GLfloat* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::Vector<2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::Vector<3, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::Vector<4, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const GLint* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::Vector<2, GLint>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::Vector<3, GLint>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::Vector<4, GLint>* values); - #ifndef MAGNUM_TARGET_GLES2 - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const GLuint* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::Vector<2, GLuint>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::Vector<3, GLuint>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::Vector<4, GLuint>* values); - #endif + MAGNUM_GL_LOCAL static void uniform1dvImplementationDefault(GLuint id, GLint location, GLsizei count, const GLdouble* values); + MAGNUM_GL_LOCAL static void uniform2dvImplementationDefault(GLuint id, GLint location, GLsizei count, const GLdouble* values); + MAGNUM_GL_LOCAL static void uniform3dvImplementationDefault(GLuint id, GLint location, GLsizei count, const GLdouble* values); + MAGNUM_GL_LOCAL static void uniform4dvImplementationDefault(GLuint id, GLint location, GLsizei count, const GLdouble* values); #endif - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<2, 2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<3, 3, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<4, 4, GLfloat>* values); + MAGNUM_GL_LOCAL static void uniformMatrix2fvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* values); + MAGNUM_GL_LOCAL static void uniformMatrix3fvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* values); + MAGNUM_GL_LOCAL static void uniformMatrix4fvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* values); #ifndef MAGNUM_TARGET_GLES2 - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<2, 3, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<3, 2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<2, 4, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<4, 2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<3, 4, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<4, 3, GLfloat>* values); + MAGNUM_GL_LOCAL static void uniformMatrix2x3fvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* values); + MAGNUM_GL_LOCAL static void uniformMatrix3x2fvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* values); + MAGNUM_GL_LOCAL static void uniformMatrix2x4fvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* values); + MAGNUM_GL_LOCAL static void uniformMatrix4x2fvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* values); + MAGNUM_GL_LOCAL static void uniformMatrix3x4fvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* values); + MAGNUM_GL_LOCAL static void uniformMatrix4x3fvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* values); #endif #ifndef MAGNUM_TARGET_GLES - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<2, 2, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<3, 3, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<4, 4, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<2, 3, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<3, 2, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<2, 4, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<4, 2, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<3, 4, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<4, 3, GLdouble>* values); - #endif - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<2, 2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<3, 3, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<4, 4, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<2, 3, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<3, 2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<2, 4, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<4, 2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<3, 4, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<4, 3, GLfloat>* values); - #endif - #ifndef MAGNUM_TARGET_GLES - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<2, 2, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<3, 3, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<4, 4, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<2, 3, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<3, 2, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<2, 4, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<4, 2, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<3, 4, GLdouble>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSO(GLint location, GLsizei count, const Math::RectangularMatrix<4, 3, GLdouble>* values); - #endif - #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::RectangularMatrix<2, 2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::RectangularMatrix<3, 3, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::RectangularMatrix<4, 4, GLfloat>* values); - #ifndef MAGNUM_TARGET_GLES2 - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::RectangularMatrix<2, 3, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::RectangularMatrix<3, 2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::RectangularMatrix<2, 4, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::RectangularMatrix<4, 2, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::RectangularMatrix<3, 4, GLfloat>* values); - void MAGNUM_GL_LOCAL uniformImplementationSSOEXT(GLint location, GLsizei count, const Math::RectangularMatrix<4, 3, GLfloat>* values); - #endif + MAGNUM_GL_LOCAL static void uniformMatrix2dvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLdouble* values); + MAGNUM_GL_LOCAL static void uniformMatrix3dvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLdouble* values); + MAGNUM_GL_LOCAL static void uniformMatrix4dvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLdouble* values); + MAGNUM_GL_LOCAL static void uniformMatrix2x3dvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLdouble* values); + MAGNUM_GL_LOCAL static void uniformMatrix3x2dvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLdouble* values); + MAGNUM_GL_LOCAL static void uniformMatrix2x4dvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLdouble* values); + MAGNUM_GL_LOCAL static void uniformMatrix4x2dvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLdouble* values); + MAGNUM_GL_LOCAL static void uniformMatrix3x4dvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLdouble* values); + MAGNUM_GL_LOCAL static void uniformMatrix4x3dvImplementationDefault(GLuint id, GLint location, GLsizei count, GLboolean transpose, const GLdouble* values); #endif GLuint _id; diff --git a/src/Magnum/GL/Implementation/ShaderProgramState.cpp b/src/Magnum/GL/Implementation/ShaderProgramState.cpp index 141197fce..74ab8d6f0 100644 --- a/src/Magnum/GL/Implementation/ShaderProgramState.cpp +++ b/src/Magnum/GL/Implementation/ShaderProgramState.cpp @@ -90,44 +90,44 @@ ShaderProgramState::ShaderProgramState(Context& context, Containers::StaticArray Extensions::ARB::separate_shader_objects::string(); #endif - uniform1fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform2fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform3fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform4fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform1ivImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform2ivImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform3ivImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform4ivImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform1uivImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform2uivImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform3uivImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform4uivImplementation = &AbstractShaderProgram::uniformImplementationSSO; + uniform1fvImplementation = glProgramUniform1fv; + uniform2fvImplementation = glProgramUniform2fv; + uniform3fvImplementation = glProgramUniform3fv; + uniform4fvImplementation = glProgramUniform4fv; + uniform1ivImplementation = glProgramUniform1iv; + uniform2ivImplementation = glProgramUniform2iv; + uniform3ivImplementation = glProgramUniform3iv; + uniform4ivImplementation = glProgramUniform4iv; + uniform1uivImplementation = glProgramUniform1uiv; + uniform2uivImplementation = glProgramUniform2uiv; + uniform3uivImplementation = glProgramUniform3uiv; + uniform4uivImplementation = glProgramUniform4uiv; #ifndef MAGNUM_TARGET_GLES - uniform1dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform2dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform3dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniform4dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; + uniform1dvImplementation = glProgramUniform1dv; + uniform2dvImplementation = glProgramUniform2dv; + uniform3dvImplementation = glProgramUniform3dv; + uniform4dvImplementation = glProgramUniform4dv; #endif - uniformMatrix2fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix3fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix4fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix2x3fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix3x2fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix2x4fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix4x2fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix3x4fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix4x3fvImplementation = &AbstractShaderProgram::uniformImplementationSSO; + uniformMatrix2fvImplementation = glProgramUniformMatrix2fv; + uniformMatrix3fvImplementation = glProgramUniformMatrix3fv; + uniformMatrix4fvImplementation = glProgramUniformMatrix4fv; + uniformMatrix2x3fvImplementation = glProgramUniformMatrix2x3fv; + uniformMatrix3x2fvImplementation = glProgramUniformMatrix3x2fv; + uniformMatrix2x4fvImplementation = glProgramUniformMatrix2x4fv; + uniformMatrix4x2fvImplementation = glProgramUniformMatrix4x2fv; + uniformMatrix3x4fvImplementation = glProgramUniformMatrix3x4fv; + uniformMatrix4x3fvImplementation = glProgramUniformMatrix4x3fv; #ifndef MAGNUM_TARGET_GLES - uniformMatrix2dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix3dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix4dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix2x3dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix3x2dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix2x4dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix4x2dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix3x4dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; - uniformMatrix4x3dvImplementation = &AbstractShaderProgram::uniformImplementationSSO; + uniformMatrix2dvImplementation = glProgramUniformMatrix2dv; + uniformMatrix3dvImplementation = glProgramUniformMatrix3dv; + uniformMatrix4dvImplementation = glProgramUniformMatrix4dv; + uniformMatrix2x3dvImplementation = glProgramUniformMatrix2x3dv; + uniformMatrix3x2dvImplementation = glProgramUniformMatrix3x2dv; + uniformMatrix2x4dvImplementation = glProgramUniformMatrix2x4dv; + uniformMatrix4x2dvImplementation = glProgramUniformMatrix4x2dv; + uniformMatrix3x4dvImplementation = glProgramUniformMatrix3x4dv; + uniformMatrix4x3dvImplementation = glProgramUniformMatrix4x3dv; #endif } else #endif @@ -137,77 +137,77 @@ ShaderProgramState::ShaderProgramState(Context& context, Containers::StaticArray extensions[Extensions::EXT::separate_shader_objects::Index] = Extensions::EXT::separate_shader_objects::string(); - uniform1fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniform2fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniform3fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniform4fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniform1ivImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniform2ivImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniform3ivImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniform4ivImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; + uniform1fvImplementation = glProgramUniform1fvEXT; + uniform2fvImplementation = glProgramUniform2fvEXT; + uniform3fvImplementation = glProgramUniform3fvEXT; + uniform4fvImplementation = glProgramUniform4fvEXT; + uniform1ivImplementation = glProgramUniform1ivEXT; + uniform2ivImplementation = glProgramUniform2ivEXT; + uniform3ivImplementation = glProgramUniform3ivEXT; + uniform4ivImplementation = glProgramUniform4ivEXT; #ifndef MAGNUM_TARGET_GLES2 - uniform1uivImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniform2uivImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniform3uivImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniform4uivImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; + uniform1uivImplementation = glProgramUniform1uivEXT; + uniform2uivImplementation = glProgramUniform2uivEXT; + uniform3uivImplementation = glProgramUniform3uivEXT; + uniform4uivImplementation = glProgramUniform4uivEXT; #endif - uniformMatrix2fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniformMatrix3fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniformMatrix4fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; + uniformMatrix2fvImplementation = glProgramUniformMatrix2fvEXT; + uniformMatrix3fvImplementation = glProgramUniformMatrix3fvEXT; + uniformMatrix4fvImplementation = glProgramUniformMatrix4fvEXT; #ifndef MAGNUM_TARGET_GLES2 - uniformMatrix2x3fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniformMatrix3x2fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniformMatrix2x4fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniformMatrix4x2fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniformMatrix3x4fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; - uniformMatrix4x3fvImplementation = &AbstractShaderProgram::uniformImplementationSSOEXT; + uniformMatrix2x3fvImplementation = glProgramUniformMatrix2x3fvEXT; + uniformMatrix3x2fvImplementation = glProgramUniformMatrix3x2fvEXT; + uniformMatrix2x4fvImplementation = glProgramUniformMatrix2x4fvEXT; + uniformMatrix4x2fvImplementation = glProgramUniformMatrix4x2fvEXT; + uniformMatrix3x4fvImplementation = glProgramUniformMatrix3x4fvEXT; + uniformMatrix4x3fvImplementation = glProgramUniformMatrix4x3fvEXT; #endif } else #endif { - uniform1fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform4fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform1ivImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform2ivImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform3ivImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform4ivImplementation = &AbstractShaderProgram::uniformImplementationDefault; + uniform1fvImplementation = &AbstractShaderProgram::uniform1fvImplementationDefault; + uniform2fvImplementation = &AbstractShaderProgram::uniform2fvImplementationDefault; + uniform3fvImplementation = &AbstractShaderProgram::uniform3fvImplementationDefault; + uniform4fvImplementation = &AbstractShaderProgram::uniform4fvImplementationDefault; + uniform1ivImplementation = &AbstractShaderProgram::uniform1ivImplementationDefault; + uniform2ivImplementation = &AbstractShaderProgram::uniform2ivImplementationDefault; + uniform3ivImplementation = &AbstractShaderProgram::uniform3ivImplementationDefault; + uniform4ivImplementation = &AbstractShaderProgram::uniform4ivImplementationDefault; #ifndef MAGNUM_TARGET_GLES2 - uniform1uivImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform2uivImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform3uivImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform4uivImplementation = &AbstractShaderProgram::uniformImplementationDefault; + uniform1uivImplementation = &AbstractShaderProgram::uniform1uivImplementationDefault; + uniform2uivImplementation = &AbstractShaderProgram::uniform2uivImplementationDefault; + uniform3uivImplementation = &AbstractShaderProgram::uniform3uivImplementationDefault; + uniform4uivImplementation = &AbstractShaderProgram::uniform4uivImplementationDefault; #endif #ifndef MAGNUM_TARGET_GLES - uniform1dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform2dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform3dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniform4dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; + uniform1dvImplementation = &AbstractShaderProgram::uniform1dvImplementationDefault; + uniform2dvImplementation = &AbstractShaderProgram::uniform2dvImplementationDefault; + uniform3dvImplementation = &AbstractShaderProgram::uniform3dvImplementationDefault; + uniform4dvImplementation = &AbstractShaderProgram::uniform4dvImplementationDefault; #endif - uniformMatrix2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix4fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; + uniformMatrix2fvImplementation = &AbstractShaderProgram::uniformMatrix2fvImplementationDefault; + uniformMatrix3fvImplementation = &AbstractShaderProgram::uniformMatrix3fvImplementationDefault; + uniformMatrix4fvImplementation = &AbstractShaderProgram::uniformMatrix4fvImplementationDefault; #ifndef MAGNUM_TARGET_GLES2 - uniformMatrix2x3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix3x2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix2x4fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix4x2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix3x4fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix4x3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault; + uniformMatrix2x3fvImplementation = &AbstractShaderProgram::uniformMatrix2x3fvImplementationDefault; + uniformMatrix3x2fvImplementation = &AbstractShaderProgram::uniformMatrix3x2fvImplementationDefault; + uniformMatrix2x4fvImplementation = &AbstractShaderProgram::uniformMatrix2x4fvImplementationDefault; + uniformMatrix4x2fvImplementation = &AbstractShaderProgram::uniformMatrix4x2fvImplementationDefault; + uniformMatrix3x4fvImplementation = &AbstractShaderProgram::uniformMatrix3x4fvImplementationDefault; + uniformMatrix4x3fvImplementation = &AbstractShaderProgram::uniformMatrix4x3fvImplementationDefault; #endif #ifndef MAGNUM_TARGET_GLES - uniformMatrix2dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix3dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix4dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix2x3dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix3x2dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix2x4dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix4x2dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix3x4dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; - uniformMatrix4x3dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; + uniformMatrix2dvImplementation = &AbstractShaderProgram::uniformMatrix2dvImplementationDefault; + uniformMatrix3dvImplementation = &AbstractShaderProgram::uniformMatrix3dvImplementationDefault; + uniformMatrix4dvImplementation = &AbstractShaderProgram::uniformMatrix4dvImplementationDefault; + uniformMatrix2x3dvImplementation = &AbstractShaderProgram::uniformMatrix2x3dvImplementationDefault; + uniformMatrix3x2dvImplementation = &AbstractShaderProgram::uniformMatrix3x2dvImplementationDefault; + uniformMatrix2x4dvImplementation = &AbstractShaderProgram::uniformMatrix2x4dvImplementationDefault; + uniformMatrix4x2dvImplementation = &AbstractShaderProgram::uniformMatrix4x2dvImplementationDefault; + uniformMatrix3x4dvImplementation = &AbstractShaderProgram::uniformMatrix3x4dvImplementationDefault; + uniformMatrix4x3dvImplementation = &AbstractShaderProgram::uniformMatrix4x3dvImplementationDefault; #endif } diff --git a/src/Magnum/GL/Implementation/ShaderProgramState.h b/src/Magnum/GL/Implementation/ShaderProgramState.h index 92f68c5c7..5784b511d 100644 --- a/src/Magnum/GL/Implementation/ShaderProgramState.h +++ b/src/Magnum/GL/Implementation/ShaderProgramState.h @@ -48,48 +48,48 @@ struct ShaderProgramState { #endif void(*cleanLogImplementation)(std::string&); - void(AbstractShaderProgram::*uniform1fvImplementation)(GLint, GLsizei, const GLfloat*); - void(AbstractShaderProgram::*uniform2fvImplementation)(GLint, GLsizei, const Math::Vector<2, GLfloat>*); - void(AbstractShaderProgram::*uniform3fvImplementation)(GLint, GLsizei, const Math::Vector<3, GLfloat>*); - void(AbstractShaderProgram::*uniform4fvImplementation)(GLint, GLsizei, const Math::Vector<4, GLfloat>*); - void(AbstractShaderProgram::*uniform1ivImplementation)(GLint, GLsizei, const GLint*); - void(AbstractShaderProgram::*uniform2ivImplementation)(GLint, GLsizei, const Math::Vector<2, GLint>*); - void(AbstractShaderProgram::*uniform3ivImplementation)(GLint, GLsizei, const Math::Vector<3, GLint>*); - void(AbstractShaderProgram::*uniform4ivImplementation)(GLint, GLsizei, const Math::Vector<4, GLint>*); + void(*uniform1fvImplementation)(GLuint, GLint, GLsizei, const GLfloat*); + void(*uniform2fvImplementation)(GLuint, GLint, GLsizei, const GLfloat*); + void(*uniform3fvImplementation)(GLuint, GLint, GLsizei, const GLfloat*); + void(*uniform4fvImplementation)(GLuint, GLint, GLsizei, const GLfloat*); + void(*uniform1ivImplementation)(GLuint, GLint, GLsizei, const GLint*); + void(*uniform2ivImplementation)(GLuint, GLint, GLsizei, const GLint*); + void(*uniform3ivImplementation)(GLuint, GLint, GLsizei, const GLint*); + void(*uniform4ivImplementation)(GLuint, GLint, GLsizei, const GLint*); #ifndef MAGNUM_TARGET_GLES2 - void(AbstractShaderProgram::*uniform1uivImplementation)(GLint, GLsizei, const GLuint*); - void(AbstractShaderProgram::*uniform2uivImplementation)(GLint, GLsizei, const Math::Vector<2, GLuint>*); - void(AbstractShaderProgram::*uniform3uivImplementation)(GLint, GLsizei, const Math::Vector<3, GLuint>*); - void(AbstractShaderProgram::*uniform4uivImplementation)(GLint, GLsizei, const Math::Vector<4, GLuint>*); + void(*uniform1uivImplementation)(GLuint, GLint, GLsizei, const GLuint*); + void(*uniform2uivImplementation)(GLuint, GLint, GLsizei, const GLuint*); + void(*uniform3uivImplementation)(GLuint, GLint, GLsizei, const GLuint*); + void(*uniform4uivImplementation)(GLuint, GLint, GLsizei, const GLuint*); #endif #ifndef MAGNUM_TARGET_GLES - void(AbstractShaderProgram::*uniform1dvImplementation)(GLint, GLsizei, const GLdouble*); - void(AbstractShaderProgram::*uniform2dvImplementation)(GLint, GLsizei, const Math::Vector<2, GLdouble>*); - void(AbstractShaderProgram::*uniform3dvImplementation)(GLint, GLsizei, const Math::Vector<3, GLdouble>*); - void(AbstractShaderProgram::*uniform4dvImplementation)(GLint, GLsizei, const Math::Vector<4, GLdouble>*); + void(*uniform1dvImplementation)(GLuint, GLint, GLsizei, const GLdouble*); + void(*uniform2dvImplementation)(GLuint, GLint, GLsizei, const GLdouble*); + void(*uniform3dvImplementation)(GLuint, GLint, GLsizei, const GLdouble*); + void(*uniform4dvImplementation)(GLuint, GLint, GLsizei, const GLdouble*); #endif - void(AbstractShaderProgram::*uniformMatrix2fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 2, GLfloat>*); - void(AbstractShaderProgram::*uniformMatrix3fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 3, GLfloat>*); - void(AbstractShaderProgram::*uniformMatrix4fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 4, GLfloat>*); + void(*uniformMatrix2fvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLfloat*); + void(*uniformMatrix3fvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLfloat*); + void(*uniformMatrix4fvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLfloat*); #ifndef MAGNUM_TARGET_GLES2 - void(AbstractShaderProgram::*uniformMatrix2x3fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 3, GLfloat>*); - void(AbstractShaderProgram::*uniformMatrix3x2fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 2, GLfloat>*); - void(AbstractShaderProgram::*uniformMatrix2x4fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 4, GLfloat>*); - void(AbstractShaderProgram::*uniformMatrix4x2fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 2, GLfloat>*); - void(AbstractShaderProgram::*uniformMatrix3x4fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 4, GLfloat>*); - void(AbstractShaderProgram::*uniformMatrix4x3fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 3, GLfloat>*); + void(*uniformMatrix2x3fvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLfloat*); + void(*uniformMatrix3x2fvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLfloat*); + void(*uniformMatrix2x4fvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLfloat*); + void(*uniformMatrix4x2fvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLfloat*); + void(*uniformMatrix3x4fvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLfloat*); + void(*uniformMatrix4x3fvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLfloat*); #endif #ifndef MAGNUM_TARGET_GLES - void(AbstractShaderProgram::*uniformMatrix2dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 2, GLdouble>*); - void(AbstractShaderProgram::*uniformMatrix3dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 3, GLdouble>*); - void(AbstractShaderProgram::*uniformMatrix4dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 4, GLdouble>*); - void(AbstractShaderProgram::*uniformMatrix2x3dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 3, GLdouble>*); - void(AbstractShaderProgram::*uniformMatrix3x2dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 2, GLdouble>*); - void(AbstractShaderProgram::*uniformMatrix2x4dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 4, GLdouble>*); - void(AbstractShaderProgram::*uniformMatrix4x2dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 2, GLdouble>*); - void(AbstractShaderProgram::*uniformMatrix3x4dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 4, GLdouble>*); - void(AbstractShaderProgram::*uniformMatrix4x3dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 3, GLdouble>*); + void(*uniformMatrix2dvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLdouble*); + void(*uniformMatrix3dvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLdouble*); + void(*uniformMatrix4dvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLdouble*); + void(*uniformMatrix2x3dvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLdouble*); + void(*uniformMatrix3x2dvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLdouble*); + void(*uniformMatrix2x4dvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLdouble*); + void(*uniformMatrix4x2dvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLdouble*); + void(*uniformMatrix3x4dvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLdouble*); + void(*uniformMatrix4x3dvImplementation)(GLuint, GLint, GLsizei, GLboolean, const GLdouble*); #endif /* Currently used program */