From d3b993ad3d83533ddd91350b060c0fd9f5eaae1d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 22:04:06 +0000 Subject: [PATCH] Drawable Renderer (#1570), [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- include/mbgl/gfx/vertex_attribute.hpp | 12 ++-- src/mbgl/gfx/drawable_builder.cpp | 3 +- src/mbgl/gfx/vertex_attribute.cpp | 1 - src/mbgl/gfx/vertex_vector.hpp | 23 ++++--- src/mbgl/gl/upload_pass.cpp | 13 ++-- src/mbgl/gl/vertex_attribute_gl.cpp | 12 ++-- .../renderer/layers/render_circle_layer.cpp | 21 ++++--- .../layers/render_fill_extrusion_layer.cpp | 12 +++- .../renderer/layers/render_fill_layer.cpp | 25 ++++---- .../renderer/layers/render_heatmap_layer.cpp | 19 ++++-- .../renderer/layers/render_heatmap_layer.hpp | 2 +- .../renderer/layers/render_line_layer.cpp | 62 ++++++++++--------- .../renderer/layers/render_symbol_layer.cpp | 41 ++++++++---- src/mbgl/text/placement.cpp | 3 +- 14 files changed, 149 insertions(+), 100 deletions(-) diff --git a/include/mbgl/gfx/vertex_attribute.hpp b/include/mbgl/gfx/vertex_attribute.hpp index 4cc209b3f..d9f7fca08 100644 --- a/include/mbgl/gfx/vertex_attribute.hpp +++ b/include/mbgl/gfx/vertex_attribute.hpp @@ -52,8 +52,7 @@ public: sharedType(other.sharedType), sharedOffset(other.sharedOffset), sharedVertexOffset(other.sharedVertexOffset), - sharedStride(other.sharedStride) - {} + sharedStride(other.sharedStride) {} VertexAttribute(VertexAttribute&& other) : index(other.index), dataType(other.dataType), @@ -62,8 +61,7 @@ public: sharedType(other.sharedType), sharedOffset(other.sharedOffset), sharedVertexOffset(other.sharedVertexOffset), - sharedStride(other.sharedStride) - {} + sharedStride(other.sharedStride) {} public: virtual ~VertexAttribute() = default; @@ -138,7 +136,11 @@ public: uint32_t getSharedOffset() const { return sharedOffset; } uint32_t getSharedVertexOffset() const { return sharedVertexOffset; } uint32_t getSharedStride() const { return sharedStride; } - void setSharedRawData(std::shared_ptr data, uint32_t offset, uint32_t vertexOffset, uint32_t stride_, AttributeDataType type) { + void setSharedRawData(std::shared_ptr data, + uint32_t offset, + uint32_t vertexOffset, + uint32_t stride_, + AttributeDataType type) { sharedRawData = std::move(data); sharedType = type; sharedOffset = offset; diff --git a/src/mbgl/gfx/drawable_builder.cpp b/src/mbgl/gfx/drawable_builder.cpp index 128ba4cbb..c80970f29 100644 --- a/src/mbgl/gfx/drawable_builder.cpp +++ b/src/mbgl/gfx/drawable_builder.cpp @@ -38,8 +38,7 @@ UniqueDrawable& DrawableBuilder::getCurrentDrawable(bool createIfNone) { } void DrawableBuilder::flush() { - if (curVertexCount()) - { + if (curVertexCount()) { const auto& draw = getCurrentDrawable(/*createIfNone=*/true); draw->setEnabled(enabled); draw->setLineWidth(static_cast(lineWidth)); diff --git a/src/mbgl/gfx/vertex_attribute.cpp b/src/mbgl/gfx/vertex_attribute.cpp index 0388b6e42..198d510af 100644 --- a/src/mbgl/gfx/vertex_attribute.cpp +++ b/src/mbgl/gfx/vertex_attribute.cpp @@ -13,7 +13,6 @@ std::size_t VertexAttribute::getCount() const { return sharedRawData ? sharedRawData->getRawCount() : items.size(); } - std::unique_ptr VertexAttributeArray::nullref = nullptr; VertexAttributeArray::VertexAttributeArray(int initCapacity) diff --git a/src/mbgl/gfx/vertex_vector.hpp b/src/mbgl/gfx/vertex_vector.hpp index 893439e3c..faccbf9ad 100644 --- a/src/mbgl/gfx/vertex_vector.hpp +++ b/src/mbgl/gfx/vertex_vector.hpp @@ -14,12 +14,11 @@ struct VertexBufferBase { class VertexVectorBase { public: VertexVectorBase() = default; - VertexVectorBase(const VertexVectorBase&) {} // buffer is not copied - VertexVectorBase(VertexVectorBase&& other) : - buffer(std::move(other.buffer)), - dirty(other.dirty), - released(other.released) - {} + VertexVectorBase(const VertexVectorBase&) {} // buffer is not copied + VertexVectorBase(VertexVectorBase&& other) + : buffer(std::move(other.buffer)), + dirty(other.dirty), + released(other.released) {} virtual ~VertexVectorBase() = default; virtual const void* getRawData() const = 0; @@ -47,12 +46,12 @@ public: using Vertex = V; VertexVector() = default; - VertexVector(const VertexVector& other) : - VertexVectorBase(other), - v(other.v) {} - VertexVector(VertexVector&& other) : - VertexVectorBase(std::move(other)), - v(std::move(other.v)) {} + VertexVector(const VertexVector& other) + : VertexVectorBase(other), + v(other.v) {} + VertexVector(VertexVector&& other) + : VertexVectorBase(std::move(other)), + v(std::move(other.v)) {} ~VertexVector() override = default; template diff --git a/src/mbgl/gl/upload_pass.cpp b/src/mbgl/gl/upload_pass.cpp index 323914798..77962365f 100644 --- a/src/mbgl/gl/upload_pass.cpp +++ b/src/mbgl/gl/upload_pass.cpp @@ -139,15 +139,16 @@ struct VertexBufferGL : public gfx::VertexBufferBase { namespace { const std::unique_ptr noBuffer; } -const gfx::UniqueVertexBufferResource& UploadPass::getBuffer(const gfx::VertexVectorBasePtr& vec, const gfx::BufferUsageType usage) { +const gfx::UniqueVertexBufferResource& UploadPass::getBuffer(const gfx::VertexVectorBasePtr& vec, + const gfx::BufferUsageType usage) { if (vec) { const auto* rawBufPtr = vec->getRawData(); const auto rawBufSize = static_cast(vec->getRawCount() * vec->getRawSize()); - + // If we already have a buffer... if (auto* rawData = static_cast(vec->getBuffer()); rawData && rawData->resource) { auto& resource = static_cast(*rawData->resource); - + // If it's changed, update it if (rawBufSize <= resource.byteSize) { if (vec->getDirty()) { @@ -282,7 +283,7 @@ gfx::AttributeBindingArray UploadPass::buildAttributeBindings( b->vertexBufferResource = vertBuf.get(); } }); - + outBuffers.emplace_back(std::move(vertBuf)); } else { assert(false); @@ -290,8 +291,8 @@ gfx::AttributeBindingArray UploadPass::buildAttributeBindings( } } - assert(std::all_of(bindings.begin(), bindings.end(), [](const auto& b){ return !b || b->vertexBufferResource; })); - + assert(std::all_of(bindings.begin(), bindings.end(), [](const auto& b) { return !b || b->vertexBufferResource; })); + return bindings; } #endif diff --git a/src/mbgl/gl/vertex_attribute_gl.cpp b/src/mbgl/gl/vertex_attribute_gl.cpp index 4145af951..3cd403951 100644 --- a/src/mbgl/gl/vertex_attribute_gl.cpp +++ b/src/mbgl/gl/vertex_attribute_gl.cpp @@ -113,11 +113,15 @@ bool VertexAttributeGL::get(const gfx::VertexAttribute::ElementType& element, GL return gl::get(element, buffer); case GL_FLOAT_VEC4: case GL_FLOAT_MAT2: - return gl::get(element, buffer) || gl::get(element, buffer, [](int4 x) { + return gl::get(element, buffer) || + gl::get(element, + buffer, + [](int4 x) { + return float4{(float)x[0], (float)x[1], (float)x[2], (float)x[3]}; + }) || + gl::get(element, buffer, [](ushort8 x) { return float4{(float)x[0], (float)x[1], (float)x[2], (float)x[3]}; - }) || gl::get(element, buffer, [](ushort8 x) { - return float4{(float)x[0], (float)x[1], (float)x[2], (float)x[3]}; - }); + }); case GL_INT: return gl::get(element, buffer) || gl::get(element, buffer); case GL_UNSIGNED_INT: diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp index c8b1993b8..8fe55293f 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.cpp +++ b/src/mbgl/renderer/layers/render_circle_layer.cpp @@ -265,7 +265,6 @@ bool RenderCircleLayer::queryIntersectsFeature(const GeometryCoordinates& queryG #if MLN_DRAWABLE_RENDERER namespace { - struct alignas(16) CircleInterpolateUBO { float color_t; float radius_t; @@ -363,12 +362,12 @@ void RenderCircleLayer::update(gfx::ShaderRegistry& shaders, gfx::VertexAttributeArray circleVertexAttrs; const auto propertiesAsUniforms = circleVertexAttrs.readDataDrivenPaintProperties( + CircleRadius, + CircleBlur, + CircleOpacity, + CircleStrokeColor, + CircleStrokeWidth, + CircleStrokeOpacity>( paintPropertyBinders, evaluated); const auto circleShader = circleShaderGroup->getOrCreateShader(context, propertiesAsUniforms); @@ -377,7 +376,11 @@ void RenderCircleLayer::update(gfx::ShaderRegistry& shaders, } if (const auto& attr = circleVertexAttrs.add(VertexAttribName)) { - attr->setSharedRawData(bucket.sharedVertices, offsetof(CircleLayoutVertex, a1), 0, sizeof(CircleLayoutVertex), gfx::AttributeDataType::Short2); + attr->setSharedRawData(bucket.sharedVertices, + offsetof(CircleLayoutVertex, a1), + 0, + sizeof(CircleLayoutVertex), + gfx::AttributeDataType::Short2); } circleBuilder = context.createDrawableBuilder("circle"); @@ -388,7 +391,7 @@ void RenderCircleLayer::update(gfx::ShaderRegistry& shaders, circleBuilder->setRenderPass(renderPass); circleBuilder->setVertexAttributes(std::move(circleVertexAttrs)); - + circleBuilder->setRawVertices({}, vertexCount, gfx::AttributeDataType::Short2); circleBuilder->setSegments( gfx::Triangles(), bucket.triangles.vector(), bucket.segments.data(), bucket.segments.size()); diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index 9ad6d33b5..f3b6ca1e5 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -450,10 +450,18 @@ void RenderFillExtrusionLayer::update(gfx::ShaderRegistry& shaders, } if (const auto& attr = vertexAttrs.getOrAdd(PosAttribName)) { - attr->setSharedRawData(bucket.sharedVertices, offsetof(FillExtrusionLayoutVertex, a1), 0, sizeof(FillExtrusionLayoutVertex), gfx::AttributeDataType::Short2); + attr->setSharedRawData(bucket.sharedVertices, + offsetof(FillExtrusionLayoutVertex, a1), + 0, + sizeof(FillExtrusionLayoutVertex), + gfx::AttributeDataType::Short2); } if (const auto& attr = vertexAttrs.getOrAdd(NormAttribName)) { - attr->setSharedRawData(bucket.sharedVertices, offsetof(FillExtrusionLayoutVertex, a2), 0, sizeof(FillExtrusionLayoutVertex), gfx::AttributeDataType::Short4); + attr->setSharedRawData(bucket.sharedVertices, + offsetof(FillExtrusionLayoutVertex, a2), + 0, + sizeof(FillExtrusionLayoutVertex), + gfx::AttributeDataType::Short4); } colorBuilder->setEnableStencil(doDepthPass); diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index adeaec501..2eb0bfba8 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -421,12 +421,16 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, // `Fill*Program` all use `style::FillPaintProperties` gfx::VertexAttributeArray vertexAttrs; const auto uniformProps = - vertexAttrs.readDataDrivenPaintProperties( - binders, evaluated); + vertexAttrs.readDataDrivenPaintProperties(binders, + evaluated); const auto vertexCount = bucket.vertices.elements(); if (const auto& attr = vertexAttrs.add(PosAttribName)) { - attr->setSharedRawData(bucket.sharedVertices, offsetof(FillLayoutVertex, a1), 0, sizeof(FillLayoutVertex), gfx::AttributeDataType::Short2); + attr->setSharedRawData(bucket.sharedVertices, + offsetof(FillLayoutVertex, a1), + 0, + sizeof(FillLayoutVertex), + gfx::AttributeDataType::Short2); } if (unevaluated.get().isUndefined()) { @@ -436,10 +440,9 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, const auto fillShader = std::static_pointer_cast( fillShaderGroup->getOrCreateShader(context, uniformProps)); - const auto outlineShader = doOutline - ? std::static_pointer_cast( - outlineShaderGroup->getOrCreateShader(context, uniformProps)) - : nullptr; + const auto outlineShader = doOutline ? std::static_pointer_cast( + outlineShaderGroup->getOrCreateShader(context, uniformProps)) + : nullptr; if (!fillBuilder && fillShader) { if (auto builder = context.createDrawableBuilder(layerPrefix + "fill")) { @@ -497,10 +500,10 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, const auto fillShader = std::static_pointer_cast( patternShaderGroup->getOrCreateShader(context, uniformProps)); - const auto outlineShader = doOutline ? std::static_pointer_cast( - outlinePatternShaderGroup->getOrCreateShader( - context, uniformProps)) - : nullptr; + const auto outlineShader = doOutline + ? std::static_pointer_cast( + outlinePatternShaderGroup->getOrCreateShader(context, uniformProps)) + : nullptr; if (!patternBuilder) { if (auto builder = context.createDrawableBuilder(layerPrefix + "fill-pattern")) { diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index 037d0b701..15237a818 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -281,7 +281,7 @@ constexpr auto HeatmapTextureShaderGroupName = "HeatmapTextureShader"; constexpr auto HeatmapInterpolateUBOName = "HeatmapInterpolateUBO"; constexpr auto VertexAttribName = "a_pos"; -} +} // namespace void RenderHeatmapLayer::update(gfx::ShaderRegistry& shaders, gfx::Context& context, @@ -371,8 +371,9 @@ void RenderHeatmapLayer::update(gfx::ShaderRegistry& shaders, gfx::VertexAttributeArray heatmapVertexAttrs; - const auto propertiesAsUniforms = heatmapVertexAttrs.readDataDrivenPaintProperties( - paintPropertyBinders, evaluated); + const auto propertiesAsUniforms = + heatmapVertexAttrs.readDataDrivenPaintProperties(paintPropertyBinders, + evaluated); const auto heatmapShader = heatmapShaderGroup->getOrCreateShader(context, propertiesAsUniforms); if (!heatmapShader) { @@ -380,7 +381,11 @@ void RenderHeatmapLayer::update(gfx::ShaderRegistry& shaders, } if (const auto& attr = heatmapVertexAttrs.add(VertexAttribName)) { - attr->setSharedRawData(bucket.sharedVertices, offsetof(HeatmapLayoutVertex, a1), 0, sizeof(HeatmapLayoutVertex), gfx::AttributeDataType::Short2); + attr->setSharedRawData(bucket.sharedVertices, + offsetof(HeatmapLayoutVertex, a1), + 0, + sizeof(HeatmapLayoutVertex), + gfx::AttributeDataType::Short2); } heatmapBuilder = context.createDrawableBuilder("heatmap"); @@ -436,7 +441,11 @@ void RenderHeatmapLayer::update(gfx::ShaderRegistry& shaders, gfx::VertexAttributeArray textureVertexAttrs; if (const auto& attr = textureVertexAttrs.add(VertexAttribName)) { - attr->setSharedRawData(sharedTextureVertices, offsetof(HeatmapLayoutVertex, a1), 0, sizeof(HeatmapLayoutVertex), gfx::AttributeDataType::Short2); + attr->setSharedRawData(sharedTextureVertices, + offsetof(HeatmapLayoutVertex, a1), + 0, + sizeof(HeatmapLayoutVertex), + gfx::AttributeDataType::Short2); } heatmapTextureBuilder = context.createDrawableBuilder("heatmapTexture"); diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.hpp b/src/mbgl/renderer/layers/render_heatmap_layer.hpp index 40f05774b..c5b64bc67 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.hpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.hpp @@ -73,7 +73,7 @@ private: gfx::ShaderGroupPtr heatmapShaderGroup; gfx::ShaderProgramBasePtr heatmapTextureShader; RenderTargetPtr renderTarget; - + using TextureVertexVector = gfx::VertexVector; std::shared_ptr sharedTextureVertices; #endif diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index 2cc4f7520..c04295ba6 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -104,7 +104,7 @@ void RenderLineLayer::prepare(const LayerPrepareParameters& params) { params.lineAtlas.getDashPatternTexture( evaluated.get().from, evaluated.get().to, cap); } - + #if MLN_DRAWABLE_RENDERER updateRenderTileIDs(); #endif // MLN_DRAWABLE_RENDERER @@ -477,23 +477,29 @@ void RenderLineLayer::update(gfx::ShaderRegistry& shaders, return builder; }; - auto addAttributes = [&](gfx::DrawableBuilder& builder, - const LineBucket& bucket, - gfx::VertexAttributeArray&& vertexAttrs) { + auto addAttributes = + [&](gfx::DrawableBuilder& builder, const LineBucket& bucket, gfx::VertexAttributeArray&& vertexAttrs) { + const auto vertexCount = bucket.vertices.elements(); + builder.setRawVertices({}, vertexCount, gfx::AttributeDataType::Short4); - const auto vertexCount = bucket.vertices.elements(); - builder.setRawVertices({}, vertexCount, gfx::AttributeDataType::Short4); + if (const auto& attr = vertexAttrs.add(VertexAttribName)) { + attr->setSharedRawData(bucket.sharedVertices, + offsetof(LineLayoutVertex, a1), + 0, + sizeof(LineLayoutVertex), + gfx::AttributeDataType::Short2); + } - if (const auto& attr = vertexAttrs.add(VertexAttribName)) { - attr->setSharedRawData(bucket.sharedVertices, offsetof(LineLayoutVertex, a1), 0, sizeof(LineLayoutVertex), gfx::AttributeDataType::Short2); - } + if (const auto& attr = vertexAttrs.add(DataAttribName)) { + attr->setSharedRawData(bucket.sharedVertices, + offsetof(LineLayoutVertex, a2), + 0, + sizeof(LineLayoutVertex), + gfx::AttributeDataType::UByte4); + } - if (const auto& attr = vertexAttrs.add(DataAttribName)) { - attr->setSharedRawData(bucket.sharedVertices, offsetof(LineLayoutVertex, a2), 0, sizeof(LineLayoutVertex), gfx::AttributeDataType::UByte4); - } - - builder.setVertexAttributes(std::move(vertexAttrs)); - }; + builder.setVertexAttributes(std::move(vertexAttrs)); + }; auto setSegments = [&](std::unique_ptr& builder, const LineBucket& bucket) { builder->setSegments( @@ -594,13 +600,13 @@ void RenderLineLayer::update(gfx::ShaderRegistry& shaders, // dash array line (SDF) gfx::VertexAttributeArray vertexAttrs; const auto propertiesAsUniforms = vertexAttrs.readDataDrivenPaintProperties(paintPropertyBinders, - evaluated); + LineBlur, + LineOpacity, + LineGapWidth, + LineOffset, + LineWidth, + LineFloorWidth>( + paintPropertyBinders, evaluated); auto builder = createLineBuilder("lineSDF", lineSDFShaderGroup->getOrCreateShader(context, propertiesAsUniforms)); @@ -707,12 +713,12 @@ void RenderLineLayer::update(gfx::ShaderRegistry& shaders, // simple line gfx::VertexAttributeArray vertexAttrs; const auto propertiesAsUniforms = vertexAttrs.readDataDrivenPaintProperties(paintPropertyBinders, - evaluated); + LineBlur, + LineOpacity, + LineGapWidth, + LineOffset, + LineWidth>(paintPropertyBinders, + evaluated); auto builder = createLineBuilder("line", lineShaderGroup->getOrCreateShader(context, propertiesAsUniforms)); // vertices, attributes and segments diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index e5bf420e5..b9ff0a7ed 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -756,21 +756,21 @@ void updateTileDrawable(gfx::Drawable& drawable, if (!drawable.getData()) { return; } - + auto& drawData = static_cast(*drawable.getData()); const auto isText = (drawData.symbolType == SymbolType::Text); const auto currentZoom = static_cast(state.getZoom()); - + // This property can be set after the initial appearance of the tile, as part of the layout process. drawData.bucketVariablePlacement = bucket.hasVariablePlacement; - + const auto tileUBO = buildTileUBO(bucket, drawData, currentZoom); const auto interpolateUBO = buildInterpUBO(paintProps, isText, currentZoom); - + auto& uniforms = drawable.mutableUniformBuffers(); uniforms.createOrUpdate(SymbolLayerTweaker::SymbolDrawableTilePropsUBOName, &tileUBO, context); uniforms.createOrUpdate(SymbolLayerTweaker::SymbolDrawableInterpolateUBOName, &interpolateUBO, context); - + // TODO: detect whether anything has actually changed // See `Placement::updateBucketDynamicVertices` const auto sdfIcons = (drawData.symbolType == SymbolType::IconSDF); @@ -779,11 +779,13 @@ void updateTileDrawable(gfx::Drawable& drawable, auto& attribs = drawable.mutableVertexAttributes(); if (const auto& attr = attribs.get(projPosAttribName)) { using Vertex = gfx::Vertex; - attr->setSharedRawData(buffer.sharedDynamicVertices, offsetof(Vertex, a1), 0, sizeof(Vertex), gfx::AttributeDataType::Float3); + attr->setSharedRawData( + buffer.sharedDynamicVertices, offsetof(Vertex, a1), 0, sizeof(Vertex), gfx::AttributeDataType::Float3); } if (const auto& attr = attribs.get(fadeOpacityAttribName)) { using Vertex = gfx::Vertex; - attr->setSharedRawData(buffer.sharedOpacityVertices, offsetof(Vertex, a1), 0, sizeof(Vertex), gfx::AttributeDataType::Float); + attr->setSharedRawData( + buffer.sharedOpacityVertices, offsetof(Vertex, a1), 0, sizeof(Vertex), gfx::AttributeDataType::Float); } } @@ -917,25 +919,38 @@ void RenderSymbolLayer::update(gfx::ShaderRegistry& shaders, auto& tileInfo = tileCache[tile.id]; - gfx::VertexAttributeArray attrs; const auto vertexCount = buffer.vertices().elements(); if (const auto& attr = attrs.add(posOffsetAttribName)) { - attr->setSharedRawData(buffer.sharedVertices, offsetof(SymbolLayoutVertex, a1), 0, sizeof(SymbolLayoutVertex), gfx::AttributeDataType::Short4); + attr->setSharedRawData(buffer.sharedVertices, + offsetof(SymbolLayoutVertex, a1), + 0, + sizeof(SymbolLayoutVertex), + gfx::AttributeDataType::Short4); } if (const auto& attr = attrs.add(dataAttibName)) { - attr->setSharedRawData(buffer.sharedVertices, offsetof(SymbolLayoutVertex, a2), 0, sizeof(SymbolLayoutVertex), gfx::AttributeDataType::UShort4); + attr->setSharedRawData(buffer.sharedVertices, + offsetof(SymbolLayoutVertex, a2), + 0, + sizeof(SymbolLayoutVertex), + gfx::AttributeDataType::UShort4); } if (const auto& attr = attrs.add(pixOffsetAttribName)) { - attr->setSharedRawData(buffer.sharedVertices, offsetof(SymbolLayoutVertex, a3), 0, sizeof(SymbolLayoutVertex), gfx::AttributeDataType::Short4); + attr->setSharedRawData(buffer.sharedVertices, + offsetof(SymbolLayoutVertex, a3), + 0, + sizeof(SymbolLayoutVertex), + gfx::AttributeDataType::Short4); } if (const auto& attr = attrs.add(projPosAttribName)) { using Vertex = gfx::Vertex; - attr->setSharedRawData(buffer.sharedDynamicVertices, offsetof(Vertex, a1), 0, sizeof(Vertex), gfx::AttributeDataType::Float3); + attr->setSharedRawData( + buffer.sharedDynamicVertices, offsetof(Vertex, a1), 0, sizeof(Vertex), gfx::AttributeDataType::Float3); } if (const auto& attr = attrs.add(fadeOpacityAttribName)) { using Vertex = gfx::Vertex; - attr->setSharedRawData(buffer.sharedOpacityVertices, offsetof(Vertex, a1), 0, sizeof(Vertex), gfx::AttributeDataType::Float); + attr->setSharedRawData( + buffer.sharedOpacityVertices, offsetof(Vertex, a1), 0, sizeof(Vertex), gfx::AttributeDataType::Float); } const auto uniformProps = isText ? attrs.readDataDrivenPaintPropertiessecond.second, placedIcon.angle, iconBuffer.dynamicVertices()); + addDynamicAttributes( + pair->second.second, placedIcon.angle, iconBuffer.dynamicVertices()); } } }