summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-03-20 16:24:36 +0100
committerKonstantin Käfer <mail@kkaefer.com>2019-04-05 11:49:17 +0200
commit5270b2ffbd4fca75f93e7052bd928ebed3ea272a (patch)
treeb4f47c29e428b418d94f482c2bfb3448e467b01f
parent394e2aa7171943b7b0be77be7b19bc4a97c36905 (diff)
downloadqtlocation-mapboxgl-5270b2ffbd4fca75f93e7052bd928ebed3ea272a.tar.gz
[core] move supportsHalfFloatTextures to gfx::Context
-rw-r--r--src/mbgl/gfx/context.hpp1
-rw-r--r--src/mbgl/gl/context.hpp2
-rw-r--r--src/mbgl/renderer/layers/render_heatmap_layer.cpp12
3 files changed, 6 insertions, 9 deletions
diff --git a/src/mbgl/gfx/context.hpp b/src/mbgl/gfx/context.hpp
index f9b7789696..fcce2d3070 100644
--- a/src/mbgl/gfx/context.hpp
+++ b/src/mbgl/gfx/context.hpp
@@ -26,6 +26,7 @@ public:
const ContextType backend;
static constexpr const uint32_t minimumRequiredVertexBindingCount = 8;
const uint32_t maximumVertexBindingCount;
+ bool supportsHalfFloatTextures = false;
public:
Context(Context&&) = delete;
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index a676c72f06..74ea2c076e 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -166,8 +166,6 @@ public:
State<value::PixelTransferStencil> pixelTransferStencil;
#endif // MBGL_USE_GLES2
- bool supportsHalfFloatTextures = false;
-
private:
State<value::StencilFunc> stencilFunc;
State<value::StencilMask> stencilMask;
diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp
index 88a81ca494..99f0e4d432 100644
--- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp
+++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp
@@ -52,15 +52,12 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
return;
}
- // TODO: remove cast
- gl::Context& glContext = static_cast<gl::Context&>(parameters.context);
-
if (parameters.pass == RenderPass::Pass3D) {
const auto& viewportSize = parameters.staticData.backendSize;
const auto size = Size{viewportSize.width / 4, viewportSize.height / 4};
if (!renderTexture || renderTexture->getSize() != size) {
- if (glContext.supportsHalfFloatTextures) {
+ if (parameters.context.supportsHalfFloatTextures) {
renderTexture = OffscreenTexture(parameters.context, size, gfx::TextureChannelDataType::HalfFloat);
try {
@@ -68,11 +65,11 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
} catch (const std::runtime_error& ex) {
// can't render to a half-float texture; falling back to unsigned byte one
renderTexture = nullopt;
- glContext.supportsHalfFloatTextures = false;
+ parameters.context.supportsHalfFloatTextures = false;
}
}
- if (!glContext.supportsHalfFloatTextures || !renderTexture) {
+ if (!parameters.context.supportsHalfFloatTextures || !renderTexture) {
renderTexture = OffscreenTexture(parameters.context, size, gfx::TextureChannelDataType::UnsignedByte);
renderTexture->bind();
}
@@ -85,7 +82,8 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
colorRampTexture = parameters.context.createTexture(colorRamp, gfx::TextureChannelDataType::UnsignedByte);
}
- glContext.clear(Color{ 0.0f, 0.0f, 0.0f, 1.0f }, {}, {});
+ // TODO: remove cast
+ static_cast<gl::Context&>(parameters.context).clear(Color{ 0.0f, 0.0f, 0.0f, 1.0f }, {}, {});
for (const RenderTile& tile : renderTiles) {
auto bucket_ = tile.tile.getBucket<HeatmapBucket>(*baseImpl);