diff options
author | Aleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com> | 2019-08-28 15:29:59 +0300 |
---|---|---|
committer | Aleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com> | 2019-08-30 11:18:55 +0300 |
commit | 4ba1270dcc0a51c7c68be2bfbac283ee76ea8680 (patch) | |
tree | c10bd5ea423888f77bf82c5d9ca55e322b290ed8 /src/mbgl/geometry/dem_data.hpp | |
parent | 6ef2710e5cfb5ee4258583a20d55320e90faa8a5 (diff) | |
download | qtlocation-mapboxgl-4ba1270dcc0a51c7c68be2bfbac283ee76ea8680.tar.gz |
[core] DEMData: do decode on GPU (port mapbox/mapbox-gl-js#8694)
This is first part of work on porting mapbox/mapbox-gl-js#8694 - in follow up patch(es) it is required to remove CPU side copy using 2d canvas support on all supported platforms, similar to approach taken in gl.js https://github.com/mapbox/mapbox-gl-js/pull/8694/files#diff-34dbe5f7de34dc4b9a8745dcde9bdc37R48
Decoding on CPU removed.
Padding is still done in DEMData() but, instead od doing it wwhile decoding, it is using memcpy to pad original values.
Rebase to latest mapbox-gl-js master and re-generate shaders.
Partly fixes: #15503
Diffstat (limited to 'src/mbgl/geometry/dem_data.hpp')
-rw-r--r-- | src/mbgl/geometry/dem_data.hpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/mbgl/geometry/dem_data.hpp b/src/mbgl/geometry/dem_data.hpp index 21146bc468..537575873f 100644 --- a/src/mbgl/geometry/dem_data.hpp +++ b/src/mbgl/geometry/dem_data.hpp @@ -16,13 +16,8 @@ public: DEMData(const PremultipliedImage& image, Tileset::DEMEncoding encoding); void backfillBorder(const DEMData& borderTileData, int8_t dx, int8_t dy); - void set(const int32_t x, const int32_t y, const int32_t value) { - reinterpret_cast<int32_t*>(image.data.get())[idx(x, y)] = value + 65536; - } - - int32_t get(const int32_t x, const int32_t y) const { - return reinterpret_cast<const int32_t*>(image.data.get())[idx(x, y)] - 65536; - } + int32_t get(const int32_t x, const int32_t y) const; + const std::array<float, 4>& getUnpackVector() const; const PremultipliedImage* getImage() const { return ℑ @@ -32,16 +27,17 @@ public: const int32_t stride; - private: - PremultipliedImage image; +private: + Tileset::DEMEncoding encoding; + PremultipliedImage image; - size_t idx(const int32_t x, const int32_t y) const { - assert(x >= -1); - assert(x < dim + 1); - assert(y >= -1); - assert(y < dim + 1); - return (y + 1) * stride + (x + 1); - } + size_t idx(const int32_t x, const int32_t y) const { + assert(x >= -1); + assert(x < dim + 1); + assert(y >= -1); + assert(y < dim + 1); + return (y + 1) * stride + (x + 1); + } }; |