From 1d6c99da76851695e00533c1e1b9b050dc3f073d Mon Sep 17 00:00:00 2001 From: Vladislav Oleshko Date: Tue, 23 Aug 2022 14:52:39 +0300 Subject: [PATCH] Move FlatGL impls from header --- src/Magnum/Shaders/FlatGL.cpp | 13 +++++++++++++ src/Magnum/Shaders/FlatGL.h | 11 ++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Magnum/Shaders/FlatGL.cpp b/src/Magnum/Shaders/FlatGL.cpp index 29c34cb61..272964207 100644 --- a/src/Magnum/Shaders/FlatGL.cpp +++ b/src/Magnum/Shaders/FlatGL.cpp @@ -312,6 +312,19 @@ template FlatGL::FlatGL(CompileState&& cs) static_cast(context); } +template FlatGL::FlatGL(Flags flags) : FlatGL{compile(flags)} {} + +#ifndef MAGNUM_TARGET_GLES2 +template typename FlatGL::CompileState FlatGL::compile(Flags flags) { + return compile(flags, 1, 1); +} + +template FlatGL::FlatGL(Flags flags, UnsignedInt materialCount, UnsignedInt drawCount) + : FlatGL{compile(flags, materialCount, drawCount)} {} +#endif + +template FlatGL::FlatGL(NoInitT) {} + template FlatGL& FlatGL::setTransformationProjectionMatrix(const MatrixTypeFor& matrix) { #ifndef MAGNUM_TARGET_GLES2 CORRADE_ASSERT(!(_flags >= Flag::UniformBuffers), diff --git a/src/Magnum/Shaders/FlatGL.h b/src/Magnum/Shaders/FlatGL.h index 6c6fe5d0e..6b39cf907 100644 --- a/src/Magnum/Shaders/FlatGL.h +++ b/src/Magnum/Shaders/FlatGL.h @@ -550,7 +550,7 @@ template class MAGNUM_SHADERS_EXPORT FlatGL: public GL:: * @ref FlatGL(Flags, UnsignedInt, UnsignedInt) with @p materialCount * and @p drawCount set to @cpp 1 @ce. */ - explicit FlatGL(Flags flags = {}) : FlatGL{compile(flags)} {} + explicit FlatGL(Flags flags = {}); #ifndef MAGNUM_TARGET_GLES2 /** @@ -586,8 +586,7 @@ template class MAGNUM_SHADERS_EXPORT FlatGL: public GL:: for this might be too confusing); what if some parameters won't be (unsigned) integers? like a string with shader extensions? make a whole Configuration class? */ - explicit FlatGL(Flags flags, UnsignedInt materialCount, UnsignedInt drawCount): - FlatGL{compile(flags, materialCount, drawCount)} {} + explicit FlatGL(Flags flags, UnsignedInt materialCount, UnsignedInt drawCount); #endif /** @@ -615,9 +614,7 @@ template class MAGNUM_SHADERS_EXPORT FlatGL: public GL:: ); #ifndef MAGNUM_TARGET_GLES2 - static CompileState compile(Flags flags) { - return compile(flags, 1, 1); - } + static CompileState compile(Flags flags); #endif /** @brief Copying is not allowed */ @@ -1030,7 +1027,7 @@ template class MAGNUM_SHADERS_EXPORT FlatGL: public GL:: private: /* Creates the GL shader program object but nothing else. Internal, used by compile(). */ - explicit FlatGL(NoInitT) {} + explicit FlatGL(NoInitT); /* Prevent accidentally calling irrelevant functions */ #ifndef MAGNUM_TARGET_GLES