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

@@ -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>