diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-07-07 19:13:16 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-07-08 13:11:25 +0200 |
commit | 4f26c8122a57cd5fe35a10dc2e125500179a75a5 (patch) | |
tree | 02381c3db2adedcc6afa721137a6fb318ec915dd /src/mbgl/gl | |
parent | aaa30c8a19bd608baf4c190f794258919365c36d (diff) | |
download | qtlocation-mapboxgl-4f26c8122a57cd5fe35a10dc2e125500179a75a5.tar.gz |
[core] track texture state to avoid redundand binds
Diffstat (limited to 'src/mbgl/gl')
-rw-r--r-- | src/mbgl/gl/gl_config.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/gl/gl_config.hpp | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/mbgl/gl/gl_config.cpp b/src/mbgl/gl/gl_config.cpp index 97d2f26f6c..9031c3d34f 100644 --- a/src/mbgl/gl/gl_config.cpp +++ b/src/mbgl/gl/gl_config.cpp @@ -20,7 +20,8 @@ const ClearColor::Type ClearColor::Default = { 0, 0, 0, 0 }; const ClearStencil::Type ClearStencil::Default = 0; const Program::Type Program::Default = 0; const LineWidth::Type LineWidth::Default = 1; -const ActiveTexture::Type ActiveTexture::Default = GL_TEXTURE0; +const ActiveTexture::Type ActiveTexture::Default = 0; +const BindTexture::Type BindTexture::Default = 0; #ifndef GL_ES_VERSION_2_0 const PixelZoom::Type PixelZoom::Default = { 1, 1 }; diff --git a/src/mbgl/gl/gl_config.hpp b/src/mbgl/gl/gl_config.hpp index 9d7dfb3b6c..41bee8fab7 100644 --- a/src/mbgl/gl/gl_config.hpp +++ b/src/mbgl/gl/gl_config.hpp @@ -13,13 +13,17 @@ template <typename T> class Value { public: void operator=(const typename T::Type& value) { - if (dirty || current != value) { + if (*this != value) { dirty = false; current = value; T::Set(current); } } + bool operator!=(const typename T::Type& value) const { + return dirty || current != value; + } + void reset() { *this = T::Default; } @@ -28,11 +32,11 @@ public: dirty = true; } - typename T::Type getCurrent() { + typename T::Type getCurrent() const { return current; } - bool getDirty() { + bool getDirty() const { return dirty; } @@ -115,6 +119,7 @@ public: Value<PixelZoom> pixelZoom; Value<RasterPos> rasterPos; #endif // GL_ES_VERSION_2_0 + std::array<Value<BindTexture>, 2> texture; }; } // namespace gl |