Browse Source

Moved global data from shader classes to per-context state.

pull/51/head
Vladimír Vondruš 12 years ago
parent
commit
8cdefa1e0b
  1. 224
      src/Magnum/AbstractShaderProgram.cpp
  2. 350
      src/Magnum/AbstractShaderProgram.h
  3. 1
      src/Magnum/CMakeLists.txt
  4. 1
      src/Magnum/Context.cpp
  5. 139
      src/Magnum/Implementation/ShaderProgramState.cpp
  6. 57
      src/Magnum/Implementation/ShaderProgramState.h
  7. 2
      src/Magnum/Implementation/State.cpp

224
src/Magnum/AbstractShaderProgram.cpp

@ -36,50 +36,6 @@
namespace Magnum {
AbstractShaderProgram::Uniform1fvImplementation AbstractShaderProgram::uniform1fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform2fvImplementation AbstractShaderProgram::uniform2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform3fvImplementation AbstractShaderProgram::uniform3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform4fvImplementation AbstractShaderProgram::uniform4fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform1ivImplementation AbstractShaderProgram::uniform1ivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform2ivImplementation AbstractShaderProgram::uniform2ivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform3ivImplementation AbstractShaderProgram::uniform3ivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform4ivImplementation AbstractShaderProgram::uniform4ivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
#ifndef MAGNUM_TARGET_GLES2
AbstractShaderProgram::Uniform1uivImplementation AbstractShaderProgram::uniform1uivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform2uivImplementation AbstractShaderProgram::uniform2uivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform3uivImplementation AbstractShaderProgram::uniform3uivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform4uivImplementation AbstractShaderProgram::uniform4uivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
#endif
#ifndef MAGNUM_TARGET_GLES
AbstractShaderProgram::Uniform1dvImplementation AbstractShaderProgram::uniform1dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform2dvImplementation AbstractShaderProgram::uniform2dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform3dvImplementation AbstractShaderProgram::uniform3dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform4dvImplementation AbstractShaderProgram::uniform4dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
#endif
AbstractShaderProgram::UniformMatrix2fvImplementation AbstractShaderProgram::uniformMatrix2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix3fvImplementation AbstractShaderProgram::uniformMatrix3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix4fvImplementation AbstractShaderProgram::uniformMatrix4fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
#ifndef MAGNUM_TARGET_GLES2
AbstractShaderProgram::UniformMatrix2x3fvImplementation AbstractShaderProgram::uniformMatrix2x3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix3x2fvImplementation AbstractShaderProgram::uniformMatrix3x2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix2x4fvImplementation AbstractShaderProgram::uniformMatrix2x4fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix4x2fvImplementation AbstractShaderProgram::uniformMatrix4x2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix3x4fvImplementation AbstractShaderProgram::uniformMatrix3x4fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix4x3fvImplementation AbstractShaderProgram::uniformMatrix4x3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
#endif
#ifndef MAGNUM_TARGET_GLES
AbstractShaderProgram::UniformMatrix2dvImplementation AbstractShaderProgram::uniformMatrix2dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix3dvImplementation AbstractShaderProgram::uniformMatrix3dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix4dvImplementation AbstractShaderProgram::uniformMatrix4dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix2x3dvImplementation AbstractShaderProgram::uniformMatrix2x3dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix3x2dvImplementation AbstractShaderProgram::uniformMatrix3x2dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix2x4dvImplementation AbstractShaderProgram::uniformMatrix2x4dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix4x2dvImplementation AbstractShaderProgram::uniformMatrix4x2dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix3x4dvImplementation AbstractShaderProgram::uniformMatrix3x4dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::UniformMatrix4x3dvImplementation AbstractShaderProgram::uniformMatrix4x3dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
#endif
Int AbstractShaderProgram::maxVertexAttributes() {
GLint& value = Context::current()->state().shaderProgram->maxVertexAttributes;
@ -356,52 +312,8 @@ Int AbstractShaderProgram::uniformLocation(const std::string& name) {
return location;
}
void AbstractShaderProgram::initializeContextBasedFunctionality(Context& context) {
/** @todo OpenGL ES 2 has extension @es_extension{EXT,separate_shader_objects} for this */
#ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::GL::ARB::separate_shader_objects>() ||
context.isExtensionSupported<Extensions::GL::EXT::direct_state_access>()) {
Debug() << "AbstractShaderProgram: using" << (context.isExtensionSupported<Extensions::GL::ARB::separate_shader_objects>() ?
Extensions::GL::ARB::separate_shader_objects::string() : Extensions::GL::EXT::direct_state_access::string()) << "features";
uniform1fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform2fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform3fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform4fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform1ivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform2ivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform3ivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform4ivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform1uivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform2uivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform3uivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform4uivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform1dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform2dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform3dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform4dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2x3fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3x2fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2x4fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4x2fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3x4fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4x3fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2x3dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3x2dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2x4dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4x2dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3x4dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4x3dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
}
#else
static_cast<void>(context);
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Float* const values) {
(this->*Context::current()->state().shaderProgram->uniform1fvImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLfloat* const values) {
@ -415,6 +327,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<2, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniform2fvImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLfloat>* const values) {
use();
glUniform2fv(location, count, values[0].data());
@ -426,6 +342,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<3, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniform3fvImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLfloat>* const values) {
use();
glUniform3fv(location, count, values[0].data());
@ -437,6 +357,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<4, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniform4fvImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLfloat>* const values) {
use();
glUniform4fv(location, count, values[0].data());
@ -448,6 +372,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Int* const values) {
(this->*Context::current()->state().shaderProgram->uniform1ivImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLint* const values) {
use();
glUniform1iv(location, count, values);
@ -459,6 +387,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<2, Int>* const values) {
(this->*Context::current()->state().shaderProgram->uniform2ivImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLint>* const values) {
use();
glUniform2iv(location, count, values[0].data());
@ -470,6 +402,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<3, Int>* const values) {
(this->*Context::current()->state().shaderProgram->uniform3ivImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLint>* const values) {
use();
glUniform3iv(location, count, values[0].data());
@ -481,6 +417,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<4, Int>* const values) {
(this->*Context::current()->state().shaderProgram->uniform4ivImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLint>* const values) {
use();
glUniform4iv(location, count, values[0].data());
@ -493,6 +433,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
#endif
#ifndef MAGNUM_TARGET_GLES2
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const UnsignedInt* const values) {
(this->*Context::current()->state().shaderProgram->uniform1uivImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLuint* const values) {
use();
glUniform1uiv(location, count, values);
@ -504,6 +448,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<2, UnsignedInt>* const values) {
(this->*Context::current()->state().shaderProgram->uniform2uivImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLuint>* const values) {
use();
glUniform2uiv(location, count, values[0].data());
@ -515,6 +463,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<3, UnsignedInt>* const values) {
(this->*Context::current()->state().shaderProgram->uniform3uivImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLuint>* const values) {
use();
glUniform3uiv(location, count, values[0].data());
@ -526,6 +478,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<4, UnsignedInt>* const values) {
(this->*Context::current()->state().shaderProgram->uniform4uivImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLuint>* const values) {
use();
glUniform4uiv(location, count, values[0].data());
@ -539,6 +495,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
#endif
#ifndef MAGNUM_TARGET_GLES
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Double* const values) {
(this->*Context::current()->state().shaderProgram->uniform1dvImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLdouble* const values) {
use();
glUniform1dv(location, count, values);
@ -548,6 +508,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
glProgramUniform1dv(_id, location, count, values);
}
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<2, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniform2dvImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLdouble>* const values) {
use();
glUniform2dv(location, count, values[0].data());
@ -557,6 +521,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
glProgramUniform2dv(_id, location, count, values[0].data());
}
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<3, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniform3dvImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLdouble>* const values) {
use();
glUniform3dv(location, count, values[0].data());
@ -566,6 +534,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
glProgramUniform3dv(_id, location, count, values[0].data());
}
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::Vector<4, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniform4dvImplementation)(location, count, values);
}
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLdouble>* const values) {
use();
glUniform4dv(location, count, values[0].data());
@ -576,6 +548,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<2, 2, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2fvImplementation)(location, count, values);
}
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());
@ -587,6 +563,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<3, 3, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3fvImplementation)(location, count, values);
}
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());
@ -598,6 +578,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<4, 4, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4fvImplementation)(location, count, values);
}
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());
@ -610,6 +594,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
#endif
#ifndef MAGNUM_TARGET_GLES2
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<2, 3, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2x3fvImplementation)(location, count, 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());
@ -621,6 +609,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<3, 2, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3x2fvImplementation)(location, count, 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());
@ -632,6 +624,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<2, 4, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2x4fvImplementation)(location, count, 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());
@ -643,6 +639,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<4, 2, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4x2fvImplementation)(location, count, 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());
@ -654,6 +654,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<3, 4, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3x4fvImplementation)(location, count, values);
}
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());
@ -665,6 +669,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<4, 3, Float>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4x3fvImplementation)(location, count, 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());
@ -678,6 +686,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
#endif
#ifndef MAGNUM_TARGET_GLES
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<2, 2, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2dvImplementation)(location, count, 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());
@ -687,6 +699,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
glProgramUniformMatrix2dv(_id, location, count, GL_FALSE, values[0].data());
}
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<3, 3, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3dvImplementation)(location, count, 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());
@ -696,6 +712,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
glProgramUniformMatrix3dv(_id, location, count, GL_FALSE, values[0].data());
}
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<4, 4, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4dvImplementation)(location, count, values);
}
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());
@ -705,6 +725,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
glProgramUniformMatrix4dv(_id, location, count, GL_FALSE, values[0].data());
}
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<2, 3, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2x3dvImplementation)(location, count, values);
}
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());
@ -714,6 +738,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
glProgramUniformMatrix2x3dv(_id, location, count, GL_FALSE, values[0].data());
}
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<3, 2, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3x2dvImplementation)(location, count, 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());
@ -723,6 +751,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
glProgramUniformMatrix3x2dv(_id, location, count, GL_FALSE, values[0].data());
}
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<2, 4, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2x4dvImplementation)(location, count, values);
}
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());
@ -732,6 +764,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
glProgramUniformMatrix2x4dv(_id, location, count, GL_FALSE, values[0].data());
}
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<4, 2, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4x2dvImplementation)(location, count, 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());
@ -741,6 +777,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
glProgramUniformMatrix4x2dv(_id, location, count, GL_FALSE, values[0].data());
}
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<3, 4, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3x4dvImplementation)(location, count, 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());
@ -750,6 +790,10 @@ void AbstractShaderProgram::uniformImplementationDSA(const GLint location, const
glProgramUniformMatrix3x4dv(_id, location, count, GL_FALSE, values[0].data());
}
void AbstractShaderProgram::setUniform(const Int location, const UnsignedInt count, const Math::RectangularMatrix<4, 3, Double>* const values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4x3dvImplementation)(location, count, 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());

350
src/Magnum/AbstractShaderProgram.h

@ -39,6 +39,7 @@ namespace Magnum {
namespace Implementation {
template<class> struct Attribute;
class ShaderProgramState;
}
/**
@ -322,7 +323,7 @@ comes in handy.
@todo `GL_NUM_{PROGRAM,SHADER}_BINARY_FORMATS` + `GL_{PROGRAM,SHADER}_BINARY_FORMATS` (vector), (@extension{ARB,ES2_compatibility})
*/
class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
friend class Context;
friend class Implementation::ShaderProgramState;
public:
template<UnsignedInt, class> class Attribute;
@ -718,44 +719,16 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @see @ref setUniform(Int, const T&), @fn_gl{UseProgram}, @fn_gl{Uniform}
* or @fn_gl{ProgramUniform}/@fn_gl_extension{ProgramUniform,EXT,direct_state_access}.
*/
void setUniform(Int location, UnsignedInt count, const Float* values) {
(this->*uniform1fvImplementation)(location, count, values);
}
/** @copydoc setUniform(Int, UnsignedInt, const Float*) */
void setUniform(Int location, UnsignedInt count, const Math::Vector<2, Float>* values) {
(this->*uniform2fvImplementation)(location, count, values);
}
/** @copydoc setUniform(Int, UnsignedInt, const Float*) */
void setUniform(Int location, UnsignedInt count, const Math::Vector<3, Float>* values) {
(this->*uniform3fvImplementation)(location, count, values);
}
/** @copydoc setUniform(Int, UnsignedInt, const Float*) */
void setUniform(Int location, UnsignedInt count, const Math::Vector<4, Float>* values) {
(this->*uniform4fvImplementation)(location, count, values);
}
/** @copydoc setUniform(Int, UnsignedInt, const Float*) */
void setUniform(Int location, UnsignedInt count, const Int* values) {
(this->*uniform1ivImplementation)(location, count, values);
}
/** @copydoc setUniform(Int, UnsignedInt, const Float*) */
void setUniform(Int location, UnsignedInt count, const Math::Vector<2, Int>* values) {
(this->*uniform2ivImplementation)(location, count, values);
}
void setUniform(Int location, UnsignedInt count, const Float* values);
void setUniform(Int location, UnsignedInt count, const Math::Vector<2, Float>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::Vector<3, Float>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::Vector<4, Float>* values); /**< @overload */
/** @copydoc setUniform(Int, UnsignedInt, const Float*) */
void setUniform(Int location, UnsignedInt count, const Math::Vector<3, Int>* values) {
(this->*uniform3ivImplementation)(location, count, values);
}
/** @copydoc setUniform(Int, UnsignedInt, const Float*) */
void setUniform(Int location, UnsignedInt count, const Math::Vector<4, Int>* values) {
(this->*uniform4ivImplementation)(location, count, values);
}
void setUniform(Int location, UnsignedInt count, const Int* values);
void setUniform(Int location, UnsignedInt count, const Math::Vector<2, Int>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::Vector<3, Int>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::Vector<4, Int>* values); /**< @overload */
#ifndef MAGNUM_TARGET_GLES2
/**
@ -763,36 +736,10 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @requires_gl30 %Extension @extension{EXT,gpu_shader4}
* @requires_gles30 Only signed integers are available in OpenGL ES 2.0.
*/
void setUniform(Int location, UnsignedInt count, const UnsignedInt* values) {
(this->*uniform1uivImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl30 %Extension @extension{EXT,gpu_shader4}
* @requires_gles30 Only signed integers are available in OpenGL ES 2.0.
*/
void setUniform(Int location, UnsignedInt count, const Math::Vector<2, UnsignedInt>* values) {
(this->*uniform2uivImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl30 %Extension @extension{EXT,gpu_shader4}
* @requires_gles30 Only signed integers are available in OpenGL ES 2.0.
*/
void setUniform(Int location, UnsignedInt count, const Math::Vector<3, UnsignedInt>* values) {
(this->*uniform3uivImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl30 %Extension @extension{EXT,gpu_shader4}
* @requires_gles30 Only signed integers are available in OpenGL ES 2.0.
*/
void setUniform(Int location, UnsignedInt count, const Math::Vector<4, UnsignedInt>* values) {
(this->*uniform4uivImplementation)(location, count, values);
}
void setUniform(Int location, UnsignedInt count, const UnsignedInt* values);
void setUniform(Int location, UnsignedInt count, const Math::Vector<2, UnsignedInt>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::Vector<3, UnsignedInt>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::Vector<4, UnsignedInt>* values); /**< @overload */
#endif
#ifndef MAGNUM_TARGET_GLES
@ -801,101 +748,28 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Double* values) {
(this->*uniform1dvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::Vector<2, Double>* values) {
(this->*uniform2dvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::Vector<3, Double>* values) {
(this->*uniform3dvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::Vector<4, Double>* values) {
(this->*uniform4dvImplementation)(location, count, values);
}
void setUniform(Int location, UnsignedInt count, const Double* values);
void setUniform(Int location, UnsignedInt count, const Math::Vector<2, Double>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::Vector<3, Double>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::Vector<4, Double>* values); /**< @overload */
#endif
/** @copydoc setUniform(Int, UnsignedInt, const Float*) */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 2, Float>* values) {
(this->*uniformMatrix2fvImplementation)(location, count, values);
}
/** @copydoc setUniform(Int, UnsignedInt, const Float*) */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 3, Float>* values) {
(this->*uniformMatrix3fvImplementation)(location, count, values);
}
/** @copydoc setUniform(Int, UnsignedInt, const Float*) */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 4, Float>* values) {
(this->*uniformMatrix4fvImplementation)(location, count, values);
}
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 2, Float>* values);
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 3, Float>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 4, Float>* values); /**< @overload */
#ifndef MAGNUM_TARGET_GLES2
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 3, Float>* values) {
(this->*uniformMatrix2x3fvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 2, Float>* values) {
(this->*uniformMatrix3x2fvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 4, Float>* values) {
(this->*uniformMatrix2x4fvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 2, Float>* values) {
(this->*uniformMatrix4x2fvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 4, Float>* values) {
(this->*uniformMatrix3x4fvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 3, Float>* values) {
(this->*uniformMatrix4x3fvImplementation)(location, count, values);
}
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 3, Float>* values);
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 2, Float>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 4, Float>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 2, Float>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 4, Float>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 3, Float>* values); /**< @overload */
#endif
#ifndef MAGNUM_TARGET_GLES
@ -904,106 +778,18 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 2, Double>* values) {
(this->*uniformMatrix2dvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 3, Double>* values) {
(this->*uniformMatrix3dvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 4, Double>* values) {
(this->*uniformMatrix4dvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 3, Double>* values) {
(this->*uniformMatrix2x3dvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 2, Double>* values) {
(this->*uniformMatrix3x2dvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 4, Double>* values) {
(this->*uniformMatrix2x4dvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 2, Double>* values) {
(this->*uniformMatrix4x2dvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 4, Double>* values) {
(this->*uniformMatrix3x4dvImplementation)(location, count, values);
}
/**
* @copydoc setUniform(Int, UnsignedInt, const Float*)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES.
*/
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 3, Double>* values) {
(this->*uniformMatrix4x3dvImplementation)(location, count, values);
}
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 2, Double>* values);
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 3, Double>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 4, Double>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 3, Double>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 2, Double>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<2, 4, Double>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 2, Double>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<3, 4, Double>* values); /**< @overload */
void setUniform(Int location, UnsignedInt count, const Math::RectangularMatrix<4, 3, Double>* values); /**< @overload */
#endif
private:
static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context);
typedef void(AbstractShaderProgram::*Uniform1fvImplementation)(GLint, GLsizei, const GLfloat*);
typedef void(AbstractShaderProgram::*Uniform2fvImplementation)(GLint, GLsizei, const Math::Vector<2, GLfloat>*);
typedef void(AbstractShaderProgram::*Uniform3fvImplementation)(GLint, GLsizei, const Math::Vector<3, GLfloat>*);
typedef void(AbstractShaderProgram::*Uniform4fvImplementation)(GLint, GLsizei, const Math::Vector<4, GLfloat>*);
typedef void(AbstractShaderProgram::*Uniform1ivImplementation)(GLint, GLsizei, const GLint*);
typedef void(AbstractShaderProgram::*Uniform2ivImplementation)(GLint, GLsizei, const Math::Vector<2, GLint>*);
typedef void(AbstractShaderProgram::*Uniform3ivImplementation)(GLint, GLsizei, const Math::Vector<3, GLint>*);
typedef void(AbstractShaderProgram::*Uniform4ivImplementation)(GLint, GLsizei, const Math::Vector<4, GLint>*);
#ifndef MAGNUM_TARGET_GLES2
typedef void(AbstractShaderProgram::*Uniform1uivImplementation)(GLint, GLsizei, const GLuint*);
typedef void(AbstractShaderProgram::*Uniform2uivImplementation)(GLint, GLsizei, const Math::Vector<2, GLuint>*);
typedef void(AbstractShaderProgram::*Uniform3uivImplementation)(GLint, GLsizei, const Math::Vector<3, GLuint>*);
typedef void(AbstractShaderProgram::*Uniform4uivImplementation)(GLint, GLsizei, const Math::Vector<4, GLuint>*);
#endif
#ifndef MAGNUM_TARGET_GLES
typedef void(AbstractShaderProgram::*Uniform1dvImplementation)(GLint, GLsizei, const GLdouble*);
typedef void(AbstractShaderProgram::*Uniform2dvImplementation)(GLint, GLsizei, const Math::Vector<2, GLdouble>*);
typedef void(AbstractShaderProgram::*Uniform3dvImplementation)(GLint, GLsizei, const Math::Vector<3, GLdouble>*);
typedef void(AbstractShaderProgram::*Uniform4dvImplementation)(GLint, GLsizei, const Math::Vector<4, GLdouble>*);
#endif
void MAGNUM_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const GLfloat* values);
void MAGNUM_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<2, GLfloat>* values);
void MAGNUM_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::Vector<3, GLfloat>* values);
@ -1040,49 +826,7 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
void MAGNUM_LOCAL uniformImplementationDSA(GLint location, GLsizei count, const Math::Vector<3, GLdouble>* values);
void MAGNUM_LOCAL uniformImplementationDSA(GLint location, GLsizei count, const Math::Vector<4, GLdouble>* values);
#endif
static Uniform1fvImplementation uniform1fvImplementation;
static Uniform2fvImplementation uniform2fvImplementation;
static Uniform3fvImplementation uniform3fvImplementation;
static Uniform4fvImplementation uniform4fvImplementation;
static Uniform1ivImplementation uniform1ivImplementation;
static Uniform2ivImplementation uniform2ivImplementation;
static Uniform3ivImplementation uniform3ivImplementation;
static Uniform4ivImplementation uniform4ivImplementation;
#ifndef MAGNUM_TARGET_GLES2
static Uniform1uivImplementation uniform1uivImplementation;
static Uniform2uivImplementation uniform2uivImplementation;
static Uniform3uivImplementation uniform3uivImplementation;
static Uniform4uivImplementation uniform4uivImplementation;
#endif
#ifndef MAGNUM_TARGET_GLES
static Uniform1dvImplementation uniform1dvImplementation;
static Uniform2dvImplementation uniform2dvImplementation;
static Uniform3dvImplementation uniform3dvImplementation;
static Uniform4dvImplementation uniform4dvImplementation;
#endif
typedef void(AbstractShaderProgram::*UniformMatrix2fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 2, GLfloat>*);
typedef void(AbstractShaderProgram::*UniformMatrix3fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 3, GLfloat>*);
typedef void(AbstractShaderProgram::*UniformMatrix4fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 4, GLfloat>*);
#ifndef MAGNUM_TARGET_GLES2
typedef void(AbstractShaderProgram::*UniformMatrix2x3fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 3, GLfloat>*);
typedef void(AbstractShaderProgram::*UniformMatrix3x2fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 2, GLfloat>*);
typedef void(AbstractShaderProgram::*UniformMatrix2x4fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 4, GLfloat>*);
typedef void(AbstractShaderProgram::*UniformMatrix4x2fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 2, GLfloat>*);
typedef void(AbstractShaderProgram::*UniformMatrix3x4fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 4, GLfloat>*);
typedef void(AbstractShaderProgram::*UniformMatrix4x3fvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 3, GLfloat>*);
#endif
#ifndef MAGNUM_TARGET_GLES
typedef void(AbstractShaderProgram::*UniformMatrix2dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 2, GLdouble>*);
typedef void(AbstractShaderProgram::*UniformMatrix3dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 3, GLdouble>*);
typedef void(AbstractShaderProgram::*UniformMatrix4dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 4, GLdouble>*);
typedef void(AbstractShaderProgram::*UniformMatrix2x3dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 3, GLdouble>*);
typedef void(AbstractShaderProgram::*UniformMatrix3x2dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 2, GLdouble>*);
typedef void(AbstractShaderProgram::*UniformMatrix2x4dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<2, 4, GLdouble>*);
typedef void(AbstractShaderProgram::*UniformMatrix4x2dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 2, GLdouble>*);
typedef void(AbstractShaderProgram::*UniformMatrix3x4dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<3, 4, GLdouble>*);
typedef void(AbstractShaderProgram::*UniformMatrix4x3dvImplementation)(GLint, GLsizei, const Math::RectangularMatrix<4, 3, GLdouble>*);
#endif
void MAGNUM_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<2, 2, GLfloat>* values);
void MAGNUM_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<3, 3, GLfloat>* values);
void MAGNUM_LOCAL uniformImplementationDefault(GLint location, GLsizei count, const Math::RectangularMatrix<4, 4, GLfloat>* values);
@ -1123,28 +867,6 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
void MAGNUM_LOCAL uniformImplementationDSA(GLint location, GLsizei count, const Math::RectangularMatrix<3, 4, GLdouble>* values);
void MAGNUM_LOCAL uniformImplementationDSA(GLint location, GLsizei count, const Math::RectangularMatrix<4, 3, GLdouble>* values);
#endif
static UniformMatrix2fvImplementation uniformMatrix2fvImplementation;
static UniformMatrix3fvImplementation uniformMatrix3fvImplementation;
static UniformMatrix4fvImplementation uniformMatrix4fvImplementation;
#ifndef MAGNUM_TARGET_GLES2
static UniformMatrix2x3fvImplementation uniformMatrix2x3fvImplementation;
static UniformMatrix3x2fvImplementation uniformMatrix3x2fvImplementation;
static UniformMatrix2x4fvImplementation uniformMatrix2x4fvImplementation;
static UniformMatrix4x2fvImplementation uniformMatrix4x2fvImplementation;
static UniformMatrix3x4fvImplementation uniformMatrix3x4fvImplementation;
static UniformMatrix4x3fvImplementation uniformMatrix4x3fvImplementation;
#endif
#ifndef MAGNUM_TARGET_GLES
static UniformMatrix2dvImplementation uniformMatrix2dvImplementation;
static UniformMatrix3dvImplementation uniformMatrix3dvImplementation;
static UniformMatrix4dvImplementation uniformMatrix4dvImplementation;
static UniformMatrix2x3dvImplementation uniformMatrix2x3dvImplementation;
static UniformMatrix3x2dvImplementation uniformMatrix3x2dvImplementation;
static UniformMatrix2x4dvImplementation uniformMatrix2x4dvImplementation;
static UniformMatrix4x2dvImplementation uniformMatrix4x2dvImplementation;
static UniformMatrix3x4dvImplementation uniformMatrix3x4dvImplementation;
static UniformMatrix4x3dvImplementation uniformMatrix4x3dvImplementation;
#endif
GLuint _id;
};

1
src/Magnum/CMakeLists.txt

@ -55,6 +55,7 @@ set(Magnum_SRCS
Implementation/BufferState.cpp
Implementation/DebugState.cpp
Implementation/FramebufferState.cpp
Implementation/ShaderProgramState.cpp
Implementation/State.cpp
Implementation/TextureState.cpp

1
src/Magnum/Context.cpp

@ -448,7 +448,6 @@ Context::Context() {
_state = new Implementation::State(*this);
/* Initialize functionality based on current OpenGL version and extensions */
AbstractShaderProgram::initializeContextBasedFunctionality(*this);
Buffer::initializeContextBasedFunctionality(*this);
DefaultFramebuffer::initializeContextBasedFunctionality(*this);
Mesh::initializeContextBasedFunctionality(*this);

139
src/Magnum/Implementation/ShaderProgramState.cpp

@ -0,0 +1,139 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include "ShaderProgramState.h"
#include "Magnum/AbstractShaderProgram.h"
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
namespace Magnum { namespace Implementation {
ShaderProgramState::ShaderProgramState(Context& context, std::vector<std::string>& extensions): current(0), maxVertexAttributes(0)
#ifndef MAGNUM_TARGET_GLES
, maxAtomicCounterBufferSize(0), maxComputeSharedMemorySize(0), maxComputeWorkGroupInvocations(0), maxImageUnits(0), maxImageSamples(0), maxCombinedShaderOutputResources(0), maxUniformLocations(0), maxShaderStorageBlockSize(0)
#endif
#ifndef MAGNUM_TARGET_GLES2
, minTexelOffset(0), maxTexelOffset(0), maxUniformBlockSize(0)
#endif
{
/** @todo OpenGL ES 2 has extension @es_extension{EXT,separate_shader_objects} for this */
#ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::GL::ARB::separate_shader_objects>() ||
context.isExtensionSupported<Extensions::GL::EXT::direct_state_access>())
{
extensions.push_back(context.isExtensionSupported<Extensions::GL::ARB::separate_shader_objects>() ?
Extensions::GL::ARB::separate_shader_objects::string() : Extensions::GL::EXT::direct_state_access::string());
uniform1fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform2fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform3fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform4fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform1ivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform2ivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform3ivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform4ivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform1uivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform2uivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform3uivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform4uivImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform1dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform2dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform3dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniform4dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2x3fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3x2fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2x4fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4x2fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3x4fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4x3fvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2x3dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3x2dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix2x4dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4x2dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix3x4dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
uniformMatrix4x3dvImplementation = &AbstractShaderProgram::uniformImplementationDSA;
} else
#endif
{
#ifdef MAGNUM_TARGET_GLES
static_cast<void>(context);
static_cast<void>(extensions);
#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;
#ifndef MAGNUM_TARGET_GLES2
uniform1uivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniform2uivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniform3uivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniform4uivImplementation = &AbstractShaderProgram::uniformImplementationDefault;
#endif
#ifndef MAGNUM_TARGET_GLES
uniform1dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniform2dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniform3dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniform4dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
#endif
uniformMatrix2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniformMatrix3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniformMatrix4fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
#ifndef MAGNUM_TARGET_GLES2
uniformMatrix2x3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniformMatrix3x2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniformMatrix2x4fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniformMatrix4x2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniformMatrix3x4fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
uniformMatrix4x3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
#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;
#endif
}
}
}}

57
src/Magnum/Implementation/ShaderProgramState.h

@ -25,19 +25,60 @@
DEALINGS IN THE SOFTWARE.
*/
#include <string>
#include <vector>
#include "Magnum/Magnum.h"
#include "Magnum/OpenGL.h"
namespace Magnum { namespace Implementation {
struct ShaderProgramState {
constexpr ShaderProgramState(): current(0), maxVertexAttributes(0)
#ifndef MAGNUM_TARGET_GLES
, maxAtomicCounterBufferSize(0), maxComputeSharedMemorySize(0), maxComputeWorkGroupInvocations(0), maxImageUnits(0), maxImageSamples(0), maxCombinedShaderOutputResources(0), maxUniformLocations(0), maxShaderStorageBlockSize(0)
#endif
#ifndef MAGNUM_TARGET_GLES2
, minTexelOffset(0), maxTexelOffset(0), maxUniformBlockSize(0)
#endif
{}
explicit ShaderProgramState(Context& context, std::vector<std::string>& extensions);
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>*);
#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>*);
#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>*);
#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>*);
#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>*);
#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>*);
#endif
/* Currently used program */
GLuint current;

2
src/Magnum/Implementation/State.cpp

@ -57,7 +57,7 @@ State::State(Context& context) {
mesh = new MeshState;
renderer = new RendererState;
shader = new ShaderState;
shaderProgram = new ShaderProgramState;
shaderProgram = new ShaderProgramState(context, extensions);
texture = new TextureState(context, extensions);
/* Sort the features and remove duplicates */

Loading…
Cancel
Save