Clean more legacy code (#3478)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Alex Cristici
2025-05-16 19:29:25 +03:00
committed by GitHub
parent 2538ac1f31
commit b585b0086f
108 changed files with 212 additions and 937 deletions

View File

@@ -1,6 +1,5 @@
#pragma once
#include <mbgl/gfx/texture.hpp>
#include <mbgl/gfx/context.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/gfx/texture2d.hpp>

View File

@@ -4,7 +4,7 @@
#include <mbgl/gfx/index_vector.hpp>
#include <mbgl/gfx/vertex_attribute.hpp>
#include <mbgl/gfx/vertex_vector.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/gfx/drawable_builder.hpp>
#include <mbgl/gfx/polyline_generator.hpp>
#include <mbgl/shaders/widevector_ubo.hpp>

View File

@@ -1,58 +0,0 @@
#pragma once
#include <cstddef>
namespace mbgl {
namespace gfx {
class Context;
class DrawMode;
class DepthMode;
class StencilMode;
class ColorMode;
class CullFaceMode;
class DrawScope;
class IndexBuffer;
class RenderPass;
template <class>
class UniformValues;
template <class>
class AttributeBindings;
template <class>
class TextureBindings;
template <class Name>
class Program {
protected:
Program() = default;
public:
virtual ~Program() = default;
Program(Program&&) = delete;
Program(const Program&) = delete;
Program& operator=(Program&&) = delete;
Program& operator=(const Program&) = delete;
using AttributeList = typename Name::AttributeList;
using UniformList = typename Name::UniformList;
using TextureList = typename Name::TextureList;
virtual void draw(Context&,
RenderPass&,
const DrawMode&,
const DepthMode&,
const StencilMode&,
const ColorMode&,
const CullFaceMode&,
const UniformValues<UniformList>&,
DrawScope&,
const AttributeBindings<AttributeList>&,
const TextureBindings<TextureList>&,
const IndexBuffer&,
std::size_t indexOffset,
std::size_t indexLength) = 0;
};
} // namespace gfx
} // namespace mbgl

View File

@@ -1,86 +0,0 @@
#pragma once
#include <mbgl/gfx/types.hpp>
#include <mbgl/util/size.hpp>
#include <mbgl/util/type_list.hpp>
#include <mbgl/util/indexed_tuple.hpp>
#include <memory>
#include <cassert>
#define MBGL_DEFINE_TEXTURE(name_) \
struct name_ { \
using Value = ::mbgl::gfx::TextureBinding; \
static constexpr auto name() { \
return #name_; \
} \
}
namespace mbgl {
namespace gfx {
constexpr int32_t MaxActiveTextureUnits = 8;
class TextureResource {
protected:
TextureResource() = default;
public:
virtual ~TextureResource() = default;
};
class Texture {
public:
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);
}
const Size& getSize() const noexcept { return size; }
Size size;
protected:
std::unique_ptr<TextureResource> resource;
};
class TextureBinding {
public:
TextureBinding(TextureResource& resource_,
TextureFilterType filter_ = TextureFilterType::Nearest,
TextureMipMapType mipmap_ = TextureMipMapType::No,
TextureWrapType wrapX_ = TextureWrapType::Clamp,
TextureWrapType wrapY_ = TextureWrapType::Clamp)
: resource(&resource_),
filter(filter_),
mipmap(mipmap_),
wrapX(wrapX_),
wrapY(wrapY_) {}
TextureResource* resource;
TextureFilterType filter;
TextureMipMapType mipmap;
TextureWrapType wrapX;
TextureWrapType wrapY;
};
template <class>
class TextureBindings;
template <class... Ts>
class TextureBindings<TypeList<Ts...>> final
: public IndexedTuple<TypeList<Ts...>, TypeList<ExpandToType<Ts, TextureBinding>...>> {
using Base = IndexedTuple<TypeList<Ts...>, TypeList<ExpandToType<Ts, TextureBinding>...>>;
public:
template <class... Args>
TextureBindings(Args&&... args)
: Base(std::forward<Args>(args)...) {}
};
} // namespace gfx
} // namespace mbgl

View File

@@ -6,7 +6,6 @@
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/gfx/index_vector.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/gfx/texture.hpp>
#include <mbgl/util/size.hpp>
#include <mbgl/util/image.hpp>
@@ -97,51 +96,6 @@ public:
BufferUsageType,
bool persistent = false) = 0;
virtual void updateIndexBufferResource(IndexBufferResource&, const void* data, std::size_t size) = 0;
public:
// Create a texture from an image with data.
template <typename Image>
Texture createTexture(const Image& image, TextureChannelDataType type = TextureChannelDataType::UnsignedByte) {
auto format = image.channels == 4 ? TexturePixelType::RGBA : TexturePixelType::Alpha;
return {image.size, createTextureResource(image.size, image.data.get(), format, type)};
}
template <typename Image>
void updateTexture(Texture& texture,
const Image& image,
TextureChannelDataType type = TextureChannelDataType::UnsignedByte) {
const auto format = image.channels == 4 ? TexturePixelType::RGBA : TexturePixelType::Alpha;
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) {
assert(image.size.width + offsetX <= texture.size.width);
assert(image.size.height + offsetY <= texture.size.height);
const auto format = image.channels == 4 ? TexturePixelType::RGBA : TexturePixelType::Alpha;
updateTextureResourceSub(texture.getResource(), offsetX, offsetY, image.size, image.data.get(), format, type);
}
public:
virtual std::unique_ptr<TextureResource> createTextureResource(Size,
const void* data,
TexturePixelType,
TextureChannelDataType) = 0;
virtual void updateTextureResource(
TextureResource&, Size, const void* data, TexturePixelType, TextureChannelDataType) = 0;
virtual void updateTextureResourceSub(TextureResource&,
uint16_t xOffset,
uint16_t yOffset,
Size,
const void* data,
TexturePixelType,
TextureChannelDataType) = 0;
};
} // namespace gfx

View File

@@ -2,7 +2,7 @@
#include <mbgl/gfx/attribute.hpp>
#include <mbgl/gl/types.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/util/literal.hpp>
#include <vector>

View File

@@ -7,8 +7,6 @@
#include <mbgl/gl/enum.hpp>
#include <mbgl/gl/renderer_backend.hpp>
#include <mbgl/gl/renderbuffer_resource.hpp>
#include <mbgl/gl/texture_resource.hpp>
#include <mbgl/gl/texture.hpp>
#include <mbgl/gl/offscreen_texture.hpp>
#include <mbgl/gl/debugging_extension.hpp>
#include <mbgl/gl/timestamp_query_extension.hpp>
@@ -295,29 +293,6 @@ UniqueFramebuffer Context::createFramebuffer() {
return UniqueFramebuffer{std::move(id), {this}};
}
std::unique_ptr<gfx::TextureResource> Context::createTextureResource(const Size size,
const gfx::TexturePixelType format,
const gfx::TextureChannelDataType type) {
MLN_TRACE_FUNC();
auto obj = createUniqueTexture(size, format, type);
std::unique_ptr<gfx::TextureResource> resource = std::make_unique<gl::TextureResource>(std::move(obj));
// Always use texture unit 0 for manipulating it.
activeTextureUnit = 0;
texture[0] = static_cast<gl::TextureResource&>(*resource).texture;
// We are using clamp to edge here since OpenGL ES doesn't allow GL_REPEAT
// on NPOT textures. We use those when the pixelRatio isn't a power of two,
// e.g. on iPhone 6 Plus.
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
return resource;
}
std::unique_ptr<gfx::RenderbufferResource> Context::createRenderbufferResource(const gfx::RenderbufferPixelType type,
const Size size) {
MLN_TRACE_FUNC();
@@ -449,51 +424,6 @@ Framebuffer Context::createFramebuffer(const gfx::Renderbuffer<gfx::Renderbuffer
return {color.getSize(), std::move(fbo)};
}
Framebuffer Context::createFramebuffer(
const gfx::Texture& color, const gfx::Renderbuffer<gfx::RenderbufferPixelType::DepthStencil>& depthStencil) {
MLN_TRACE_FUNC();
if (color.size != depthStencil.getSize()) {
throw std::runtime_error("Renderbuffer size mismatch");
}
auto fbo = createFramebuffer();
bindFramebuffer = fbo;
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)};
}
Framebuffer Context::createFramebuffer(const gfx::Texture& color) {
MLN_TRACE_FUNC();
auto fbo = createFramebuffer();
bindFramebuffer = fbo;
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)};
}
Framebuffer Context::createFramebuffer(const gfx::Texture& color,
const gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>& depth) {
MLN_TRACE_FUNC();
if (color.size != depth.getSize()) {
throw std::runtime_error("Renderbuffer size mismatch");
}
auto fbo = createFramebuffer();
bindFramebuffer = fbo;
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, depthResource.renderbuffer));
checkFramebuffer();
return {depth.getSize(), std::move(fbo)};
}
std::unique_ptr<gfx::OffscreenTexture> Context::createOffscreenTexture(const Size size,
const gfx::TextureChannelDataType type) {
MLN_TRACE_FUNC();

View File

@@ -1,6 +1,5 @@
#pragma once
#include <mbgl/gfx/texture.hpp>
#include <mbgl/gfx/draw_mode.hpp>
#include <mbgl/gfx/depth_mode.hpp>
#include <mbgl/gfx/stencil_mode.hpp>
@@ -63,10 +62,6 @@ public:
Framebuffer createFramebuffer(const gfx::Renderbuffer<gfx::RenderbufferPixelType::RGBA>&,
const gfx::Renderbuffer<gfx::RenderbufferPixelType::DepthStencil>&);
Framebuffer createFramebuffer(const gfx::Renderbuffer<gfx::RenderbufferPixelType::RGBA>&);
Framebuffer createFramebuffer(const gfx::Texture&,
const gfx::Renderbuffer<gfx::RenderbufferPixelType::DepthStencil>&);
Framebuffer createFramebuffer(const gfx::Texture&);
Framebuffer createFramebuffer(const gfx::Texture&, const gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>&);
template <typename Image,
gfx::TexturePixelType format = Image::channels == 4 ? gfx::TexturePixelType::RGBA
@@ -211,9 +206,6 @@ private:
public:
std::unique_ptr<gfx::OffscreenTexture> createOffscreenTexture(Size, gfx::TextureChannelDataType) override;
std::unique_ptr<gfx::TextureResource> createTextureResource(Size,
gfx::TexturePixelType,
gfx::TextureChannelDataType) override;
private:
std::unique_ptr<gfx::RenderbufferResource> createRenderbufferResource(gfx::RenderbufferPixelType,

View File

@@ -5,7 +5,7 @@
#include <mbgl/gl/vertex_array.hpp>
#include <mbgl/gl/vertex_attribute_gl.hpp>
#include <mbgl/gl/vertex_buffer_resource.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/shaders/gl/shader_program_gl.hpp>
#include <mbgl/util/instrumentation.hpp>
#include <mbgl/util/logging.hpp>

View File

@@ -2,15 +2,13 @@
#include <mbgl/gfx/drawable_impl.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/gfx/program.hpp>
#include <mbgl/gfx/uniform.hpp>
#include <mbgl/gl/defines.hpp>
#include <mbgl/gl/enum.hpp>
#include <mbgl/gl/program.hpp>
#include <mbgl/gl/uniform_buffer_gl.hpp>
#include <mbgl/gl/vertex_array.hpp>
#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/util/mat4.hpp>

View File

@@ -8,6 +8,7 @@
#include <mbgl/util/logging.hpp>
#include <mbgl/shaders/gl/shader_group_gl.hpp>
#include <mbgl/shaders/gl/legacy/programs.hpp>
#include <cassert>
@@ -146,6 +147,10 @@ void RendererBackend::initShaders(gfx::ShaderRegistry& shaders, const ProgramPar
shaders::BuiltIn::SymbolIconShader,
shaders::BuiltIn::SymbolSDFShader,
shaders::BuiltIn::SymbolTextAndIconShader>(shaders, programParameters);
// Initialize legacy shader programs
Programs programs(programParameters);
programs.registerWith(shaders);
}
} // namespace gl

View File

@@ -6,7 +6,6 @@
#include <mbgl/gl/context.hpp>
#include <mbgl/gl/defines.hpp>
#include <mbgl/gl/enum.hpp>
#include <mbgl/gl/texture_resource.hpp>
#include <mbgl/util/hash.hpp>
#include <mbgl/util/instrumentation.hpp>
#include <mbgl/util/logging.hpp>
@@ -18,10 +17,6 @@ using namespace platform;
namespace {
size_t storageSize(const Texture2DDesc& desc) {
return static_cast<size_t>(TextureResource::getStorageSize(desc.size, desc.pixelFormat, desc.channelType));
}
#if !defined(NDEBUG)
void logDebugMessage(const std::string& message) {
Log::Debug(Event::General, "Texture2DPool: " + message);
@@ -32,6 +27,37 @@ void logDebugMessage(const std::string&) {}
} // namespace
size_t Texture2DDesc::channelCount() const {
switch (pixelFormat) {
case gfx::TexturePixelType::Alpha:
case gfx::TexturePixelType::Depth:
case gfx::TexturePixelType::Luminance:
case gfx::TexturePixelType::Stencil:
return 1;
case gfx::TexturePixelType::RGBA:
return 4;
default:
assert(!"Unknown texture pixel type");
return 0;
}
}
size_t Texture2DDesc::channelStorageSize() const {
switch (channelType) {
case gfx::TextureChannelDataType::HalfFloat:
return 2;
case gfx::TextureChannelDataType::UnsignedByte:
return 1;
default:
assert(!"Unknown texture channel data type");
return 0;
}
}
size_t Texture2DDesc::getStorageSize() const {
return size.width * size.height * channelCount() * channelStorageSize();
}
std::size_t Texture2DDescHash::operator()(const Texture2DDesc& desc) const {
std::size_t seed = 0;
util::hash_combine(seed, desc.size.width);
@@ -133,7 +159,7 @@ TextureID Texture2DPool::allocateGLMemory(const Texture2DDesc& desc) {
pool[desc].used.insert(id);
// Update poolStorage
auto storage = storageSize(desc);
auto storage = desc.getStorageSize();
poolStorage += storage;
context->renderingStats().memTextures += storage;
MLN_TRACE_ALLOC_TEXTURE(id, storage);
@@ -167,7 +193,7 @@ void Texture2DPool::freeAllocatedGLMemory(TextureID id) {
}
// Update poolStorage
auto storage = storageSize(desc);
auto storage = desc.getStorageSize();
poolStorage -= storage;
context->renderingStats().memTextures -= storage;
assert(context->renderingStats().memTextures >= 0);
@@ -224,7 +250,7 @@ bool Texture2DPool::isUnused(TextureID id) const {
size_t Texture2DPool::usedStorage() const {
size_t total = 0;
for (const auto& set : pool) {
total += storageSize(set.first) * set.second.used.size();
total += set.first.getStorageSize() * set.second.used.size();
}
return total;
}
@@ -232,7 +258,7 @@ size_t Texture2DPool::usedStorage() const {
size_t Texture2DPool::unusedStorage() const {
size_t total = 0;
for (const auto& set : pool) {
total += storageSize(set.first) * set.second.free.size();
total += set.first.getStorageSize() * set.second.free.size();
}
return total;
}
@@ -244,7 +270,7 @@ const Texture2DDesc& Texture2DPool::desc(TextureID id) const {
size_t Texture2DPool::storage(TextureID id) const {
assert(descriptions.find(id) != descriptions.end());
return storageSize(descriptions.at(id));
return descriptions.at(id).getStorageSize();
}
} // namespace gl

View File

@@ -19,6 +19,10 @@ struct Texture2DDesc {
Size size;
gfx::TexturePixelType pixelFormat;
gfx::TextureChannelDataType channelType;
size_t channelCount() const;
size_t channelStorageSize() const;
size_t getStorageSize() const;
};
struct Texture2DDescHash {

View File

@@ -1,55 +0,0 @@
#include <mbgl/gl/texture.hpp>
#include <mbgl/gl/context.hpp>
#include <mbgl/gl/texture_resource.hpp>
#include <mbgl/gl/defines.hpp>
namespace mbgl {
namespace gl {
using namespace platform;
void bindTexture(gl::Context& context, const uint8_t unit, const gfx::TextureBinding& binding) {
auto& resource = static_cast<gl::TextureResource&>(*binding.resource);
if (binding.filter != resource.filter || binding.mipmap != resource.mipmap || binding.wrapX != resource.wrapX ||
binding.wrapY != resource.wrapY) {
context.activeTextureUnit = unit;
context.texture[unit] = resource.texture;
if (binding.filter != resource.filter || binding.mipmap != resource.mipmap) {
MBGL_CHECK_ERROR(glTexParameteri(
GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER,
binding.filter == gfx::TextureFilterType::Linear
? (binding.mipmap == gfx::TextureMipMapType::Yes ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR)
: (binding.mipmap == gfx::TextureMipMapType::Yes ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST)));
MBGL_CHECK_ERROR(
glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER,
binding.filter == gfx::TextureFilterType::Linear ? GL_LINEAR : GL_NEAREST));
resource.filter = binding.filter;
resource.mipmap = binding.mipmap;
}
if (binding.wrapX != resource.wrapX) {
MBGL_CHECK_ERROR(
glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_S,
binding.wrapX == gfx::TextureWrapType::Clamp ? GL_CLAMP_TO_EDGE : GL_REPEAT));
resource.wrapX = binding.wrapX;
}
if (binding.wrapY != resource.wrapY) {
MBGL_CHECK_ERROR(
glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_T,
binding.wrapY == gfx::TextureWrapType::Clamp ? GL_CLAMP_TO_EDGE : GL_REPEAT));
resource.wrapY = binding.wrapY;
}
} else if (context.texture[unit] != resource.texture) {
// We are checking first to avoid setting the active texture without a
// subsequent texture bind.
context.activeTextureUnit = unit;
context.texture[unit] = resource.texture;
}
}
} // namespace gl
} // namespace mbgl

View File

@@ -1,47 +0,0 @@
#pragma once
#include <mbgl/gfx/texture.hpp>
#include <mbgl/gl/uniform.hpp>
#include <mbgl/util/literal.hpp>
#include <mbgl/util/ignore.hpp>
#include <vector>
#include <string>
namespace mbgl {
namespace gl {
class Context;
void bindTexture(gl::Context&, uint8_t unit, const gfx::TextureBinding&);
template <class>
class TextureStates;
template <class... Ts>
class TextureStates<TypeList<Ts...>> {
private:
using State = IndexedTuple<TypeList<Ts...>, TypeList<ExpandToType<Ts, gl::UniformState<uint8_t>>...>>;
State state;
public:
void queryLocations(const ProgramID& id) {
state = State{
gl::uniformLocation(id, concat_literals<&string_literal<'u', '_'>::value, &Ts::name>::value())...};
}
NamedUniformLocations getNamedLocations() const {
return NamedUniformLocations{{concat_literals<&string_literal<'u', '_'>::value, &Ts::name>::value(),
state.template get<Ts>().location}...};
}
void bind(gl::Context& context, const gfx::TextureBindings<TypeList<Ts...>>& bindings) {
util::ignore({(state.template get<Ts>() = TypeIndex<Ts, Ts...>::value,
gl::bindTexture(context, TypeIndex<Ts, Ts...>::value, bindings.template get<Ts>()),
0)...});
}
};
} // namespace gl
} // namespace mbgl

View File

@@ -5,9 +5,6 @@
#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/util/instrumentation.hpp>
#include <mbgl/gl/texture_resource.hpp>
#include <mbgl/gfx/texture.hpp>
namespace mbgl {
namespace gl {
@@ -18,7 +15,7 @@ Texture2D::~Texture2D() {}
Texture2D& Texture2D::setSamplerConfiguration(const SamplerState& samplerState_) noexcept {
samplerState = samplerState_;
samplerStateDirty = textureResource != nullptr;
samplerStateDirty = texture != nullptr;
return *this;
}
@@ -27,7 +24,7 @@ Texture2D& Texture2D::setFormat(gfx::TexturePixelType pixelFormat_, gfx::Texture
return *this;
}
assert(!textureResource);
assert(!texture);
pixelFormat = pixelFormat_;
channelType = channelType_;
storageDirty = true;
@@ -76,9 +73,7 @@ void Texture2D::allocateTexture() noexcept {
// Create a new texture object
auto obj = context.createUniqueTexture(size, pixelFormat, channelType);
// @TODO: TextureResource is still needed while we have legacy rendering pathways
textureResource = std::make_unique<gl::TextureResource>(std::move(obj));
texture = std::make_unique<UniqueTexture>(std::move(obj));
}
void Texture2D::updateTextureData(const void* data) noexcept {
@@ -99,7 +94,7 @@ void Texture2D::create() noexcept {
}
platform::GLuint Texture2D::getTextureID() const noexcept {
return textureResource ? static_cast<gl::TextureResource&>(*textureResource).texture : 0;
return texture ? *texture : 0;
}
void Texture2D::updateSamplerConfiguration() noexcept {
@@ -118,12 +113,6 @@ void Texture2D::updateSamplerConfiguration() noexcept {
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_T,
samplerState.wrapV == gfx::TextureWrapType::Clamp ? GL_CLAMP_TO_EDGE : GL_REPEAT));
// Keep the resource sampler configuration in sync
auto& glResource = static_cast<gl::TextureResource&>(*textureResource);
glResource.filter = samplerState.filter;
glResource.wrapX = samplerState.wrapU;
glResource.wrapY = samplerState.wrapV;
}
void Texture2D::bind(int32_t location, int32_t textureUnit) noexcept {
@@ -166,7 +155,7 @@ void Texture2D::unbind() noexcept {
}
void Texture2D::upload(const void* pixelData, const Size& size_) noexcept {
if (!textureResource || storageDirty || size_ == Size{0, 0} || size_ != size) {
if (!texture || storageDirty || size_ == Size{0, 0} || size_ != size) {
size = size_;
// Create the texture object if we don't already have one or if storage is dirty
@@ -178,7 +167,7 @@ void Texture2D::upload(const void* pixelData, const Size& size_) noexcept {
void Texture2D::uploadSubRegion(const void* pixelData, const Size& size_, uint16_t xOffset, uint16_t yOffset) noexcept {
using namespace platform;
assert(textureResource);
assert(texture);
// update sampler configuration if needed
if (samplerStateDirty) {

View File

@@ -1,45 +0,0 @@
#include <mbgl/gl/context.hpp>
#include <mbgl/gl/texture_resource.hpp>
#include <mbgl/util/instrumentation.hpp>
namespace mbgl {
namespace gl {
static int channelCount(gfx::TexturePixelType format) {
switch (format) {
case gfx::TexturePixelType::Alpha:
case gfx::TexturePixelType::Depth:
case gfx::TexturePixelType::Luminance:
case gfx::TexturePixelType::Stencil:
return 1;
case gfx::TexturePixelType::RGBA:
return 4;
default:
assert(!"Unknown texture pixel type");
return 0;
}
}
static int channelStorageSize(gfx::TextureChannelDataType type) {
switch (type) {
case gfx::TextureChannelDataType::HalfFloat:
return 2;
case gfx::TextureChannelDataType::UnsignedByte:
return 1;
default:
assert(!"Unknown texture channel data type");
return 0;
}
}
TextureResource::TextureResource(UniqueTexture&& texture_)
: texture(std::move(texture_)) {}
TextureResource::~TextureResource() noexcept {}
int TextureResource::getStorageSize(const Size& size, gfx::TexturePixelType format, gfx::TextureChannelDataType type) {
return size.width * size.height * channelCount(format) * channelStorageSize(type);
}
} // namespace gl
} // namespace mbgl

View File

@@ -1,24 +0,0 @@
#pragma once
#include <mbgl/gfx/texture.hpp>
#include <mbgl/gl/object.hpp>
namespace mbgl {
namespace gl {
class TextureResource : public gfx::TextureResource {
public:
TextureResource(UniqueTexture&& texture_);
~TextureResource() noexcept override;
static int getStorageSize(const Size& size, gfx::TexturePixelType format, gfx::TextureChannelDataType type);
UniqueTexture texture;
gfx::TextureFilterType filter = gfx::TextureFilterType::Nearest;
gfx::TextureMipMapType mipmap = gfx::TextureMipMapType::No;
gfx::TextureWrapType wrapX = gfx::TextureWrapType::Clamp;
gfx::TextureWrapType wrapY = gfx::TextureWrapType::Clamp;
};
} // namespace gl
} // namespace mbgl

View File

@@ -8,7 +8,6 @@
#include <mbgl/gl/command_encoder.hpp>
#include <mbgl/gl/vertex_buffer_resource.hpp>
#include <mbgl/gl/index_buffer_resource.hpp>
#include <mbgl/gl/texture_resource.hpp>
#include <mbgl/util/instrumentation.hpp>
#include <mbgl/util/logging.hpp>
@@ -70,68 +69,6 @@ void UploadPass::updateIndexBufferResource(gfx::IndexBufferResource& resource, c
MBGL_CHECK_ERROR(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, size, data));
}
std::unique_ptr<gfx::TextureResource> UploadPass::createTextureResource(const Size size,
const void* data,
gfx::TexturePixelType format,
gfx::TextureChannelDataType type) {
MLN_TRACE_FUNC();
auto obj = commandEncoder.context.createUniqueTexture(size, format, type);
auto resource = std::make_unique<gl::TextureResource>(std::move(obj));
commandEncoder.context.pixelStoreUnpack = {1};
updateTextureResourceSub(*resource, 0, 0, size, data, format, type);
// We are using clamp to edge here since OpenGL ES doesn't allow GL_REPEAT
// on NPOT textures. We use those when the pixelRatio isn't a power of two,
// e.g. on iPhone 6 Plus.
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
return resource;
}
void UploadPass::updateTextureResource(gfx::TextureResource& resource,
const Size size,
const void* data,
gfx::TexturePixelType format,
gfx::TextureChannelDataType type) {
MLN_TRACE_FUNC();
updateTextureResourceSub(resource, 0, 0, size, data, format, type);
}
void UploadPass::updateTextureResourceSub(gfx::TextureResource& resource,
const uint16_t xOffset,
const uint16_t yOffset,
const Size size,
const void* data,
gfx::TexturePixelType format,
gfx::TextureChannelDataType type) {
MLN_TRACE_FUNC();
auto& ctx = commandEncoder.context;
assert(ctx.getTexturePool().isUsed(static_cast<gl::TextureResource&>(resource).texture));
assert(ctx.getTexturePool().desc(static_cast<gl::TextureResource&>(resource).texture).channelType == type);
assert(ctx.getTexturePool().desc(static_cast<gl::TextureResource&>(resource).texture).pixelFormat == format);
assert(ctx.getTexturePool().desc(static_cast<gl::TextureResource&>(resource).texture).size.width >=
xOffset + size.width);
assert(ctx.getTexturePool().desc(static_cast<gl::TextureResource&>(resource).texture).size.height >=
yOffset + size.height);
// Always use texture unit 0 for manipulating it.
ctx.activeTextureUnit = 0;
ctx.texture[0] = static_cast<const gl::TextureResource&>(resource).texture;
MBGL_CHECK_ERROR(glTexSubImage2D(GL_TEXTURE_2D,
0,
xOffset,
yOffset,
size.width,
size.height,
Enum<gfx::TexturePixelType>::to(format),
Enum<gfx::TextureChannelDataType>::to(type),
data));
}
struct VertexBufferGL : public gfx::VertexBufferBase {
~VertexBufferGL() override = default;

View File

@@ -56,22 +56,6 @@ public:
const std::optional<std::chrono::duration<double>> lastUpdate,
/*out*/ std::vector<std::unique_ptr<gfx::VertexBufferResource>>& outBuffers) override;
public:
std::unique_ptr<gfx::TextureResource> createTextureResource(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&,
uint16_t xOffset,
uint16_t yOffset,
Size,
const void* data,
gfx::TexturePixelType,
gfx::TextureChannelDataType) override;
private:
gl::CommandEncoder& commandEncoder;
const gfx::DebugGroup<gfx::CommandEncoder> debugGroup;

View File

@@ -13,12 +13,12 @@
#include <mbgl/mtl/uniform_buffer.hpp>
#include <mbgl/mtl/upload_pass.hpp>
#include <mbgl/mtl/vertex_buffer_resource.hpp>
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/renderer/render_static_data.hpp>
#include <mbgl/renderer/render_target.hpp>
#include <mbgl/shaders/mtl/clipping_mask.hpp>
#include <mbgl/shaders/mtl/shader_program.hpp>
#include <mbgl/shaders/program_parameters.hpp>
#include <mbgl/util/traits.hpp>
#include <mbgl/util/std.hpp>
#include <mbgl/util/logging.hpp>
@@ -456,13 +456,6 @@ std::unique_ptr<gfx::OffscreenTexture> Context::createOffscreenTexture(Size size
return createOffscreenTexture(size, type, false, false);
}
std::unique_ptr<gfx::TextureResource> Context::createTextureResource(Size,
gfx::TexturePixelType,
gfx::TextureChannelDataType) {
assert(false);
return nullptr;
}
std::unique_ptr<gfx::RenderbufferResource> Context::createRenderbufferResource(gfx::RenderbufferPixelType, Size) {
return std::make_unique<RenderbufferResource>();
}

View File

@@ -14,7 +14,7 @@
#include <mbgl/mtl/uniform_buffer.hpp>
#include <mbgl/mtl/vertex_buffer_resource.hpp>
#include <mbgl/mtl/vertex_attribute.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/shaders/mtl/shader_program.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/variant.hpp>

View File

@@ -3,7 +3,6 @@
#include <mbgl/gfx/cull_face_mode.hpp>
#include <mbgl/gfx/drawable_impl.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/gfx/program.hpp>
#include <mbgl/gfx/uniform.hpp>
#include <mbgl/gfx/uniform_buffer.hpp>
#include <mbgl/mtl/mtl_fwd.hpp>
@@ -12,7 +11,7 @@
#include <mbgl/mtl/upload_pass.hpp>
#include <mbgl/mtl/vertex_attribute.hpp>
#include <mbgl/mtl/vertex_buffer_resource.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/util/mat4.hpp>

View File

@@ -81,31 +81,6 @@ void UploadPass::updateIndexBufferResource(gfx::IndexBufferResource& resource, c
static_cast<IndexBufferResource&>(resource).get().update(data, size, /*offset=*/0);
}
std::unique_ptr<gfx::TextureResource> UploadPass::createTextureResource(const Size,
const void*,
gfx::TexturePixelType,
gfx::TextureChannelDataType) {
assert(false);
throw std::runtime_error("UploadPass::createTextureResource not implemented on Metal!");
}
void UploadPass::updateTextureResource(
gfx::TextureResource&, const Size, const void*, gfx::TexturePixelType, gfx::TextureChannelDataType) {
assert(false);
throw std::runtime_error("UploadPass::updateTextureResource not implemented on Metal!");
}
void UploadPass::updateTextureResourceSub(gfx::TextureResource&,
const uint16_t,
const uint16_t,
const Size,
const void*,
gfx::TexturePixelType,
gfx::TextureChannelDataType) {
assert(false);
throw std::runtime_error("UploadPass::updateTextureResourceSub not implemented on Metal!");
}
struct VertexBuffer : public gfx::VertexBufferBase {
~VertexBuffer() override = default;

View File

@@ -1,3 +0,0 @@
#include <mbgl/programs/clipping_mask_program.hpp>
namespace mbgl {} // namespace mbgl

View File

@@ -1,89 +0,0 @@
#pragma once
#include <mbgl/gfx/backend.hpp>
#include <mbgl/shaders/shader_source.hpp>
#include <array>
#include <cassert>
#include <string>
#include <unordered_map>
namespace mbgl {
class ProgramParameters {
public:
struct ProgramSource {
gfx::Backend::Type backend{gfx::Backend::Type::TYPE_MAX};
std::string vertex;
std::string fragment;
ProgramSource() = default;
/// @brief Construct a new ProgramSource object
/// @param forBackend The provided source code is intended for use with the given rendering backend.
/// @param vertex_ The vertex shader source code, or empty string if not provided.
/// @param fragment_ The fragment shader source code, or empty string if not provided.
ProgramSource(gfx::Backend::Type forBackend, const std::string& vertex_, const std::string& fragment_)
: backend(forBackend),
vertex(vertex_),
fragment(fragment_) {
assert(gfx::Backend::Type::TYPE_MAX != forBackend);
}
};
ProgramParameters(float pixelRatio, bool overdraw);
/// @brief Provide custom shader code which overrides any default source present
/// @param source ProgramSource
/// @return Mutated ProgramParameters
ProgramParameters withShaderSource(const ProgramSource& source) const noexcept;
/// @brief Provide default shader source
/// @param source ProgramSource
/// @return Mutated ProgramParameters
ProgramParameters withDefaultSource(const ProgramSource& source) const noexcept;
/// @brief Provide a `BuiltIn` value used to indicate the program type
/// @param source ProgramSource
/// @return Mutated ProgramParameters
ProgramParameters withProgramType(shaders::BuiltIn type) const noexcept;
shaders::BuiltIn getProgramType() const noexcept { return programType; }
/// @brief Get a list of built-in shader preprocessor defines
/// @return Shader source string
/// @todo With the addition of future backends, defines should also be backend-aware
const std::string& getDefinesString() const;
/// @brief Get a list of built-in shader preprocessor defines
/// @return Map of key-value pairs representing preprocessor definitions
const std::unordered_map<std::string, std::string>& getDefines() const { return defines; }
/// @brief Get source code for the vertex shader compatible with the requested backend
/// @param backend Backend type
/// @return Shader source string
const std::string& vertexSource(gfx::Backend::Type backend) const;
/// @brief Get source code for the fragment shader compatible with the requested backend
/// @param backend Backend type
/// @return Shader source string
const std::string& fragmentSource(gfx::Backend::Type backend) const;
bool getOverdrawInspectorEnabled() const { return overdrawInspector; }
std::uint64_t getDefinesHash() const { return definesHash; }
private:
std::unordered_map<std::string, std::string> defines;
std::uint64_t definesHash;
shaders::BuiltIn programType = shaders::BuiltIn::None;
// cached value of `defines` converted to string format
mutable std::string definesStr;
std::array<ProgramSource, static_cast<size_t>(gfx::Backend::Type::TYPE_MAX)> defaultSources;
std::array<ProgramSource, static_cast<size_t>(gfx::Backend::Type::TYPE_MAX)> userSources;
bool overdrawInspector;
};
} // namespace mbgl

View File

@@ -1,17 +0,0 @@
#pragma once
#include <mbgl/gfx/texture.hpp>
namespace mbgl {
namespace textures {
MBGL_DEFINE_TEXTURE(image);
MBGL_DEFINE_TEXTURE(image0);
MBGL_DEFINE_TEXTURE(image1);
MBGL_DEFINE_TEXTURE(color_ramp);
MBGL_DEFINE_TEXTURE(texture);
MBGL_DEFINE_TEXTURE(texture_icon);
MBGL_DEFINE_TEXTURE(overlay);
} // namespace textures
} // namespace mbgl

View File

@@ -6,7 +6,7 @@
#include <mbgl/tile/geometry_tile_data.hpp>
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/style/layers/circle_layer_properties.hpp>
namespace mbgl {

View File

@@ -6,8 +6,7 @@
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/programs/textures.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/renderer/buckets/fill_bucket.hpp>
namespace mbgl {
@@ -40,7 +39,6 @@ public:
SegmentVector tileBorderSegments;
std::optional<gfx::VertexBuffer<DebugLayoutVertex>> vertexBuffer;
std::optional<gfx::IndexBuffer> indexBuffer;
std::optional<gfx::Texture> texture;
};
} // namespace mbgl

View File

@@ -5,7 +5,7 @@
#include <mbgl/tile/geometry_tile_data.hpp>
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/style/layers/fill_layer_properties.hpp>
/**

View File

@@ -6,7 +6,7 @@
#include <mbgl/tile/geometry_tile_data.hpp>
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/style/layers/fill_extrusion_layer_properties.hpp>
namespace mbgl {

View File

@@ -6,7 +6,7 @@
#include <mbgl/tile/geometry_tile_data.hpp>
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/style/layers/heatmap_layer_properties.hpp>
namespace mbgl {

View File

@@ -2,10 +2,9 @@
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/renderer/paint_property_binder.hpp>
#include <mbgl/gfx/texture.hpp>
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/geometry/dem_data.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/renderer/bucket.hpp>
#include <mbgl/renderer/tile_mask.hpp>
#include <mbgl/style/layers/hillshade_layer_properties.hpp>
@@ -31,9 +30,6 @@ public:
void clear();
void setMask(TileMask&&);
std::optional<gfx::Texture> dem;
std::optional<gfx::Texture> texture;
RenderTargetPtr renderTarget;
bool renderTargetPrepared = false;

View File

@@ -4,7 +4,7 @@
#include <mbgl/tile/geometry_tile_data.hpp>
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/style/layers/line_layer_properties.hpp>
#include <mbgl/style/image_impl.hpp>

View File

@@ -36,7 +36,6 @@ void RasterBucket::clear() {
void RasterBucket::setImage(std::shared_ptr<PremultipliedImage> image_) {
image = std::move(image_);
texture = {};
texture2d.reset();
uploaded = false;
}

View File

@@ -1,9 +1,8 @@
#pragma once
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/gfx/texture.hpp>
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/renderer/bucket.hpp>
#include <mbgl/renderer/paint_property_binder.hpp>
#include <mbgl/renderer/tile_mask.hpp>
@@ -42,7 +41,6 @@ public:
}
std::shared_ptr<PremultipliedImage> image;
std::optional<gfx::Texture> texture;
gfx::Texture2DPtr texture2d;
TileMask mask{{0, 0, 0}};

View File

@@ -5,7 +5,7 @@
#include <mbgl/layout/symbol_feature.hpp>
#include <mbgl/layout/symbol_instance.hpp>
#include <mbgl/map/mode.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/renderer/bucket.hpp>
#include <mbgl/renderer/paint_property_binder.hpp>
#include <mbgl/renderer/layers/render_symbol_layer.hpp>
@@ -49,23 +49,12 @@ class SymbolSizeBinder {
public:
virtual ~SymbolSizeBinder() = default;
// using UniformList = TypeList<uniforms::is_size_zoom_constant, uniforms::is_size_feature_constant,
// uniforms::size_t, uniforms::size>; using UniformValues = gfx::UniformValues<UniformList>;
static std::unique_ptr<SymbolSizeBinder> create(float tileZoom,
const style::PropertyValue<float>& sizeProperty,
float defaultValue);
virtual Range<float> getVertexSizeData(const GeometryTileFeature& feature) = 0;
virtual ZoomEvaluatedSize evaluateForZoom(float currentZoom) const = 0;
/*UniformValues uniformValues(float currentZoom) const {
const ZoomEvaluatedSize u = evaluateForZoom(currentZoom);
return UniformValues{uniforms::is_size_zoom_constant::Value(u.isZoomConstant),
uniforms::is_size_feature_constant::Value(u.isFeatureConstant),
uniforms::size_t::Value(u.sizeT),
uniforms::size::Value(u.size)};
}*/
};
class ConstantSymbolSizeBinder final : public SymbolSizeBinder {

View File

@@ -2,7 +2,6 @@
#include <mbgl/gfx/context.hpp>
#include <mbgl/gfx/cull_face_mode.hpp>
#include <mbgl/map/transform_state.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/renderer/image_manager.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/renderer/pattern_atlas.hpp>

View File

@@ -1,6 +1,6 @@
#pragma once
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/renderer/render_layer.hpp>
#include <mbgl/style/layers/background_layer_impl.hpp>
#include <mbgl/style/layers/background_layer_properties.hpp>

View File

@@ -4,7 +4,6 @@
#include <mbgl/gfx/cull_face_mode.hpp>
#include <mbgl/gfx/shader_group.hpp>
#include <mbgl/gfx/shader_registry.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/renderer/buckets/circle_bucket.hpp>
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/renderer/paint_parameters.hpp>

View File

@@ -5,7 +5,6 @@
#include <mbgl/gfx/render_pass.hpp>
#include <mbgl/gfx/renderer_backend.hpp>
#include <mbgl/gfx/shader_registry.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/renderer/buckets/fill_extrusion_bucket.hpp>
#include <mbgl/renderer/image_manager.hpp>
#include <mbgl/renderer/paint_parameters.hpp>

View File

@@ -3,7 +3,7 @@
#include <mbgl/gfx/cull_face_mode.hpp>
#include <mbgl/gfx/renderable.hpp>
#include <mbgl/gfx/renderer_backend.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/gfx/shader_registry.hpp>
#include <mbgl/renderer/buckets/fill_bucket.hpp>
#include <mbgl/renderer/image_manager.hpp>
#include <mbgl/renderer/layers/render_fill_layer.hpp>

View File

@@ -3,7 +3,6 @@
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/renderer/render_static_data.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/tile/tile.hpp>
#include <mbgl/style/layers/heatmap_layer_impl.hpp>
#include <mbgl/geometry/feature_index.hpp>
@@ -93,9 +92,7 @@ void RenderHeatmapLayer::updateColorRamp() {
colorValue = HeatmapLayer::getDefaultHeatmapColor();
}
if (applyColorRamp(colorValue, *colorRamp)) {
colorRampTexture = std::nullopt;
}
applyColorRamp(colorValue, *colorRamp);
}
}

View File

@@ -1,7 +1,6 @@
#pragma once
#include <mbgl/gfx/offscreen_texture.hpp>
#include <mbgl/gfx/texture.hpp>
#include <mbgl/renderer/buckets/heatmap_bucket.hpp>
#include <mbgl/renderer/render_layer.hpp>
#include <mbgl/style/layers/heatmap_layer_impl.hpp>
@@ -61,7 +60,6 @@ private:
style::HeatmapPaintProperties::Unevaluated unevaluated;
std::shared_ptr<PremultipliedImage> colorRamp;
std::unique_ptr<gfx::OffscreenTexture> renderTexture;
std::optional<gfx::Texture> colorRampTexture;
SegmentVector segments;
gfx::ShaderGroupPtr heatmapShaderGroup;

View File

@@ -4,7 +4,6 @@
#include <mbgl/renderer/sources/render_raster_dem_source.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/renderer/render_static_data.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/tile/tile.hpp>
#include <mbgl/style/layers/hillshade_layer_impl.hpp>
#include <mbgl/gfx/cull_face_mode.hpp>

View File

@@ -3,7 +3,7 @@
#include <mbgl/geometry/feature_index.hpp>
#include <mbgl/geometry/line_atlas.hpp>
#include <mbgl/gfx/cull_face_mode.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/gfx/shader_registry.hpp>
#include <mbgl/renderer/buckets/line_bucket.hpp>
#include <mbgl/renderer/image_manager.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
@@ -188,8 +188,6 @@ void RenderLineLayer::updateColorRamp() {
return;
}
colorRampTexture = std::nullopt;
if (colorRampTexture2D) {
colorRampTexture2D.reset();

View File

@@ -3,10 +3,9 @@
#include <mbgl/renderer/render_layer.hpp>
#include <mbgl/style/layers/line_layer_impl.hpp>
#include <mbgl/style/layers/line_layer_properties.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/uniforms.hpp>
#include <mbgl/style/image_impl.hpp>
#include <mbgl/layout/pattern_layout.hpp>
#include <mbgl/gfx/texture.hpp>
#include <optional>
#include <memory>
@@ -58,8 +57,6 @@ private:
void updateColorRamp();
std::shared_ptr<PremultipliedImage> colorRamp;
std::optional<gfx::Texture> colorRampTexture;
gfx::Texture2DPtr colorRampTexture2D;
gfx::ShaderGroupPtr lineShaderGroup;

View File

@@ -36,8 +36,7 @@
#include <mbgl/gl/context.hpp>
#include <mbgl/gl/renderable_resource.hpp>
#include <mbgl/gl/defines.hpp>
#include <mbgl/gl/texture.hpp>
#include <mbgl/gl/texture_resource.hpp>
#include <mbgl/gl/uniform.hpp>
#include <mbgl/gl/types.hpp>
#endif

View File

@@ -4,7 +4,6 @@
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/renderer/render_static_data.hpp>
#include <mbgl/renderer/sources/render_image_source.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/tile/tile.hpp>
#include <mbgl/gfx/context.hpp>
#include <mbgl/gfx/cull_face_mode.hpp>

View File

@@ -1,8 +1,8 @@
#include <mbgl/renderer/layers/render_symbol_layer.hpp>
#include <mbgl/gfx/cull_face_mode.hpp>
#include <mbgl/gfx/shader_registry.hpp>
#include <mbgl/layout/symbol_layout.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/renderer/bucket_parameters.hpp>
#include <mbgl/renderer/buckets/symbol_bucket.hpp>
#include <mbgl/renderer/paint_parameters.hpp>

View File

@@ -11,6 +11,10 @@
#include <mbgl/util/convert.hpp>
#include <mbgl/util/logging.hpp>
#if MLN_RENDER_BACKEND_OPENGL
#include <mbgl/shaders/gl/legacy/clipping_mask_program.hpp>
#endif
#if MLN_RENDER_BACKEND_METAL
#include <mbgl/mtl/context.hpp>
#include <mbgl/shaders/mtl/clipping_mask.hpp>
@@ -65,11 +69,6 @@ PaintParameters::PaintParameters(gfx::Context& context_,
debugOptions(debugOptions_),
timePoint(timePoint_),
pixelRatio(pixelRatio_),
#ifndef NDEBUG
programs((debugOptions & MapDebugOptions::Overdraw) ? staticData_.overdrawPrograms : staticData_.programs),
#else
programs(staticData_.programs),
#endif
shaders(*staticData_.shaders),
frameCount(frameCount_) {
pixelsToGLUnits = {{2.0f / state.getSize().width, -2.0f / state.getSize().height}};
@@ -242,7 +241,7 @@ void PaintParameters::renderTileClippingMasks(const RenderTiles& renderTiles) {
vulkanContext.renderingStats().stencilUpdates++;
}
#else // !MLN_RENDER_BACKEND_METAL
#else // MLN_RENDER_BACKEND_OPENGL
auto program = staticData.shaders->getLegacyGroup().get<ClippingMaskProgram>();
if (!program) {
@@ -290,10 +289,9 @@ void PaintParameters::renderTileClippingMasks(const RenderTiles& renderTiles) {
static_cast<float>(state.getZoom())),
ClippingMaskProgram::computeAllAttributeBindings(
*staticData.tileVertexBuffer, paintAttributeData, properties),
ClippingMaskProgram::TextureBindings{},
"clipping/" + util::toString(stencilID));
}
#endif // MLN_RENDER_BACKEND_METAL
#endif // MLN_RENDER_BACKEND_OPENGL
}
gfx::StencilMode PaintParameters::stencilModeForClipping(const UnwrappedTileID& tileID) const {

View File

@@ -21,7 +21,6 @@ namespace mbgl {
class UpdateParameters;
class RenderStaticData;
class Programs;
class TransformState;
class ImageManager;
class LineAtlas;
@@ -82,9 +81,6 @@ public:
float pixelRatio;
std::array<float, 2> pixelsToGLUnits;
// Programs is, in effect, an immutable shader registry
Programs& programs;
// We're migrating to a dynamic one
gfx::ShaderRegistry& shaders;
gfx::DepthMode depthModeForSublayer(uint8_t n, gfx::DepthMaskType) const;

View File

@@ -5,7 +5,7 @@
#include <mbgl/gfx/uniform.hpp>
#include <mbgl/gfx/upload_pass.hpp>
#include <mbgl/layout/pattern_layout.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/renderer/cross_faded_property_evaluator.hpp>
#include <mbgl/renderer/paint_property_statistics.hpp>
#include <mbgl/renderer/possibly_evaluated_property_value.hpp>

View File

@@ -1,7 +1,6 @@
#pragma once
#include <mapbox/shelf-pack.hpp>
#include <mbgl/gfx/texture.hpp>
#include <mbgl/style/image_impl.hpp>
#include <unordered_map>

View File

@@ -1,7 +1,7 @@
#include <mbgl/renderer/render_static_data.hpp>
#include <mbgl/gfx/context.hpp>
#include <mbgl/gfx/upload_pass.hpp>
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/shaders/program_parameters.hpp>
namespace mbgl {
@@ -49,16 +49,9 @@ gfx::VertexVector<HeatmapTextureLayoutVertex> RenderStaticData::heatmapTextureVe
return result;
}
RenderStaticData::RenderStaticData(float pixelRatio, std::unique_ptr<gfx::ShaderRegistry>&& shaders_)
: programs(ProgramParameters{pixelRatio, false}),
shaders(std::move(shaders_)),
clippingMaskSegments(tileTriangleSegments())
#ifndef NDEBUG
,
overdrawPrograms(ProgramParameters{pixelRatio, true})
#endif
{
}
RenderStaticData::RenderStaticData(std::unique_ptr<gfx::ShaderRegistry>&& shaders_)
: shaders(std::move(shaders_)),
clippingMaskSegments(tileTriangleSegments()) {}
SegmentVector RenderStaticData::tileTriangleSegments() {
SegmentVector segments;

View File

@@ -4,7 +4,6 @@
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/gfx/renderbuffer.hpp>
#include <mbgl/gfx/shader_registry.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/renderer/buckets/heatmap_bucket.hpp>
#include <mbgl/renderer/buckets/raster_bucket.hpp>
@@ -19,7 +18,7 @@ class UploadPass;
class RenderStaticData {
public:
RenderStaticData(float pixelRatio, std::unique_ptr<gfx::ShaderRegistry>&& shaders_);
RenderStaticData(std::unique_ptr<gfx::ShaderRegistry>&& shaders_);
void upload(gfx::UploadPass&);
@@ -46,16 +45,9 @@ public:
bool uploaded = false;
Size backendSize;
// @TODO: Migrate away from and remove `Programs`
Programs programs;
std::unique_ptr<gfx::ShaderRegistry> shaders;
const SegmentVector clippingMaskSegments;
#ifndef NDEBUG
Programs overdrawPrograms;
#endif
};
} // namespace mbgl

View File

@@ -2,7 +2,6 @@
#include <mbgl/gfx/cull_face_mode.hpp>
#include <mbgl/map/transform_state.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/renderer/buckets/debug_bucket.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/renderer/render_source.hpp>

View File

@@ -1,7 +1,6 @@
#pragma once
#include <mbgl/map/mode.hpp>
#include <mbgl/gfx/texture.hpp>
#include <mbgl/tile/tile_id.hpp>
#include <mbgl/util/mat4.hpp>
#include <mbgl/style/image_impl.hpp>

View File

@@ -8,12 +8,12 @@
#include <mbgl/gfx/renderer_backend.hpp>
#include <mbgl/gfx/renderable.hpp>
#include <mbgl/gfx/upload_pass.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/renderer/pattern_atlas.hpp>
#include <mbgl/renderer/renderer_observer.hpp>
#include <mbgl/renderer/render_static_data.hpp>
#include <mbgl/renderer/render_tree.hpp>
#include <mbgl/shaders/program_parameters.hpp>
#include <mbgl/util/convert.hpp>
#include <mbgl/util/string.hpp>
#include <mbgl/util/logging.hpp>
@@ -158,10 +158,7 @@ void Renderer::Impl::render(const RenderTree& renderTree,
context.beginFrame();
if (!staticData) {
staticData = std::make_unique<RenderStaticData>(pixelRatio, std::make_unique<gfx::ShaderRegistry>());
// Initialize legacy shader programs
staticData->programs.registerWith(*staticData->shaders);
staticData = std::make_unique<RenderStaticData>(std::make_unique<gfx::ShaderRegistry>());
// Initialize shaders for drawables
const auto programParameters = ProgramParameters{pixelRatio, false};

View File

@@ -6,7 +6,6 @@
#include <mbgl/renderer/sources/render_image_source.hpp>
#include <mbgl/renderer/tile_parameters.hpp>
#include <mbgl/renderer/render_static_data.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/gfx/cull_face_mode.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/util/instrumentation.hpp>

View File

@@ -26,7 +26,6 @@ private:
const std::string& getName() const override { return name; }
std::string name;
void updateDebugDrawables(DebugLayerGroupMap&, PaintParameters&) const override {};
mutable std::optional<gfx::Texture> debugTexture;
};
class RenderImageSource final : public RenderSource {

View File

@@ -1,6 +1,5 @@
#pragma once
#include <mbgl/gfx/texture.hpp>
#include <mbgl/style/image_impl.hpp>
#include <mbgl/style/layer_impl.hpp>

View File

@@ -1,8 +1,8 @@
#pragma once
#include <mbgl/programs/program.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/gl/legacy/program.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
#include <mbgl/style/properties.hpp>
namespace mbgl {
@@ -12,7 +12,6 @@ class ClippingMaskProgram final : public Program<ClippingMaskProgram,
gfx::PrimitiveType::Triangle,
PositionOnlyLayoutAttributes,
TypeList<uniforms::matrix>,
TypeList<>,
style::Properties<>> {
public:
static constexpr std::string_view Name{"ClippingMaskProgram"};

View File

@@ -1,23 +1,20 @@
#pragma once
#include <mbgl/shaders/gl/legacy/program_base.hpp>
#include <mbgl/gfx/attribute.hpp>
#include <mbgl/gfx/shader.hpp>
#include <mbgl/gfx/uniform.hpp>
#include <mbgl/gfx/draw_mode.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/program_parameters.hpp>
#include <mbgl/shaders/shader_manifest.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/renderer/paint_property_binder.hpp>
#include <mbgl/util/io.hpp>
#include <unordered_map>
#include <mbgl/shaders/shader_manifest.hpp>
#if MLN_RENDER_BACKEND_OPENGL
#include <mbgl/gl/program.hpp>
#endif
namespace mbgl {
namespace gfx {
@@ -29,7 +26,6 @@ template <class Name,
gfx::PrimitiveType Primitive,
class LayoutAttributeList,
class LayoutUniformList,
class Textures,
class PaintProps>
class Program : public gfx::Shader {
public:
@@ -47,10 +43,7 @@ public:
using LayoutUniformValues = gfx::UniformValues<LayoutUniformList>;
using UniformValues = gfx::UniformValues<UniformList>;
using TextureList = Textures;
using TextureBindings = gfx::TextureBindings<TextureList>;
std::unique_ptr<gfx::Program<Name>> program;
std::unique_ptr<gl::ProgramBase<Name>> programBase;
Program([[maybe_unused]] const ProgramParameters& programParameters) {
switch (gfx::Backend::GetType()) {
@@ -64,7 +57,7 @@ public:
}
#else // MLN_RENDER_BACKEND_OPENGL
case gfx::Backend::Type::OpenGL: {
program = std::make_unique<gl::Program<Name>>(programParameters.withDefaultSource(
programBase = std::make_unique<gl::ProgramBase<Name>>(programParameters.withDefaultSource(
{gfx::Backend::Type::OpenGL,
shaders::ShaderSource<ShaderSource, gfx::Backend::Type::OpenGL>::vertex,
shaders::ShaderSource<ShaderSource, gfx::Backend::Type::OpenGL>::fragment}));
@@ -108,11 +101,10 @@ public:
const SegmentBase& segment,
const UniformValues& uniformValues,
const AttributeBindings& allAttributeBindings,
const TextureBindings& textureBindings,
const std::string& layerID) {
static_assert(Primitive == gfx::PrimitiveTypeOf<DrawMode>::value, "incompatible draw mode");
if (!program) {
if (!programBase) {
return;
}
@@ -121,20 +113,19 @@ public:
drawScopeIt = segment.drawScopes.emplace(layerID, context.createDrawScope()).first;
}
program->draw(context,
renderPass,
drawMode,
depthMode,
stencilMode,
colorMode,
cullFaceMode,
uniformValues,
drawScopeIt->second,
allAttributeBindings.offset(segment.vertexOffset),
textureBindings,
indexBuffer,
segment.indexOffset,
segment.indexLength);
programBase->draw(context,
renderPass,
drawMode,
depthMode,
stencilMode,
colorMode,
cullFaceMode,
uniformValues,
drawScopeIt->second,
allAttributeBindings.offset(segment.vertexOffset),
indexBuffer,
segment.indexOffset,
segment.indexLength);
}
template <class DrawMode>
@@ -149,11 +140,10 @@ public:
const SegmentVector& segments,
const UniformValues& uniformValues,
const AttributeBindings& allAttributeBindings,
const TextureBindings& textureBindings,
const std::string& layerID) {
static_assert(Primitive == gfx::PrimitiveTypeOf<DrawMode>::value, "incompatible draw mode");
if (!program) {
if (!programBase) {
return;
}
@@ -164,20 +154,19 @@ public:
drawScopeIt = segment.drawScopes.emplace(layerID, context.createDrawScope()).first;
}
program->draw(context,
renderPass,
drawMode,
depthMode,
stencilMode,
colorMode,
cullFaceMode,
uniformValues,
drawScopeIt->second,
allAttributeBindings.offset(segment.vertexOffset),
textureBindings,
indexBuffer,
segment.indexOffset,
segment.indexLength);
programBase->draw(context,
renderPass,
drawMode,
depthMode,
stencilMode,
colorMode,
cullFaceMode,
uniformValues,
drawScopeIt->second,
allAttributeBindings.offset(segment.vertexOffset),
indexBuffer,
segment.indexOffset,
segment.indexLength);
}
}
};

View File

@@ -1,22 +1,19 @@
#pragma once
#include <mbgl/gfx/program.hpp>
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/gfx/uniform.hpp>
#include <mbgl/gl/types.hpp>
#include <mbgl/gl/object.hpp>
#include <mbgl/gl/context.hpp>
#include <mbgl/gl/draw_scope_resource.hpp>
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/gfx/uniform.hpp>
#include <mbgl/gl/vertex_array.hpp>
#include <mbgl/gl/attribute.hpp>
#include <mbgl/gl/uniform.hpp>
#include <mbgl/gl/texture.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/shaders/program_parameters.hpp>
#include <mbgl/shaders/shader_manifest.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/logging.hpp>
#include <string>
@@ -24,15 +21,19 @@ namespace mbgl {
namespace gl {
template <class Name>
class Program final : public gfx::Program<Name> {
class ProgramBase {
public:
using AttributeList = typename Name::AttributeList;
using UniformList = typename Name::UniformList;
using TextureList = typename Name::TextureList;
Program(ProgramParameters programParameters_)
ProgramBase(ProgramParameters programParameters_)
: programParameters(std::move(programParameters_)) {}
ProgramBase(ProgramBase&&) = delete;
ProgramBase(const ProgramBase&) = delete;
ProgramBase& operator=(ProgramBase&&) = delete;
ProgramBase& operator=(const ProgramBase&) = delete;
const ProgramParameters programParameters;
class Instance {
@@ -45,8 +46,6 @@ public:
attributeLocations.getFirstAttribName())) {
attributeLocations.queryLocations(program);
uniformStates.queryLocations(program);
// Texture units are specified via uniforms as well, so we need query their locations
textureStates.queryLocations(program);
}
static std::unique_ptr<Instance> createInstance(gl::Context& context,
@@ -79,7 +78,6 @@ public:
UniqueProgram program;
gl::AttributeLocations<AttributeList> attributeLocations;
gl::UniformStates<UniformList> uniformStates;
gl::TextureStates<TextureList> textureStates;
};
void draw(gfx::Context& genericContext,
@@ -92,10 +90,9 @@ public:
const gfx::UniformValues<UniformList>& uniformValues,
gfx::DrawScope& drawScope,
const gfx::AttributeBindings<AttributeList>& attributeBindings,
const gfx::TextureBindings<TextureList>& textureBindings,
const gfx::IndexBuffer& indexBuffer,
std::size_t indexOffset,
std::size_t indexLength) override {
std::size_t indexLength) {
auto& context = static_cast<gl::Context&>(genericContext);
context.setDepthMode(depthMode);
@@ -124,8 +121,6 @@ public:
instance.uniformStates.bind(uniformValues);
instance.textureStates.bind(context, textureBindings);
auto& vertexArray = drawScope.getResource<gl::DrawScopeResource>().vertexArray;
vertexArray.bind(context, indexBuffer, instance.attributeLocations.toBindingArray(attributeBindings));

View File

@@ -1,4 +1,5 @@
#include <mbgl/programs/programs.hpp>
#include <mbgl/shaders/gl/legacy/programs.hpp>
#include <mbgl/shaders/gl/legacy/clipping_mask_program.hpp>
#include <mbgl/util/logging.hpp>
#include <exception>

View File

@@ -1,7 +1,6 @@
#pragma once
#include <mbgl/programs/clipping_mask_program.hpp>
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/shaders/program_parameters.hpp>
#include <mbgl/gfx/shader_registry.hpp>
#include <memory>

View File

@@ -4,7 +4,7 @@
#include <mbgl/gl/types.hpp>
#include <mbgl/gl/vertex_attribute_gl.hpp>
#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/shaders/program_parameters.hpp>
#include <mbgl/shaders/shader_manifest.hpp>
#include <cstring>

View File

@@ -6,7 +6,7 @@
#include <mbgl/mtl/renderable_resource.hpp>
#include <mbgl/mtl/uniform_buffer.hpp>
#include <mbgl/mtl/vertex_attribute.hpp>
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/shaders/program_parameters.hpp>
#include <mbgl/shaders/shader_manifest.hpp>
#include <mbgl/util/logging.hpp>

View File

@@ -1,4 +1,4 @@
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/shaders/program_parameters.hpp>
#include <mbgl/util/hash.hpp>
#include <mbgl/util/string.hpp>

View File

@@ -6,7 +6,7 @@
#include <mbgl/vulkan/renderable_resource.hpp>
#include <mbgl/vulkan/uniform_buffer.hpp>
#include <mbgl/vulkan/vertex_attribute.hpp>
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/shaders/program_parameters.hpp>
#include <mbgl/shaders/shader_manifest.hpp>
#include <mbgl/shaders/vulkan/common.hpp>
#include <mbgl/util/logging.hpp>

View File

@@ -10,8 +10,8 @@
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
namespace mbgl {
namespace style {

View File

@@ -10,8 +10,8 @@
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
namespace mbgl {
namespace style {

View File

@@ -10,8 +10,8 @@
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
namespace mbgl {
namespace style {

View File

@@ -10,8 +10,8 @@
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
namespace mbgl {
namespace style {

View File

@@ -10,8 +10,8 @@
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
namespace mbgl {
namespace style {

View File

@@ -10,8 +10,8 @@
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
namespace mbgl {
namespace style {

View File

@@ -15,8 +15,8 @@
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
namespace mbgl {
namespace style {

View File

@@ -10,8 +10,8 @@
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
namespace mbgl {
namespace style {

View File

@@ -10,8 +10,8 @@
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
namespace mbgl {
namespace style {

View File

@@ -10,8 +10,8 @@
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
namespace mbgl {
namespace style {

View File

@@ -10,8 +10,8 @@
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/shaders/attributes.hpp>
#include <mbgl/shaders/uniforms.hpp>
namespace mbgl {
namespace style {

View File

@@ -3,7 +3,6 @@
#include <mbgl/actor/actor.hpp>
#include <mbgl/geometry/feature_index.hpp>
#include <mbgl/gfx/dynamic_texture_atlas.hpp>
#include <mbgl/gfx/texture.hpp>
#include <mbgl/renderer/image_manager.hpp>
#include <mbgl/text/glyph_manager.hpp>
#include <mbgl/tile/tile.hpp>

View File

@@ -1,7 +1,6 @@
#include <mbgl/vulkan/context.hpp>
#include <mbgl/gfx/shader_registry.hpp>
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/renderer/render_static_data.hpp>
#include <mbgl/renderer/render_target.hpp>
@@ -16,6 +15,7 @@
#include <mbgl/vulkan/vertex_attribute.hpp>
#include <mbgl/shaders/vulkan/shader_program.hpp>
#include <mbgl/shaders/vulkan/clipping_mask.hpp>
#include <mbgl/shaders/program_parameters.hpp>
#include <mbgl/util/traits.hpp>
#include <mbgl/util/std.hpp>
#include <mbgl/util/logging.hpp>
@@ -415,13 +415,6 @@ std::unique_ptr<gfx::OffscreenTexture> Context::createOffscreenTexture(Size size
return createOffscreenTexture(size, type, false, false);
}
std::unique_ptr<gfx::TextureResource> Context::createTextureResource(Size,
gfx::TexturePixelType,
gfx::TextureChannelDataType) {
throw std::runtime_error("Vulkan TextureResource not implemented");
return nullptr;
}
std::unique_ptr<gfx::RenderbufferResource> Context::createRenderbufferResource(gfx::RenderbufferPixelType, Size) {
return std::make_unique<RenderbufferResource>();
}

View File

@@ -14,7 +14,7 @@
#include <mbgl/vulkan/vertex_buffer_resource.hpp>
#include <mbgl/vulkan/texture2d.hpp>
#include <mbgl/shaders/vulkan/shader_program.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/variant.hpp>
#include <mbgl/util/hash.hpp>

View File

@@ -9,7 +9,7 @@
#include <mbgl/vulkan/upload_pass.hpp>
#include <mbgl/vulkan/pipeline.hpp>
#include <mbgl/shaders/shader_defines.hpp>
#include <mbgl/programs/segment.hpp>
#include <mbgl/shaders/segment.hpp>
#include <mbgl/util/mat4.hpp>
#include <cstdint>

View File

@@ -50,31 +50,6 @@ void UploadPass::updateIndexBufferResource(gfx::IndexBufferResource& resource, c
static_cast<IndexBufferResource&>(resource).get().update(data, size, /*offset=*/0);
}
std::unique_ptr<gfx::TextureResource> UploadPass::createTextureResource(const Size,
const void*,
gfx::TexturePixelType,
gfx::TextureChannelDataType) {
assert(false);
throw std::runtime_error("UploadPass::createTextureResource not implemented on Vulkan!");
}
void UploadPass::updateTextureResource(
gfx::TextureResource&, const Size, const void*, gfx::TexturePixelType, gfx::TextureChannelDataType) {
assert(false);
throw std::runtime_error("UploadPass::updateTextureResource not implemented on Vulkan!");
}
void UploadPass::updateTextureResourceSub(gfx::TextureResource&,
const uint16_t,
const uint16_t,
const Size,
const void*,
gfx::TexturePixelType,
gfx::TextureChannelDataType) {
assert(false);
throw std::runtime_error("UploadPass::updateTextureResourceSub not implemented on Vulkan!");
}
struct VertexBuffer : public gfx::VertexBufferBase {
~VertexBuffer() override = default;