Drawable Renderer (#1570), [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2023-05-22 19:23:47 +00:00
committed by Bart Louwers
parent c81c665538
commit 7d964a3236
2 changed files with 20 additions and 14 deletions

View File

@@ -52,8 +52,10 @@ const gfx::UniqueDrawable& TileLayerGroup::getDrawable(mbgl::RenderPass pass, co
std::vector<gfx::UniqueDrawable> TileLayerGroup::removeDrawables(mbgl::RenderPass pass, const OverscaledTileID& id) {
const auto range = impl->tileDrawables.equal_range({pass, id});
std::vector<gfx::UniqueDrawable> result(std::distance(range.first, range.second));
std::transform(std::make_move_iterator(range.first), std::make_move_iterator(range.second),
result.begin(), [](auto&& pair) { return std::move(pair.second); });
std::transform(
std::make_move_iterator(range.first), std::make_move_iterator(range.second), result.begin(), [](auto&& pair) {
return std::move(pair.second);
});
impl->tileDrawables.erase(range.first, range.second);
return result;
}

View File

@@ -389,7 +389,8 @@ void RenderFillLayer::update(const int32_t layerIndex,
static_cast<const gfx::detail::VertexType<gfx::AttributeType<float, 2>>*>(
binder->getVertexValue(i))
->a1;
attr->set<gfx::VertexAttribute::float4>(i, {packed[0], packed[1], packed[0], packed[1]});
attr->set<gfx::VertexAttribute::float4>(i,
{packed[0], packed[1], packed[0], packed[1]});
}
}
}
@@ -403,14 +404,16 @@ void RenderFillLayer::update(const int32_t layerIndex,
static_cast<const gfx::detail::VertexType<gfx::AttributeType<float, 2>>*>(
binder->getVertexValue(i))
->a1;
attr->set<gfx::VertexAttribute::float4>(i, {packed[0], packed[1], packed[0], packed[1]});
attr->set<gfx::VertexAttribute::float4>(i,
{packed[0], packed[1], packed[0], packed[1]});
}
}
}
}
if (auto& binder = paintPropertyBinders.get<FillOpacity>()) {
const auto count = binder->getVertexCount();
for (auto& attrs : {std::reference_wrapper(fillVertexAttrs), std::reference_wrapper(outlineVertexAttrs)}) {
for (auto& attrs :
{std::reference_wrapper(fillVertexAttrs), std::reference_wrapper(outlineVertexAttrs)}) {
if (auto& attr = attrs.get().getOrAdd("a_opacity")) {
for (std::size_t i = 0; i < count; ++i) {
const auto& opacity =
@@ -439,16 +442,17 @@ void RenderFillLayer::update(const int32_t layerIndex,
if (doFill && !fillBuilder) {
fillBuilder = context.createDrawableBuilder("fill");
fillBuilder->setShader(fillShader);
//fillBuilder->addTweaker(context.createDrawableTweaker());
// fillBuilder->addTweaker(context.createDrawableTweaker());
fillBuilder->setColorMode(gfx::DrawableBuilder::ColorMode::None);
fillBuilder->setDepthType((renderPass == RenderPass::Opaque) ? gfx::DepthMaskType::ReadWrite : gfx::DepthMaskType::ReadOnly);
fillBuilder->setDepthType((renderPass == RenderPass::Opaque) ? gfx::DepthMaskType::ReadWrite
: gfx::DepthMaskType::ReadOnly);
fillBuilder->setDepthType(gfx::DepthMaskType::ReadWrite);
fillBuilder->setLayerIndex(layerIndex);
}
if (doOutline && !outlineBuilder) {
outlineBuilder = context.createDrawableBuilder("fill-outline");
outlineBuilder->setShader(outlineShader);
//outlineBuilder->addTweaker(context.createDrawableTweaker());
// outlineBuilder->addTweaker(context.createDrawableTweaker());
outlineBuilder->setColorMode(gfx::DrawableBuilder::ColorMode::None);
outlineBuilder->setLineWidth(2);
outlineBuilder->setDepthType(gfx::DepthMaskType::ReadOnly);
@@ -493,11 +497,11 @@ void RenderFillLayer::update(const int32_t layerIndex,
if (fillBuilder) {
fillBuilder->addVertices(rawVerts, 0, rawVerts.size());
for (const auto& seg : bucket.triangleSegments) {
fillBuilder->addTriangles(bucket.triangles.vector(), seg.indexOffset, seg.indexLength);
}
fillBuilder->flush();
for (auto& drawable : fillBuilder->clearDrawables()) {
@@ -508,12 +512,12 @@ void RenderFillLayer::update(const int32_t layerIndex,
}
}
if (outlineBuilder) {
outlineBuilder->addVertices(rawVerts, 0, rawVerts.size());
outlineBuilder->addVertices(rawVerts, 0, rawVerts.size());
for (const auto& seg : bucket.lineSegments) {
outlineBuilder->addLines(bucket.lines.vector(), seg.indexOffset, seg.indexLength);
}
outlineBuilder->flush();
for (auto& drawable : outlineBuilder->clearDrawables()) {
@@ -524,7 +528,7 @@ void RenderFillLayer::update(const int32_t layerIndex,
}
}
}
} else { // FillPattern is defined
} else { // FillPattern is defined
// if (parameters.pass != RenderPass::Translucent) {
// return;
// }