Browse Source

Shaders: minor cleanup.

* No need to repeat the type for all variables, unnecessary redundancy.
 * Reducing the amount of redundant local variables and if they stay
   making their definitions more localized to where they get used.
 * All uniform setters used the "initial value is" phrase instead of
   "default is", this one didn't.
pull/499/head
Vladimír Vondruš 3 years ago
parent
commit
5cfdb60681
  1. 11
      src/Magnum/Shaders/DistanceFieldVectorGL.cpp
  2. 4
      src/Magnum/Shaders/DistanceFieldVectorGL.h
  3. 11
      src/Magnum/Shaders/FlatGL.cpp
  4. 6
      src/Magnum/Shaders/FlatGL.h
  5. 109
      src/Magnum/Shaders/MeshVisualizerGL.cpp
  6. 12
      src/Magnum/Shaders/MeshVisualizerGL.h
  7. 11
      src/Magnum/Shaders/PhongGL.cpp
  8. 8
      src/Magnum/Shaders/PhongGL.h
  9. 11
      src/Magnum/Shaders/VectorGL.cpp
  10. 4
      src/Magnum/Shaders/VectorGL.h
  11. 11
      src/Magnum/Shaders/VertexColorGL.cpp

11
src/Magnum/Shaders/DistanceFieldVectorGL.cpp

@ -189,11 +189,9 @@ template<UnsignedInt dimensions> DistanceFieldVectorGL<dimensions>::DistanceFiel
CORRADE_INTERNAL_ASSERT_OUTPUT(checkLink({GL::Shader(state._vert), GL::Shader(state._frag)}));
const GL::Context& context = GL::Context::current();
const GL::Version version = state._version;
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version))
const GL::Context& context = GL::Context::current();
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(state._version))
#endif
{
#ifndef MAGNUM_TARGET_GLES2
@ -213,7 +211,7 @@ template<UnsignedInt dimensions> DistanceFieldVectorGL<dimensions>::DistanceFiel
}
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(version))
if(!context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(state._version))
#endif
{
setUniform(uniformLocation("vectorTexture"), TextureUnit);
@ -245,9 +243,6 @@ template<UnsignedInt dimensions> DistanceFieldVectorGL<dimensions>::DistanceFiel
setSmoothness(0.04f);
}
#endif
static_cast<void>(context);
static_cast<void>(version);
}
template<UnsignedInt dimensions> DistanceFieldVectorGL<dimensions>::DistanceFieldVectorGL(const Configuration& configuration): DistanceFieldVectorGL{compile(configuration)} {}

4
src/Magnum/Shaders/DistanceFieldVectorGL.h

@ -728,8 +728,8 @@ template<UnsignedInt dimensions> class DistanceFieldVectorGL<dimensions>::Config
private:
Flags _flags;
#ifndef MAGNUM_TARGET_GLES2
UnsignedInt _materialCount = 1;
UnsignedInt _drawCount = 1;
UnsignedInt _materialCount = 1,
_drawCount = 1;
#endif
};

11
src/Magnum/Shaders/FlatGL.cpp

@ -264,11 +264,9 @@ template<UnsignedInt dimensions> FlatGL<dimensions>::FlatGL(CompileState&& state
CORRADE_INTERNAL_ASSERT_OUTPUT(checkLink({GL::Shader(state._vert), GL::Shader(state._frag)}));
const GL::Context& context = GL::Context::current();
const GL::Version version = state._version;
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version))
const GL::Context& context = GL::Context::current();
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(state._version))
#endif
{
#ifndef MAGNUM_TARGET_GLES2
@ -293,7 +291,7 @@ template<UnsignedInt dimensions> FlatGL<dimensions>::FlatGL(CompileState&& state
}
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(version))
if(!context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(state._version))
#endif
{
if(_flags & Flag::Textured) setUniform(uniformLocation("textureData"), TextureUnit);
@ -326,9 +324,6 @@ template<UnsignedInt dimensions> FlatGL<dimensions>::FlatGL(CompileState&& state
/* Object ID is zero by default */
}
#endif
static_cast<void>(version);
static_cast<void>(context);
}
template<UnsignedInt dimensions> FlatGL<dimensions>::FlatGL(const Configuration& configuration): FlatGL{compile(configuration)} {}

6
src/Magnum/Shaders/FlatGL.h

@ -797,7 +797,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT FlatGL: public GL::
*
* Expects that the shader was created with @ref Flag::ObjectId
* enabled. Value set here is written to the @ref ObjectIdOutput, see
* @ref Shaders-FlatGL-object-id for more information. Default is
* @ref Shaders-FlatGL-object-id for more information. Initial value is
* @cpp 0 @ce. If @ref Flag::InstancedObjectId and/or
* @ref Flag::ObjectIdTexture is enabled as well, this value is added
* to the ID coming from the @ref ObjectId attribute and/or the
@ -1141,8 +1141,8 @@ template<UnsignedInt dimensions> class FlatGL<dimensions>::Configuration {
private:
Flags _flags;
#ifndef MAGNUM_TARGET_GLES2
UnsignedInt _materialCount = 1;
UnsignedInt _drawCount = 1;
UnsignedInt _materialCount = 1,
_drawCount = 1;
#endif
};

109
src/Magnum/Shaders/MeshVisualizerGL.cpp

@ -398,10 +398,6 @@ MeshVisualizerGL2D::CompileState MeshVisualizerGL2D::compile(const Configuration
"Shaders::MeshVisualizerGL2D: draw count can't be zero", CompileState{NoCreate});
#endif
#ifndef MAGNUM_TARGET_GLES
const GL::Context& context = GL::Context::current();
#endif
Utility::Resource rs{"MagnumShadersGL"};
GL::Shader vert{NoCreate};
GL::Shader frag{NoCreate};
@ -483,6 +479,7 @@ MeshVisualizerGL2D::CompileState MeshVisualizerGL2D::compile(const Configuration
/* ES3 has this done in the shader directly */
#if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2)
#ifndef MAGNUM_TARGET_GLES
const GL::Context& context = GL::Context::current();
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_attrib_location>(version))
#endif
{
@ -543,48 +540,45 @@ MeshVisualizerGL2D::MeshVisualizerGL2D(CompileState&& state): MeshVisualizerGL2D
else
CORRADE_INTERNAL_ASSERT_OUTPUT(checkLink({GL::Shader(state._vert), GL::Shader(state._frag)}));
const GL::Context& context = GL::Context::current();
const GL::Version version = state._version;
const Flags flags = state.flags();
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version))
const GL::Context& context = GL::Context::current();
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(state._version))
#endif
{
/* This one is used also in the UBO case as it's usually a global
setting */
if((flags & Flag::Wireframe) && !(flags & Flag::NoGeometryShader))
if((flags() & Flag::Wireframe) && !(flags() & Flag::NoGeometryShader))
_viewportSizeUniform = uniformLocation("viewportSize");
#ifndef MAGNUM_TARGET_GLES2
if(flags >= Flag::UniformBuffers) {
if(flags() >= Flag::UniformBuffers) {
if(_drawCount > 1) _drawOffsetUniform = uniformLocation("drawOffset");
} else
#endif
{
_transformationProjectionMatrixUniform = uniformLocation("transformationProjectionMatrix");
#ifndef MAGNUM_TARGET_GLES2
if(flags & Flag::TextureTransformation)
if(flags() & Flag::TextureTransformation)
_textureMatrixUniform = uniformLocation("textureMatrix");
if(flags & Flag::TextureArrays)
if(flags() & Flag::TextureArrays)
_textureLayerUniform = uniformLocation("textureLayer");
#endif
if(flags & (Flag::Wireframe
if(flags() & (Flag::Wireframe
#ifndef MAGNUM_TARGET_GLES2
|Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId
#endif
))
_colorUniform = uniformLocation("color");
if(flags & Flag::Wireframe) {
if(flags() & Flag::Wireframe) {
_wireframeColorUniform = uniformLocation("wireframeColor");
_wireframeWidthUniform = uniformLocation("wireframeWidth");
_smoothnessUniform = uniformLocation("smoothness");
}
#ifndef MAGNUM_TARGET_GLES2
if(flags & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId)) {
if(flags() & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId)) {
_colorMapOffsetScaleUniform = uniformLocation("colorMapOffsetScale");
}
if(flags & Flag::ObjectId)
if(flags() & Flag::ObjectId)
_objectIdUniform = uniformLocation("objectId");
#endif
}
@ -592,20 +586,20 @@ MeshVisualizerGL2D::MeshVisualizerGL2D(CompileState&& state): MeshVisualizerGL2D
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
if(flags && !context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(version))
if(flags() && !context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(state._version))
#endif
{
if(flags & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId)) {
if(flags() & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId)) {
setUniform(uniformLocation("colorMapTexture"), ColorMapTextureUnit);
}
#ifndef MAGNUM_TARGET_GLES2
if(flags >= Flag::ObjectIdTexture)
if(flags() >= Flag::ObjectIdTexture)
setUniform(uniformLocation("objectIdTextureData"), ObjectIdTextureUnit);
if(flags >= Flag::UniformBuffers) {
if(flags() >= Flag::UniformBuffers) {
setUniformBlockBinding(uniformBlockIndex("TransformationProjection"), TransformationProjectionBufferBinding);
setUniformBlockBinding(uniformBlockIndex("Draw"), DrawBufferBinding);
setUniformBlockBinding(uniformBlockIndex("Material"), MaterialBufferBinding);
if(flags & Flag::TextureTransformation)
if(flags() & Flag::TextureTransformation)
setUniformBlockBinding(uniformBlockIndex("TextureTransformation"), TextureTransformationBufferBinding);
}
#endif
@ -615,34 +609,31 @@ MeshVisualizerGL2D::MeshVisualizerGL2D(CompileState&& state): MeshVisualizerGL2D
/* Set defaults in OpenGL ES (for desktop they are set in shader code itself) */
#ifdef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
if(flags >= Flag::UniformBuffers) {
if(flags() >= Flag::UniformBuffers) {
/* Viewport size is zero by default */
/* Draw offset is zero by default */
} else
#endif
{
setTransformationProjectionMatrix(Matrix3{Math::IdentityInit});
if(flags & (Flag::Wireframe
if(flags() & (Flag::Wireframe
#ifndef MAGNUM_TARGET_GLES2
|Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId
#endif
))
setColor(Color3(1.0f));
if(flags & Flag::Wireframe) {
if(flags() & Flag::Wireframe) {
/* Viewport size is zero by default */
setWireframeColor(Color3{0.0f});
setWireframeWidth(1.0f);
setSmoothness(2.0f);
}
#ifndef MAGNUM_TARGET_GLES2
if(flags & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId))
if(flags() & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId))
setColorMapTransformation(1.0f/512.0f, 1.0f/256.0f);
#endif
}
#endif
static_cast<void>(context);
static_cast<void>(version);
}
MeshVisualizerGL2D::MeshVisualizerGL2D(const Configuration& configuration): MeshVisualizerGL2D{compile(configuration)} {}
@ -753,10 +744,6 @@ MeshVisualizerGL3D::CompileState MeshVisualizerGL3D::compile(const Configuration
"Shaders::MeshVisualizerGL3D: draw count can't be zero", CompileState{NoCreate});
#endif
#ifndef MAGNUM_TARGET_GLES
const GL::Context& context = GL::Context::current();
#endif
Utility::Resource rs{"MagnumShadersGL"};
GL::Shader vert{NoCreate};
GL::Shader frag{NoCreate};
@ -872,6 +859,7 @@ MeshVisualizerGL3D::CompileState MeshVisualizerGL3D::compile(const Configuration
/* ES3 has this done in the shader directly */
#if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2)
#ifndef MAGNUM_TARGET_GLES
const GL::Context& context = GL::Context::current();
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_attrib_location>(version))
#endif
{
@ -903,7 +891,6 @@ MeshVisualizerGL3D::CompileState MeshVisualizerGL3D::compile(const Configuration
configuration.flags() & Flag::BitangentFromTangentDirection)
out.bindAttributeLocation(Normal::Location, "normal");
#endif
#if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2)
#ifndef MAGNUM_TARGET_GLES
if(!context.isVersionSupported(GL::Version::GL310))
@ -948,25 +935,22 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(CompileState&& state): MeshVisualizerGL3D
else
CORRADE_INTERNAL_ASSERT_OUTPUT(checkLink({GL::Shader(state._vert), GL::Shader(state._frag)}));
const GL::Context& context = GL::Context::current();
const GL::Version version = state._version;
Flags flags = state.flags();
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version))
const GL::Context& context = GL::Context::current();
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(state._version))
#endif
{
/* This one is used also in the UBO case as it's usually a global
setting */
if(((flags & Flag::Wireframe) && !(flags & Flag::NoGeometryShader))
if(((flags() & Flag::Wireframe) && !(flags() & Flag::NoGeometryShader))
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|| (flags & (Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection))
|| (flags() & (Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection))
#endif
)
_viewportSizeUniform = uniformLocation("viewportSize");
#ifndef MAGNUM_TARGET_GLES2
if(flags >= Flag::UniformBuffers) {
if(flags() >= Flag::UniformBuffers) {
if(_drawCount > 1) _drawOffsetUniform = uniformLocation("drawOffset");
} else
#endif
@ -974,22 +958,22 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(CompileState&& state): MeshVisualizerGL3D
_transformationMatrixUniform = uniformLocation("transformationMatrix");
_projectionMatrixUniform = uniformLocation("projectionMatrix");
#ifndef MAGNUM_TARGET_GLES2
if(flags & Flag::TextureTransformation)
if(flags() & Flag::TextureTransformation)
_textureMatrixUniform = uniformLocation("textureMatrix");
if(flags & Flag::TextureArrays)
if(flags() & Flag::TextureArrays)
_textureLayerUniform = uniformLocation("textureLayer");
#endif
if(flags & (Flag::Wireframe
if(flags() & (Flag::Wireframe
#ifndef MAGNUM_TARGET_GLES2
|Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId
#endif
))
_colorUniform = uniformLocation("color");
if(flags & Flag::Wireframe) {
if(flags() & Flag::Wireframe) {
_wireframeColorUniform = uniformLocation("wireframeColor");
_wireframeWidthUniform = uniformLocation("wireframeWidth");
}
if(flags & (Flag::Wireframe
if(flags() & (Flag::Wireframe
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection
#endif
@ -997,14 +981,14 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(CompileState&& state): MeshVisualizerGL3D
_smoothnessUniform = uniformLocation("smoothness");
}
#ifndef MAGNUM_TARGET_GLES2
if(flags & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId)) {
if(flags() & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId)) {
_colorMapOffsetScaleUniform = uniformLocation("colorMapOffsetScale");
}
if(flags & Flag::ObjectId)
if(flags() & Flag::ObjectId)
_objectIdUniform = uniformLocation("objectId");
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(flags & (Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection)) {
if(flags() & (Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection)) {
_normalMatrixUniform = uniformLocation("normalMatrix");
_lineWidthUniform = uniformLocation("lineWidth");
_lineLengthUniform = uniformLocation("lineLength");
@ -1015,21 +999,21 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(CompileState&& state): MeshVisualizerGL3D
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
if(flags && !context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(version))
if(flags() && !context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(state._version))
#endif
{
if(flags & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId)) {
if(flags() & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId)) {
setUniform(uniformLocation("colorMapTexture"), ColorMapTextureUnit);
}
#ifndef MAGNUM_TARGET_GLES2
if(flags >= Flag::ObjectIdTexture)
if(flags() >= Flag::ObjectIdTexture)
setUniform(uniformLocation("objectIdTextureData"), ObjectIdTextureUnit);
if(flags >= Flag::UniformBuffers) {
if(flags() >= Flag::UniformBuffers) {
setUniformBlockBinding(uniformBlockIndex("Projection"), ProjectionBufferBinding);
setUniformBlockBinding(uniformBlockIndex("Transformation"), TransformationBufferBinding);
setUniformBlockBinding(uniformBlockIndex("Draw"), DrawBufferBinding);
setUniformBlockBinding(uniformBlockIndex("Material"), MaterialBufferBinding);
if(flags & Flag::TextureTransformation)
if(flags() & Flag::TextureTransformation)
setUniformBlockBinding(uniformBlockIndex("TextureTransformation"), TextureTransformationBufferBinding);
}
#endif
@ -1039,7 +1023,7 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(CompileState&& state): MeshVisualizerGL3D
/* Set defaults in OpenGL ES (for desktop they are set in shader code itself) */
#ifdef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
if(flags >= Flag::UniformBuffers) {
if(flags() >= Flag::UniformBuffers) {
/* Viewport size is zero by default */
/* Draw offset is zero by default */
} else
@ -1047,18 +1031,18 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(CompileState&& state): MeshVisualizerGL3D
{
setTransformationMatrix(Matrix4{Math::IdentityInit});
setProjectionMatrix(Matrix4{Math::IdentityInit});
if(flags & (Flag::Wireframe
if(flags() & (Flag::Wireframe
#ifndef MAGNUM_TARGET_GLES2
|Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId
#endif
))
setColor(Color3(1.0f));
if(flags & Flag::Wireframe) {
if(flags() & Flag::Wireframe) {
/* Viewport size is zero by default */
setWireframeColor(Color3{0.0f});
setWireframeWidth(1.0f);
}
if(flags & (Flag::Wireframe
if(flags() & (Flag::Wireframe
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection
#endif
@ -1066,11 +1050,11 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(CompileState&& state): MeshVisualizerGL3D
setSmoothness(2.0f);
}
#ifndef MAGNUM_TARGET_GLES2
if(flags & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId))
if(flags() & (Flag::ObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId))
setColorMapTransformation(1.0f/512.0f, 1.0f/256.0f);
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(flags & (Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection)) {
if(flags() & (Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection)) {
setNormalMatrix(Matrix3x3{Math::IdentityInit});
setLineWidth(1.0f);
setLineLength(1.0f);
@ -1078,9 +1062,6 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(CompileState&& state): MeshVisualizerGL3D
#endif
}
#endif
static_cast<void>(context);
static_cast<void>(version);
}
MeshVisualizerGL3D::MeshVisualizerGL3D(const Configuration& configuration): MeshVisualizerGL3D{compile(configuration)} {}

12
src/Magnum/Shaders/MeshVisualizerGL.h

@ -625,7 +625,7 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizerGL2D: public Implementation::MeshVisua
* @return Reference to self (for method chaining)
* @m_since_latest
*
* Expects that @ref Flag::ObjectId is enabled. Default is
* Expects that @ref Flag::ObjectId is enabled. Initial value is
* @cpp 0 @ce. If @ref Flag::InstancedObjectId is enabled as well, this
* value is added to the ID coming from the @ref ObjectId attribute.
*
@ -960,8 +960,8 @@ class MeshVisualizerGL2D::Configuration {
private:
Flags _flags;
#ifndef MAGNUM_TARGET_GLES2
UnsignedInt _materialCount = 1;
UnsignedInt _drawCount = 1;
UnsignedInt _materialCount = 1,
_drawCount = 1;
#endif
};
@ -2036,7 +2036,7 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizerGL3D: public Implementation::MeshVisua
* @return Reference to self (for method chaining)
* @m_since_latest
*
* Expects that @ref Flag::ObjectId is enabled. Default is
* Expects that @ref Flag::ObjectId is enabled. Initial value is
* @cpp 0 @ce. If @ref Flag::InstancedObjectId is enabled as well, this
* value is added to the ID coming from the @ref ObjectId attribute.
*
@ -2548,8 +2548,8 @@ class MeshVisualizerGL3D::Configuration {
private:
Flags _flags;
#ifndef MAGNUM_TARGET_GLES2
UnsignedInt _materialCount = 1;
UnsignedInt _drawCount = 1;
UnsignedInt _materialCount = 1,
_drawCount = 1;
#endif
};

11
src/Magnum/Shaders/PhongGL.cpp

@ -376,11 +376,9 @@ PhongGL::PhongGL(CompileState&& state): PhongGL{static_cast<PhongGL&&>(std::move
CORRADE_INTERNAL_ASSERT_OUTPUT(checkLink({GL::Shader(state._vert), GL::Shader(state._frag)}));
const GL::Context& context = GL::Context::current();
const GL::Version version = state._version;
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version))
const GL::Context& context = GL::Context::current();
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(state._version))
#endif
{
#ifndef MAGNUM_TARGET_GLES2
@ -421,7 +419,7 @@ PhongGL::PhongGL(CompileState&& state): PhongGL{static_cast<PhongGL&&>(std::move
}
#ifndef MAGNUM_TARGET_GLES
if(_flags && !context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(version))
if(_flags && !context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(state._version))
#endif
{
if(_flags & Flag::AmbientTexture) setUniform(uniformLocation("ambientTexture"), AmbientTextureUnit);
@ -482,9 +480,6 @@ PhongGL::PhongGL(CompileState&& state): PhongGL{static_cast<PhongGL&&>(std::move
/* Object ID is zero by default */
}
#endif
static_cast<void>(context);
static_cast<void>(version);
}
PhongGL::PhongGL(const Configuration& configuration): PhongGL{compile(configuration)} {}

8
src/Magnum/Shaders/PhongGL.h

@ -1048,8 +1048,8 @@ class MAGNUM_SHADERS_EXPORT PhongGL: public GL::AbstractShaderProgram {
*
* Expects that the shader was created with @ref Flag::ObjectId
* enabled. Value set here is written to the @ref ObjectIdOutput, see
* @ref Shaders-PhongGL-object-id for more information. Default is
* @cpp 0 @ce. If @ref Flag::InstancedObjectId and/or
* @ref Shaders-PhongGL-object-id for more information. Initial value
* is @cpp 0 @ce. If @ref Flag::InstancedObjectId and/or
* @ref Flag::ObjectIdTexture is enabled as well, this value is added
* to the ID coming from the @ref ObjectId attribute and/or the
* texture.
@ -1920,8 +1920,8 @@ class PhongGL::Configuration {
Flags _flags;
UnsignedInt _lightCount = 1;
#ifndef MAGNUM_TARGET_GLES2
UnsignedInt _materialCount = 1;
UnsignedInt _drawCount = 1;
UnsignedInt _materialCount = 1,
_drawCount = 1;
#endif
};

11
src/Magnum/Shaders/VectorGL.cpp

@ -190,11 +190,9 @@ template<UnsignedInt dimensions> VectorGL<dimensions>::VectorGL(CompileState&& s
CORRADE_INTERNAL_ASSERT_OUTPUT(checkLink({GL::Shader(state._vert), GL::Shader(state._frag)}));
const GL::Context& context = GL::Context::current();
const GL::Version version = state._version;
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version))
const GL::Context& context = GL::Context::current();
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(state._version))
#endif
{
#ifndef MAGNUM_TARGET_GLES2
@ -212,7 +210,7 @@ template<UnsignedInt dimensions> VectorGL<dimensions>::VectorGL(CompileState&& s
}
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(version))
if(!context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(state._version))
#endif
{
setUniform(uniformLocation("vectorTexture"), TextureUnit);
@ -242,9 +240,6 @@ template<UnsignedInt dimensions> VectorGL<dimensions>::VectorGL(CompileState&& s
setColor(Color4{1.0f});
}
#endif
static_cast<void>(context);
static_cast<void>(version);
}
template<UnsignedInt dimensions> VectorGL<dimensions>::VectorGL(const Configuration& configuration): VectorGL{compile(configuration)} {}

4
src/Magnum/Shaders/VectorGL.h

@ -679,8 +679,8 @@ template<UnsignedInt dimensions> class VectorGL<dimensions>::Configuration {
private:
Flags _flags;
#ifndef MAGNUM_TARGET_GLES2
UnsignedInt _materialCount = 1;
UnsignedInt _drawCount = 1;
UnsignedInt _materialCount = 1,
_drawCount = 1;
#endif
};

11
src/Magnum/Shaders/VertexColorGL.cpp

@ -167,11 +167,9 @@ template<UnsignedInt dimensions> VertexColorGL<dimensions>::VertexColorGL(Compil
CORRADE_INTERNAL_ASSERT_OUTPUT(checkLink({GL::Shader(state._vert), GL::Shader(state._frag)}));
const GL::Context& context = GL::Context::current();
const GL::Version version = state._version;
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version))
const GL::Context& context = GL::Context::current();
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(state._version))
#endif
{
#ifndef MAGNUM_TARGET_GLES2
@ -187,7 +185,7 @@ template<UnsignedInt dimensions> VertexColorGL<dimensions>::VertexColorGL(Compil
#ifndef MAGNUM_TARGET_GLES2
if(_flags >= Flag::UniformBuffers
#ifndef MAGNUM_TARGET_GLES
&& !context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(version)
&& !context.isExtensionSupported<GL::Extensions::ARB::shading_language_420pack>(state._version)
#endif
) {
setUniformBlockBinding(uniformBlockIndex("TransformationProjection"), TransformationProjectionBufferBinding);
@ -205,9 +203,6 @@ template<UnsignedInt dimensions> VertexColorGL<dimensions>::VertexColorGL(Compil
setTransformationProjectionMatrix(MatrixTypeFor<dimensions, Float>{Math::IdentityInit});
}
#endif
static_cast<void>(context);
static_cast<void>(version);
}
template<UnsignedInt dimensions> VertexColorGL<dimensions>::VertexColorGL(const Configuration& configuration): VertexColorGL{compile(configuration)} {}

Loading…
Cancel
Save