summaryrefslogtreecommitdiff
path: root/src/mbgl/gl
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-12-20 15:04:22 -0200
committerThiago Marcos P. Santos <thiago@mapbox.com>2017-01-24 11:36:59 +0200
commit9ac54eecbacbc7d39026656c8558f317b99c57ed (patch)
treebc2612ee7e4748987c5c223f5a14f12f398e1e62 /src/mbgl/gl
parent3e2fc894f73e5750ad365d7ca3563d535928a17b (diff)
downloadqtlocation-mapboxgl-9ac54eecbacbc7d39026656c8558f317b99c57ed.tar.gz
[gcc4.9] Only do bracket initialization where GCC4.9 can handle it
GCC 4.9 cannot do bracket initialization when one of the attributes already has a default value.
Diffstat (limited to 'src/mbgl/gl')
-rw-r--r--src/mbgl/gl/context.hpp4
-rw-r--r--src/mbgl/gl/texture.hpp4
-rw-r--r--src/mbgl/gl/uniform.hpp4
3 files changed, 9 insertions, 3 deletions
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index 093afa20ed..056c262c0f 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -91,7 +91,7 @@ public:
template <typename Image>
Texture createTexture(const Image& image, TextureUnit unit = 0) {
auto format = image.channels == 4 ? TextureFormat::RGBA : TextureFormat::Alpha;
- return { image.size, createTexture(image.size, image.data.get(), format, unit) };
+ return Texture(image.size, [&] { return createTexture(image.size, image.data.get(), format, unit); });
}
template <typename Image>
@@ -105,7 +105,7 @@ public:
Texture createTexture(const Size size,
TextureFormat format = TextureFormat::RGBA,
TextureUnit unit = 0) {
- return { size, createTexture(size, nullptr, format, unit) };
+ return Texture(size, [&] { return createTexture(size, nullptr, format, unit); });
}
void bindTexture(Texture&,
diff --git a/src/mbgl/gl/texture.hpp b/src/mbgl/gl/texture.hpp
index 5330689ac2..ffa08ec80a 100644
--- a/src/mbgl/gl/texture.hpp
+++ b/src/mbgl/gl/texture.hpp
@@ -3,11 +3,15 @@
#include <mbgl/gl/object.hpp>
#include <mbgl/util/size.hpp>
+#include <functional>
+
namespace mbgl {
namespace gl {
class Texture {
public:
+ Texture(Size size_, std::function<UniqueTexture()> getTexture) : size(size_), texture(getTexture()) {}
+
Size size;
UniqueTexture texture;
TextureFilter filter = TextureFilter::Nearest;
diff --git a/src/mbgl/gl/uniform.hpp b/src/mbgl/gl/uniform.hpp
index 726cd4fe10..5c0980baf0 100644
--- a/src/mbgl/gl/uniform.hpp
+++ b/src/mbgl/gl/uniform.hpp
@@ -28,6 +28,8 @@ public:
class State {
public:
+ State(UniformLocation location_) : location(std::move(location_)) {}
+
void operator=(const Value& value) {
if (!current || *current != value.t) {
current = value.t;
@@ -67,7 +69,7 @@ public:
using Values = IndexedTuple<TypeList<Us...>, TypeList<typename Us::Value...>>;
static State state(const ProgramID& id) {
- return State { { uniformLocation(id, Us::name) }... };
+ return State(typename Us::State(uniformLocation(id, Us::name))...);
}
static std::function<void ()> binder(State& state, Values&& values_) {