summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mbgl/geometry/line_atlas.cpp2
-rw-r--r--src/mbgl/gfx/attribute.hpp2
-rw-r--r--src/mbgl/gfx/context.hpp30
-rw-r--r--src/mbgl/gfx/draw_scope.hpp11
-rw-r--r--src/mbgl/gfx/index_buffer.hpp15
-rw-r--r--src/mbgl/gfx/texture.hpp13
-rw-r--r--src/mbgl/gfx/vertex_buffer.hpp15
-rw-r--r--src/mbgl/gl/context.cpp45
-rw-r--r--src/mbgl/gl/context.hpp12
-rw-r--r--src/mbgl/gl/program.hpp2
-rw-r--r--src/mbgl/gl/vertex_array.cpp2
-rw-r--r--src/mbgl/renderer/image_manager.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp4
-rw-r--r--src/mbgl/renderer/layers/render_fill_layer.cpp4
-rw-r--r--src/mbgl/renderer/layers/render_heatmap_layer.cpp4
-rw-r--r--src/mbgl/renderer/layers/render_hillshade_layer.cpp6
-rw-r--r--src/mbgl/renderer/layers/render_line_layer.cpp4
-rw-r--r--src/mbgl/renderer/layers/render_raster_layer.cpp12
-rw-r--r--src/mbgl/renderer/layers/render_symbol_layer.cpp4
-rw-r--r--test/util/offscreen_texture.test.cpp2
20 files changed, 117 insertions, 74 deletions
diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp
index 5f9acab0e8..a3c1c9abce 100644
--- a/src/mbgl/geometry/line_atlas.cpp
+++ b/src/mbgl/geometry/line_atlas.cpp
@@ -138,7 +138,7 @@ void LineAtlas::upload(gfx::Context& context) {
gfx::TextureBinding LineAtlas::textureBinding(gfx::Context& context) {
upload(context);
- return { *texture->resource, gfx::TextureFilterType::Linear, gfx::TextureMipMapType::No,
+ return { texture->getResource(), gfx::TextureFilterType::Linear, gfx::TextureMipMapType::No,
gfx::TextureWrapType::Repeat, gfx::TextureWrapType::Clamp };
}
diff --git a/src/mbgl/gfx/attribute.hpp b/src/mbgl/gfx/attribute.hpp
index f5188ccfdb..ecb2b5e1b2 100644
--- a/src/mbgl/gfx/attribute.hpp
+++ b/src/mbgl/gfx/attribute.hpp
@@ -250,7 +250,7 @@ AttributeBinding attributeBinding(const VertexBuffer<detail::VertexType<As...>>&
return {
Descriptor::data.attributes[I],
Descriptor::data.stride,
- buffer.resource.get(),
+ &buffer.getResource(),
0,
};
}
diff --git a/src/mbgl/gfx/context.hpp b/src/mbgl/gfx/context.hpp
index 06a59fd238..1ce00f04d1 100644
--- a/src/mbgl/gfx/context.hpp
+++ b/src/mbgl/gfx/context.hpp
@@ -51,7 +51,7 @@ public:
template <class Vertex>
void updateVertexBuffer(VertexBuffer<Vertex>& buffer, VertexVector<Vertex>&& v) {
assert(v.elements() == buffer.elements);
- updateVertexBufferResource(*buffer.resource, v.data(), v.bytes());
+ updateVertexBufferResource(buffer.getResource(), v.data(), v.bytes());
}
template <class DrawMode>
@@ -63,19 +63,19 @@ public:
template <class DrawMode>
void updateIndexBuffer(IndexBuffer& buffer, IndexVector<DrawMode>&& v) {
assert(v.elements() == buffer.elements);
- updateIndexBufferResource(*buffer.resource, v.data(), v.bytes());
+ updateIndexBufferResource(buffer.getResource(), v.data(), v.bytes());
}
protected:
- virtual std::unique_ptr<const VertexBufferResource>
+ virtual std::unique_ptr<VertexBufferResource>
createVertexBufferResource(const void* data, std::size_t size, const BufferUsageType) = 0;
virtual void
- updateVertexBufferResource(const VertexBufferResource&, const void* data, std::size_t size) = 0;
+ updateVertexBufferResource(VertexBufferResource&, const void* data, std::size_t size) = 0;
- virtual std::unique_ptr<const IndexBufferResource>
+ virtual std::unique_ptr<IndexBufferResource>
createIndexBufferResource(const void* data, std::size_t size, const BufferUsageType) = 0;
virtual void
- updateIndexBufferResource(const IndexBufferResource&, const void* data, std::size_t size) = 0;
+ updateIndexBufferResource(IndexBufferResource&, const void* data, std::size_t size) = 0;
public:
// Create a texture from an image with data.
@@ -99,28 +99,28 @@ public:
const Image& image,
TextureChannelDataType type = TextureChannelDataType::UnsignedByte) {
auto format = image.channels == 4 ? TexturePixelType::RGBA : TexturePixelType::Alpha;
- updateTextureResource(*texture.resource, image.size, image.data.get(), format, type);
+ updateTextureResource(texture.getResource(), image.size, image.data.get(), format, type);
texture.size = image.size;
}
template <typename Image>
void updateTextureSub(Texture& texture,
- const Image& image,
- const uint16_t offsetX,
- const uint16_t offsetY,
- TextureChannelDataType type = TextureChannelDataType::UnsignedByte) {
+ const Image& image,
+ const uint16_t offsetX,
+ const uint16_t offsetY,
+ TextureChannelDataType type = TextureChannelDataType::UnsignedByte) {
assert(image.size.width + offsetX <= texture.size.width);
assert(image.size.height + offsetY <= texture.size.height);
auto format = image.channels == 4 ? TexturePixelType::RGBA : TexturePixelType::Alpha;
- updateTextureResourceSub(*texture.resource, offsetX, offsetY, image.size, image.data.get(), format, type);
+ updateTextureResourceSub(texture.getResource(), offsetX, offsetY, image.size, image.data.get(), format, type);
}
protected:
virtual std::unique_ptr<TextureResource> createTextureResource(
Size, const void* data, TexturePixelType, TextureChannelDataType) = 0;
- virtual void updateTextureResource(const TextureResource&, Size, const void* data,
+ virtual void updateTextureResource(TextureResource&, Size, const void* data,
TexturePixelType, TextureChannelDataType) = 0;
- virtual void updateTextureResourceSub(const TextureResource&, uint16_t xOffset, uint16_t yOffset, Size, const void* data,
+ virtual void updateTextureResourceSub(TextureResource&, uint16_t xOffset, uint16_t yOffset, Size, const void* data,
TexturePixelType, TextureChannelDataType) = 0;
public:
@@ -136,7 +136,7 @@ protected:
public:
DrawScope createDrawScope() {
- return { createDrawScopeResource() };
+ return DrawScope{ createDrawScopeResource() };
}
protected:
diff --git a/src/mbgl/gfx/draw_scope.hpp b/src/mbgl/gfx/draw_scope.hpp
index 60aae7a44c..5cdb588317 100644
--- a/src/mbgl/gfx/draw_scope.hpp
+++ b/src/mbgl/gfx/draw_scope.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <memory>
+#include <cassert>
namespace mbgl {
namespace gfx {
@@ -14,6 +15,16 @@ public:
class DrawScope {
public:
+ explicit DrawScope(std::unique_ptr<DrawScopeResource> resource_) : resource(std::move(resource_)) {
+ }
+
+ template <typename T = DrawScopeResource>
+ T& getResource() const {
+ assert(resource);
+ return static_cast<T&>(*resource);
+ }
+
+protected:
std::unique_ptr<DrawScopeResource> resource;
};
diff --git a/src/mbgl/gfx/index_buffer.hpp b/src/mbgl/gfx/index_buffer.hpp
index ede949764f..60f361b497 100644
--- a/src/mbgl/gfx/index_buffer.hpp
+++ b/src/mbgl/gfx/index_buffer.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <memory>
+#include <cassert>
namespace mbgl {
namespace gfx {
@@ -14,8 +15,20 @@ public:
class IndexBuffer {
public:
+ IndexBuffer(const std::size_t elements_, std::unique_ptr<IndexBufferResource>&& resource_)
+ : elements(elements_), resource(std::move(resource_)) {
+ }
+
std::size_t elements;
- std::unique_ptr<const IndexBufferResource> resource;
+
+ template <typename T = IndexBufferResource>
+ T& getResource() const {
+ assert(resource);
+ return static_cast<T&>(*resource);
+ }
+
+protected:
+ std::unique_ptr<IndexBufferResource> resource;
};
} // namespace gfx
diff --git a/src/mbgl/gfx/texture.hpp b/src/mbgl/gfx/texture.hpp
index a957c4ebdf..00e94a8f6c 100644
--- a/src/mbgl/gfx/texture.hpp
+++ b/src/mbgl/gfx/texture.hpp
@@ -6,6 +6,7 @@
#include <mbgl/util/indexed_tuple.hpp>
#include <memory>
+#include <cassert>
#define MBGL_DEFINE_TEXTURE(name_) \
struct name_ { \
@@ -27,11 +28,19 @@ public:
class Texture {
public:
- Texture(Size size_, std::unique_ptr<TextureResource>&& resource_)
- : size(std::move(size_)), resource(std::move(resource_)) {
+ Texture(const Size size_, std::unique_ptr<TextureResource>&& resource_)
+ : size(size_), resource(std::move(resource_)) {
+ }
+
+ template <typename T = TextureResource>
+ T& getResource() const {
+ assert(resource);
+ return static_cast<T&>(*resource);
}
Size size;
+
+protected:
std::unique_ptr<TextureResource> resource;
};
diff --git a/src/mbgl/gfx/vertex_buffer.hpp b/src/mbgl/gfx/vertex_buffer.hpp
index 2ed1e62759..fe98ec6505 100644
--- a/src/mbgl/gfx/vertex_buffer.hpp
+++ b/src/mbgl/gfx/vertex_buffer.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <memory>
+#include <cassert>
namespace mbgl {
namespace gfx {
@@ -17,8 +18,20 @@ public:
template <class>
class VertexBuffer {
public:
+ VertexBuffer(const std::size_t elements_, std::unique_ptr<VertexBufferResource>&& resource_)
+ : elements(elements_), resource(std::move(resource_)) {
+ }
+
std::size_t elements;
- std::unique_ptr<const VertexBufferResource> resource;
+
+ template <typename T = VertexBufferResource>
+ T& getResource() const {
+ assert(resource);
+ return static_cast<T&>(*resource);
+ }
+
+protected:
+ std::unique_ptr<VertexBufferResource> resource;
};
} // namespace gfx
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index bc93042e25..f4e565c766 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -220,7 +220,7 @@ void Context::verifyProgramLinkage(ProgramID program_) {
throw std::runtime_error("program failed to link");
}
-std::unique_ptr<const gfx::VertexBufferResource>
+std::unique_ptr<gfx::VertexBufferResource>
Context::createVertexBufferResource(const void* data, std::size_t size, const gfx::BufferUsageType usage) {
BufferID id = 0;
MBGL_CHECK_ERROR(glGenBuffers(1, &id));
@@ -230,12 +230,12 @@ Context::createVertexBufferResource(const void* data, std::size_t size, const gf
return std::make_unique<gl::VertexBufferResource>(std::move(result));
}
-void Context::updateVertexBufferResource(const gfx::VertexBufferResource& resource, const void* data, std::size_t size) {
- vertexBuffer = reinterpret_cast<const gl::VertexBufferResource&>(resource).buffer;
+void Context::updateVertexBufferResource(gfx::VertexBufferResource& resource, const void* data, std::size_t size) {
+ vertexBuffer = static_cast<gl::VertexBufferResource&>(resource).buffer;
MBGL_CHECK_ERROR(glBufferSubData(GL_ARRAY_BUFFER, 0, size, data));
}
-std::unique_ptr<const gfx::IndexBufferResource>
+std::unique_ptr<gfx::IndexBufferResource>
Context::createIndexBufferResource(const void* data, std::size_t size, const gfx::BufferUsageType usage) {
BufferID id = 0;
MBGL_CHECK_ERROR(glGenBuffers(1, &id));
@@ -246,11 +246,11 @@ Context::createIndexBufferResource(const void* data, std::size_t size, const gfx
return std::make_unique<gl::IndexBufferResource>(std::move(result));
}
-void Context::updateIndexBufferResource(const gfx::IndexBufferResource& resource, const void* data, std::size_t size) {
+void Context::updateIndexBufferResource(gfx::IndexBufferResource& resource, const void* data, std::size_t size) {
// Be sure to unbind any existing vertex array object before binding the index buffer
// so that we don't mess up another VAO
bindVertexArray = 0;
- globalVertexArrayState.indexBuffer = reinterpret_cast<const gl::IndexBufferResource&>(resource).buffer;
+ globalVertexArrayState.indexBuffer = static_cast<gl::IndexBufferResource&>(resource).buffer;
MBGL_CHECK_ERROR(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, size, data));
}
@@ -470,9 +470,8 @@ Context::createFramebuffer(const gfx::Texture& color,
}
auto fbo = createFramebuffer();
bindFramebuffer = fbo;
- MBGL_CHECK_ERROR(glFramebufferTexture2D(
- GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
- reinterpret_cast<const gl::TextureResource&>(*color.resource).texture, 0));
+ MBGL_CHECK_ERROR(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ color.getResource<gl::TextureResource>().texture, 0));
bindDepthStencilRenderbuffer(depthStencil);
checkFramebuffer();
return { color.size, std::move(fbo) };
@@ -481,9 +480,8 @@ Context::createFramebuffer(const gfx::Texture& color,
Framebuffer Context::createFramebuffer(const gfx::Texture& color) {
auto fbo = createFramebuffer();
bindFramebuffer = fbo;
- MBGL_CHECK_ERROR(glFramebufferTexture2D(
- GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
- reinterpret_cast<const gl::TextureResource&>(*color.resource).texture, 0));
+ MBGL_CHECK_ERROR(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ color.getResource<gl::TextureResource>().texture, 0));
checkFramebuffer();
return { color.size, std::move(fbo) };
}
@@ -496,9 +494,8 @@ Context::createFramebuffer(const gfx::Texture& color,
}
auto fbo = createFramebuffer();
bindFramebuffer = fbo;
- MBGL_CHECK_ERROR(glFramebufferTexture2D(
- GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
- reinterpret_cast<const gl::TextureResource&>(*color.resource).texture, 0));
+ MBGL_CHECK_ERROR(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ color.getResource<gl::TextureResource>().texture, 0));
auto& depthResource = depth.getResource<gl::RenderbufferResource>();
MBGL_CHECK_ERROR(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER,
@@ -525,27 +522,27 @@ Context::createTextureResource(const Size size,
return resource;
}
-void Context::updateTextureResource(const gfx::TextureResource& resource,
+void Context::updateTextureResource(gfx::TextureResource& resource,
const Size size,
const void* data,
gfx::TexturePixelType format,
gfx::TextureChannelDataType type) {
// Always use texture unit 0 for manipulating it.
activeTextureUnit = 0;
- texture[0] = reinterpret_cast<const gl::TextureResource&>(resource).texture;
+ texture[0] = static_cast<gl::TextureResource&>(resource).texture;
MBGL_CHECK_ERROR(glTexImage2D(GL_TEXTURE_2D, 0, Enum<gfx::TexturePixelType>::to(format),
size.width, size.height, 0,
Enum<gfx::TexturePixelType>::to(format),
Enum<gfx::TextureChannelDataType>::to(type), data));
}
-void Context::updateTextureResourceSub(const gfx::TextureResource& resource,
- const uint16_t xOffset,
- const uint16_t yOffset,
- const Size size,
- const void* data,
- gfx::TexturePixelType format,
- gfx::TextureChannelDataType type) {
+void Context::updateTextureResourceSub(gfx::TextureResource& resource,
+ const uint16_t xOffset,
+ const uint16_t yOffset,
+ const Size size,
+ const void* data,
+ gfx::TexturePixelType format,
+ gfx::TextureChannelDataType type) {
// Always use texture unit 0 for manipulating it.
activeTextureUnit = 0;
texture[0] = static_cast<const gl::TextureResource&>(resource).texture;
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index d09bf7522e..530ff1c73f 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -192,14 +192,14 @@ private:
State<value::PointSize> pointSize;
#endif // MBGL_USE_GLES2
- std::unique_ptr<const gfx::VertexBufferResource> createVertexBufferResource(const void* data, std::size_t size, const gfx::BufferUsageType) override;
- void updateVertexBufferResource(const gfx::VertexBufferResource&, const void* data, std::size_t size) override;
- std::unique_ptr<const gfx::IndexBufferResource> createIndexBufferResource(const void* data, std::size_t size, const gfx::BufferUsageType) override;
- void updateIndexBufferResource(const gfx::IndexBufferResource&, const void* data, std::size_t size) override;
+ std::unique_ptr<gfx::VertexBufferResource> createVertexBufferResource(const void* data, std::size_t size, const gfx::BufferUsageType) override;
+ void updateVertexBufferResource(gfx::VertexBufferResource&, const void* data, std::size_t size) override;
+ std::unique_ptr<gfx::IndexBufferResource> createIndexBufferResource(const void* data, std::size_t size, const gfx::BufferUsageType) override;
+ void updateIndexBufferResource(gfx::IndexBufferResource&, const void* data, std::size_t size) override;
std::unique_ptr<gfx::TextureResource> createTextureResource(Size, const void* data, gfx::TexturePixelType, gfx::TextureChannelDataType) override;
- void updateTextureResource(const gfx::TextureResource&, Size, const void* data, gfx::TexturePixelType, gfx::TextureChannelDataType) override;
- void updateTextureResourceSub(const gfx::TextureResource&, const uint16_t xOffset, const uint16_t yOffset, Size, const void* data, gfx::TexturePixelType, gfx::TextureChannelDataType) override;
+ void updateTextureResource(gfx::TextureResource&, Size, const void* data, gfx::TexturePixelType, gfx::TextureChannelDataType) override;
+ void updateTextureResourceSub(gfx::TextureResource&, const uint16_t xOffset, const uint16_t yOffset, Size, const void* data, gfx::TexturePixelType, gfx::TextureChannelDataType) override;
std::unique_ptr<gfx::RenderbufferResource> createRenderbufferResource(gfx::RenderbufferPixelType, Size size) override;
diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp
index 92747e60c4..023b738b93 100644
--- a/src/mbgl/gl/program.hpp
+++ b/src/mbgl/gl/program.hpp
@@ -194,7 +194,7 @@ public:
instance.textureStates.bind(context, textureBindings);
- auto& vertexArray = static_cast<gl::DrawScopeResource&>(*drawScope.resource).vertexArray;
+ auto& vertexArray = drawScope.getResource<gl::DrawScopeResource>().vertexArray;
vertexArray.bind(context,
indexBuffer,
instance.attributeLocations.toBindingArray(attributeBindings));
diff --git a/src/mbgl/gl/vertex_array.cpp b/src/mbgl/gl/vertex_array.cpp
index 445ff37e12..831b118fce 100644
--- a/src/mbgl/gl/vertex_array.cpp
+++ b/src/mbgl/gl/vertex_array.cpp
@@ -9,7 +9,7 @@ void VertexArray::bind(Context& context,
const gfx::IndexBuffer& indexBuffer,
const AttributeBindingArray& bindings) {
context.bindVertexArray = state->vertexArray;
- state->indexBuffer = reinterpret_cast<const gl::IndexBufferResource&>(*indexBuffer.resource).buffer;
+ state->indexBuffer = indexBuffer.getResource<gl::IndexBufferResource>().buffer;
state->bindings.reserve(bindings.size());
for (AttributeLocation location = 0; location < bindings.size(); ++location) {
diff --git a/src/mbgl/renderer/image_manager.cpp b/src/mbgl/renderer/image_manager.cpp
index d2994d6f2d..f8f3e30f81 100644
--- a/src/mbgl/renderer/image_manager.cpp
+++ b/src/mbgl/renderer/image_manager.cpp
@@ -259,7 +259,7 @@ void ImageManager::upload(gfx::Context& context) {
gfx::TextureBinding ImageManager::textureBinding(gfx::Context& context) {
upload(context);
- return { *atlasTexture->resource, gfx::TextureFilterType::Linear };
+ return { atlasTexture->getResource(), gfx::TextureFilterType::Linear };
}
} // namespace mbgl
diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
index 2c9fac0131..39eb6f151d 100644
--- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
@@ -162,7 +162,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
patternPosA,
patternPosB,
FillExtrusionPatternProgram::TextureBindings{
- textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear },
+ textures::image::Value{ geometryTile.iconAtlasTexture->getResource(), gfx::TextureFilterType::Linear },
}
);
}
@@ -209,7 +209,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
allUniformValues,
allAttributeBindings,
ExtrusionTextureProgram::TextureBindings{
- textures::image::Value{ *renderTexture->getTexture().resource },
+ textures::image::Value{ renderTexture->getTexture().getResource() },
},
getID());
}
diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp
index 10c3df762a..d2ff5841ec 100644
--- a/src/mbgl/renderer/layers/render_fill_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_layer.cpp
@@ -215,7 +215,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
*bucket.triangleIndexBuffer,
bucket.triangleSegments,
FillPatternProgram::TextureBindings{
- textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear },
+ textures::image::Value{ geometryTile.iconAtlasTexture->getResource(), gfx::TextureFilterType::Linear },
});
if (evaluated.get<FillAntialias>() && unevaluated.get<FillOutlineColor>().isUndefined()) {
@@ -225,7 +225,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
*bucket.lineIndexBuffer,
bucket.lineSegments,
FillOutlinePatternProgram::TextureBindings{
- textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear },
+ textures::image::Value{ geometryTile.iconAtlasTexture->getResource(), gfx::TextureFilterType::Linear },
});
}
}
diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp
index 99f0e4d432..c720709e28 100644
--- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp
+++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp
@@ -177,8 +177,8 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
allUniformValues,
allAttributeBindings,
HeatmapTextureProgram::TextureBindings{
- textures::image::Value{ *renderTexture->getTexture().resource, gfx::TextureFilterType::Linear },
- textures::color_ramp::Value{ *colorRampTexture->resource, gfx::TextureFilterType::Linear },
+ textures::image::Value{ renderTexture->getTexture().getResource(), gfx::TextureFilterType::Linear },
+ textures::color_ramp::Value{ colorRampTexture->getResource(), gfx::TextureFilterType::Linear },
},
getID()
);
diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp
index 1d030f5946..527d48f654 100644
--- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp
+++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp
@@ -169,7 +169,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
allUniformValues,
allAttributeBindings,
HillshadePrepareProgram::TextureBindings{
- textures::image::Value{ *bucket.dem->resource },
+ textures::image::Value{ bucket.dem->getResource() },
},
getID()
);
@@ -186,7 +186,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
bucket.segments,
tile.id,
HillshadeProgram::TextureBindings{
- textures::image::Value{ *bucket.texture->resource, gfx::TextureFilterType::Linear },
+ textures::image::Value{ bucket.texture->getResource(), gfx::TextureFilterType::Linear },
});
} else {
// Draw the full tile.
@@ -196,7 +196,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
parameters.staticData.rasterSegments,
tile.id,
HillshadeProgram::TextureBindings{
- textures::image::Value{ *bucket.texture->resource, gfx::TextureFilterType::Linear },
+ textures::image::Value{ bucket.texture->getResource(), gfx::TextureFilterType::Linear },
});
}
}
diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp
index 2d246df7f4..dbc1fa2f3e 100644
--- a/src/mbgl/renderer/layers/render_line_layer.cpp
+++ b/src/mbgl/renderer/layers/render_line_layer.cpp
@@ -143,7 +143,7 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) {
posA,
posB,
LinePatternProgram::TextureBindings{
- textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear },
+ textures::image::Value{ geometryTile.iconAtlasTexture->getResource(), gfx::TextureFilterType::Linear },
});
} else if (!unevaluated.get<LineGradient>().getValue().isUndefined()) {
if (!colorRampTexture) {
@@ -159,7 +159,7 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) {
{},
{},
LineGradientProgram::TextureBindings{
- textures::image::Value{ *colorRampTexture->resource, gfx::TextureFilterType::Linear },
+ textures::image::Value{ colorRampTexture->getResource(), gfx::TextureFilterType::Linear },
});
} else {
draw(parameters.programs.getLineLayerPrograms().line,
diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp
index 94c4a8dc42..09aa94800f 100644
--- a/src/mbgl/renderer/layers/render_raster_layer.cpp
+++ b/src/mbgl/renderer/layers/render_raster_layer.cpp
@@ -137,8 +137,8 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
*bucket.indexBuffer,
bucket.segments,
RasterProgram::TextureBindings{
- textures::image0::Value{ *bucket.texture->resource, filter },
- textures::image1::Value{ *bucket.texture->resource, filter },
+ textures::image0::Value{ bucket.texture->getResource(), filter },
+ textures::image1::Value{ bucket.texture->getResource(), filter },
});
}
}
@@ -161,8 +161,8 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
*bucket.indexBuffer,
bucket.segments,
RasterProgram::TextureBindings{
- textures::image0::Value{ *bucket.texture->resource, filter },
- textures::image1::Value{ *bucket.texture->resource, filter },
+ textures::image0::Value{ bucket.texture->getResource(), filter },
+ textures::image1::Value{ bucket.texture->getResource(), filter },
});
} else {
// Draw the full tile.
@@ -171,8 +171,8 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
parameters.staticData.quadTriangleIndexBuffer,
parameters.staticData.rasterSegments,
RasterProgram::TextureBindings{
- textures::image0::Value{ *bucket.texture->resource, filter },
- textures::image1::Value{ *bucket.texture->resource, filter },
+ textures::image0::Value{ bucket.texture->getResource(), filter },
+ textures::image1::Value{ bucket.texture->getResource(), filter },
});
}
}
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp
index d7951c647a..313a86539e 100644
--- a/src/mbgl/renderer/layers/render_symbol_layer.cpp
+++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp
@@ -171,7 +171,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
const bool iconScaled = layout.get<IconSize>().constantOr(1.0) != 1.0 || bucket.iconsNeedLinear;
const bool iconTransformed = values.rotationAlignment == AlignmentType::Map || parameters.state.getPitch() != 0;
- const gfx::TextureBinding textureBinding{ *geometryTile.iconAtlasTexture->resource,
+ const gfx::TextureBinding textureBinding{ geometryTile.iconAtlasTexture->getResource(),
bucket.sdfIcons ||
parameters.state.isChanging() ||
iconScaled || iconTransformed
@@ -221,7 +221,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
}
if (bucket.hasTextData()) {
- const gfx::TextureBinding textureBinding{ *geometryTile.glyphAtlasTexture->resource,
+ const gfx::TextureBinding textureBinding{ geometryTile.glyphAtlasTexture->getResource(),
gfx::TextureFilterType::Linear };
auto values = textPropertyValues(evaluated_, layout);
diff --git a/test/util/offscreen_texture.test.cpp b/test/util/offscreen_texture.test.cpp
index 986ec39bc1..0f24c1e9af 100644
--- a/test/util/offscreen_texture.test.cpp
+++ b/test/util/offscreen_texture.test.cpp
@@ -159,7 +159,7 @@ void main() {
test::checkImage("test/fixtures/offscreen_texture/render-to-fbo", image, 0, 0);
// Now, composite the Framebuffer texture we've rendered to onto the main FBO.
- gl::bindTexture(context, 0, { *texture.getTexture().resource, gfx::TextureFilterType::Linear });
+ gl::bindTexture(context, 0, { texture.getTexture().getResource(), gfx::TextureFilterType::Linear });
MBGL_CHECK_ERROR(glUseProgram(compositeShader.program));
MBGL_CHECK_ERROR(glUniform1i(u_texture, 0));
MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, viewportBuffer.buffer));