Browse Source

Shaders: no need to store MeshVisualizer flags in CompileState.

Although stored in a weird type, these are accessible via flags() on the
base class.
pull/589/head
Vladimír Vondruš 4 years ago
parent
commit
13015bd8ff
  1. 8
      src/Magnum/Shaders/MeshVisualizerGL.cpp
  2. 6
      src/Magnum/Shaders/MeshVisualizerGL.h

8
src/Magnum/Shaders/MeshVisualizerGL.cpp

@ -517,7 +517,7 @@ MeshVisualizerGL2D::CompileState MeshVisualizerGL2D::compile(const Flags flags
out.submitLink();
return CompileState{std::move(out), std::move(vert), std::move(frag), geom ? &*geom : nullptr, flags, version};
return CompileState{std::move(out), std::move(vert), std::move(frag), geom ? &*geom : nullptr, version};
}
MeshVisualizerGL2D::MeshVisualizerGL2D(const Flags flags): MeshVisualizerGL2D{compile(flags)} {}
@ -544,7 +544,7 @@ MeshVisualizerGL2D::MeshVisualizerGL2D(CompileState&& state): MeshVisualizerGL2D
const GL::Context& context = GL::Context::current();
const GL::Version version = state._version;
const Flags flags = state._flags;
const Flags flags = state.flags();
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version))
@ -906,7 +906,7 @@ MeshVisualizerGL3D::CompileState MeshVisualizerGL3D::compile(Flags flags
out.submitLink();
return CompileState{std::move(out), std::move(vert), std::move(frag), geom ? &*geom : nullptr, flags, version};
return CompileState{std::move(out), std::move(vert), std::move(frag), geom ? &*geom : nullptr, version};
}
MeshVisualizerGL3D::MeshVisualizerGL3D(CompileState&& state): MeshVisualizerGL3D{static_cast<MeshVisualizerGL3D&&>(std::move(state))} {
@ -923,7 +923,7 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(CompileState&& state): MeshVisualizerGL3D
const GL::Context& context = GL::Context::current();
const GL::Version version = state._version;
Flags flags = state._flags;
Flags flags = state.flags();
#ifndef MAGNUM_TARGET_GLES
if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version))

6
src/Magnum/Shaders/MeshVisualizerGL.h

@ -929,12 +929,11 @@ class MeshVisualizerGL2D::CompileState: public MeshVisualizerGL2D {
explicit CompileState(NoCreateT): MeshVisualizerGL2D{NoCreate}, _vert{NoCreate}, _frag{NoCreate}, _geom{NoCreate} {}
explicit CompileState(MeshVisualizerGL2D&& shader, GL::Shader&& vert, GL::Shader&& frag, GL::Shader* geom, Flags flags, GL::Version version): MeshVisualizerGL2D{std::move(shader)}, _vert{std::move(vert)}, _frag{std::move(frag)}, _geom{NoCreate}, _flags{flags}, _version{version} {
explicit CompileState(MeshVisualizerGL2D&& shader, GL::Shader&& vert, GL::Shader&& frag, GL::Shader* geom, GL::Version version): MeshVisualizerGL2D{std::move(shader)}, _vert{std::move(vert)}, _frag{std::move(frag)}, _geom{NoCreate}, _version{version} {
if(geom) _geom = Implementation::GLShaderWrapper{std::move(*geom)};
}
Implementation::GLShaderWrapper _vert, _frag, _geom;
Flags _flags;
GL::Version _version;
};
@ -2467,12 +2466,11 @@ class MeshVisualizerGL3D::CompileState: public MeshVisualizerGL3D {
explicit CompileState(NoCreateT): MeshVisualizerGL3D{NoCreate}, _vert{NoCreate}, _frag{NoCreate}, _geom{NoCreate} {}
explicit CompileState(MeshVisualizerGL3D&& shader, GL::Shader&& vert, GL::Shader&& frag, GL::Shader* geom, Flags flags, GL::Version version): MeshVisualizerGL3D{std::move(shader)}, _vert{std::move(vert)}, _frag{std::move(frag)}, _geom{NoCreate}, _flags{flags}, _version{version} {
explicit CompileState(MeshVisualizerGL3D&& shader, GL::Shader&& vert, GL::Shader&& frag, GL::Shader* geom, GL::Version version): MeshVisualizerGL3D{std::move(shader)}, _vert{std::move(vert)}, _frag{std::move(frag)}, _geom{NoCreate}, _version{version} {
if(geom) _geom = Implementation::GLShaderWrapper{std::move(*geom)};
}
Implementation::GLShaderWrapper _vert, _frag, _geom;
Flags _flags;
GL::Version _version;
};

Loading…
Cancel
Save