Browse Source

More small fixes

pull/576/head
Vladislav Oleshko 4 years ago
parent
commit
fa26cfcbc0
  1. 3
      src/Magnum/GL/AbstractShaderProgram.h
  2. 18
      src/Magnum/Shaders/FlatGL.cpp
  3. 16
      src/Magnum/Shaders/FlatGL.h

3
src/Magnum/GL/AbstractShaderProgram.h

@ -1458,7 +1458,8 @@ class MAGNUM_GL_EXPORT AbstractShaderProgram: public AbstractObject {
/** /**
* @brief Submit for linking * @brief Submit for linking
* *
* The attached shaders must be compiled with @ref Shader::compile() before linking. * The attached shaders must be compiled with @ref Shader::compile()
* or @ref Shader::submitCompile() before linking.
* *
* @see @fn_gl_keyword{LinkProgram} * @see @fn_gl_keyword{LinkProgram}
*/ */

18
src/Magnum/Shaders/FlatGL.cpp

@ -239,6 +239,8 @@ template<UnsignedInt dimensions> typename FlatGL<dimensions>::CompileState FlatG
template<UnsignedInt dimensions> FlatGL<dimensions>::FlatGL(CompileState&& cs) template<UnsignedInt dimensions> FlatGL<dimensions>::FlatGL(CompileState&& cs)
: FlatGL{static_cast<FlatGL&&>(std::move(cs))} { : FlatGL{static_cast<FlatGL&&>(std::move(cs))} {
if (_id == 0) return;
CORRADE_INTERNAL_ASSERT_OUTPUT(cs._vert.checkCompile()); CORRADE_INTERNAL_ASSERT_OUTPUT(cs._vert.checkCompile());
CORRADE_INTERNAL_ASSERT_OUTPUT(cs._frag.checkCompile()); CORRADE_INTERNAL_ASSERT_OUTPUT(cs._frag.checkCompile());
CORRADE_INTERNAL_ASSERT_OUTPUT(checkLink()); CORRADE_INTERNAL_ASSERT_OUTPUT(checkLink());
@ -310,22 +312,6 @@ template<UnsignedInt dimensions> FlatGL<dimensions>::FlatGL(CompileState&& cs)
static_cast<void>(context); static_cast<void>(context);
} }
template<UnsignedInt dimensions> FlatGL<dimensions>::FlatGL(Flags flags
#ifndef MAGNUM_TARGET_GLES2
, UnsignedInt materialCount, UnsignedInt drawCount
#endif
):
#ifndef MAGNUM_TARGET_GLES2
FlatGL(compile(flags, materialCount, drawCount))
#else
FlatGL{compile(flags)}
#endif
{}
#ifndef MAGNUM_TARGET_GLES2
template<UnsignedInt dimensions> FlatGL<dimensions>::FlatGL(const Flags flags): FlatGL{flags, 1, 1} {}
#endif
template<UnsignedInt dimensions> FlatGL<dimensions>& FlatGL<dimensions>::setTransformationProjectionMatrix(const MatrixTypeFor<dimensions, Float>& matrix) { template<UnsignedInt dimensions> FlatGL<dimensions>& FlatGL<dimensions>::setTransformationProjectionMatrix(const MatrixTypeFor<dimensions, Float>& matrix) {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
CORRADE_ASSERT(!(_flags >= Flag::UniformBuffers), CORRADE_ASSERT(!(_flags >= Flag::UniformBuffers),

16
src/Magnum/Shaders/FlatGL.h

@ -550,7 +550,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT FlatGL: public GL::
* @ref FlatGL(Flags, UnsignedInt, UnsignedInt) with @p materialCount * @ref FlatGL(Flags, UnsignedInt, UnsignedInt) with @p materialCount
* and @p drawCount set to @cpp 1 @ce. * and @p drawCount set to @cpp 1 @ce.
*/ */
explicit FlatGL(Flags flags = {}); explicit FlatGL(Flags flags = {}) : FlatGL{compile(flags)} {}
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
@ -586,7 +586,8 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT FlatGL: public GL::
for this might be too confusing); what if some parameters won't be for this might be too confusing); what if some parameters won't be
(unsigned) integers? like a string with shader extensions? make a (unsigned) integers? like a string with shader extensions? make a
whole Configuration class? */ whole Configuration class? */
explicit FlatGL(Flags flags, UnsignedInt materialCount, UnsignedInt drawCount); explicit FlatGL(Flags flags, UnsignedInt materialCount, UnsignedInt drawCount):
FlatGL{compile(flags, materialCount, drawCount)} {}
#endif #endif
/** /**
@ -613,6 +614,12 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT FlatGL: public GL::
#endif #endif
); );
#ifndef MAGNUM_TARGET_GLES2
static CompileState compile(Flags flags) {
return compile(flags, 1, 1);
}
#endif
/** @brief Copying is not allowed */ /** @brief Copying is not allowed */
FlatGL(const FlatGL<dimensions>&) = delete; FlatGL(const FlatGL<dimensions>&) = delete;
@ -1053,13 +1060,10 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT FlatGL: public GL::
}; };
template<UnsignedInt dimensions> class FlatGL<dimensions>::CompileState : public FlatGL<dimensions> { template<UnsignedInt dimensions> class FlatGL<dimensions>::CompileState : public FlatGL<dimensions> {
public:
using FlatGL::isLinkFinished;
private: private:
friend class FlatGL; friend class FlatGL;
CompileState(NoCreateT) : FlatGL(NoCreate), _vert{NoCreate}, _frag{NoCreate} {} explicit CompileState(NoCreateT) : FlatGL{NoCreate}, _vert{NoCreate}, _frag{NoCreate} {}
CompileState(FlatGL<dimensions>&& shader, GL::Shader&& vert, GL::Shader&& frag, GL::Version version) : CompileState(FlatGL<dimensions>&& shader, GL::Shader&& vert, GL::Shader&& frag, GL::Version version) :
FlatGL<dimensions>{std::move(shader)}, _vert{std::move(vert)}, _frag{std::move(frag)}, _version{version} {} FlatGL<dimensions>{std::move(shader)}, _vert{std::move(vert)}, _frag{std::move(frag)}, _version{version} {}

Loading…
Cancel
Save