diff --git a/include/mbgl/gfx/context.hpp b/include/mbgl/gfx/context.hpp index 921374d4281..abfdd383e95 100644 --- a/include/mbgl/gfx/context.hpp +++ b/include/mbgl/gfx/context.hpp @@ -125,7 +125,10 @@ class Context { /// @param data The data to copy, may be `nullptr` /// @param size The size of the buffer /// @param persistent Performance hint, optimize for few or many uses - virtual UniformBufferPtr createUniformBuffer(const void* data, std::size_t size, bool persistent = false, bool ssbo = false) = 0; + virtual UniformBufferPtr createUniformBuffer(const void* data, + std::size_t size, + bool persistent = false, + bool ssbo = false) = 0; /// Get the generic shader with the specified name virtual gfx::ShaderProgramBasePtr getGenericShader(gfx::ShaderRegistry&, const std::string& name) = 0; diff --git a/include/mbgl/mtl/context.hpp b/include/mbgl/mtl/context.hpp index a6349faf942..41c354b4dde 100644 --- a/include/mbgl/mtl/context.hpp +++ b/include/mbgl/mtl/context.hpp @@ -83,7 +83,10 @@ class Context final : public gfx::Context { void reduceMemoryUsage() override {} gfx::UniqueDrawableBuilder createDrawableBuilder(std::string name) override; - gfx::UniformBufferPtr createUniformBuffer(const void* data, std::size_t size, bool persistent = false, bool ssbo = false) override; + gfx::UniformBufferPtr createUniformBuffer(const void* data, + std::size_t size, + bool persistent = false, + bool ssbo = false) override; gfx::ShaderProgramBasePtr getGenericShader(gfx::ShaderRegistry&, const std::string& name) override; diff --git a/include/mbgl/vulkan/context.hpp b/include/mbgl/vulkan/context.hpp index eb6ea156631..abbc9e3985a 100644 --- a/include/mbgl/vulkan/context.hpp +++ b/include/mbgl/vulkan/context.hpp @@ -74,7 +74,10 @@ class Context final : public gfx::Context { void reduceMemoryUsage() override {} gfx::UniqueDrawableBuilder createDrawableBuilder(std::string name) override; - gfx::UniformBufferPtr createUniformBuffer(const void* data, std::size_t size, bool persistent, bool ssbo = false) override; + gfx::UniformBufferPtr createUniformBuffer(const void* data, + std::size_t size, + bool persistent, + bool ssbo = false) override; gfx::ShaderProgramBasePtr getGenericShader(gfx::ShaderRegistry&, const std::string& name) override; diff --git a/include/mbgl/vulkan/descriptor_set.hpp b/include/mbgl/vulkan/descriptor_set.hpp index 6582216c956..b1c4619c542 100644 --- a/include/mbgl/vulkan/descriptor_set.hpp +++ b/include/mbgl/vulkan/descriptor_set.hpp @@ -80,7 +80,10 @@ class UniformDescriptorSet : public DescriptorSet { UniformDescriptorSet(Context& context_, DescriptorSetType type_); virtual ~UniformDescriptorSet() = default; - void update(const gfx::UniformBufferArray& uniforms, uint32_t descriptorStartIndex, uint32_t descriptorStorageCount, uint32_t descriptorUniformCount); + void update(const gfx::UniformBufferArray& uniforms, + uint32_t descriptorStartIndex, + uint32_t descriptorStorageCount, + uint32_t descriptorUniformCount); }; class ImageDescriptorSet : public DescriptorSet { diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 6e95f3df7d5..d8a8dcac2b7 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -611,7 +611,10 @@ gfx::UniqueDrawableBuilder Context::createDrawableBuilder(std::string name) { return std::make_unique(std::move(name)); } -gfx::UniformBufferPtr Context::createUniformBuffer(const void* data, std::size_t size, bool /*persistent*/, bool /*ssbo*/) { +gfx::UniformBufferPtr Context::createUniformBuffer(const void* data, + std::size_t size, + bool /*persistent*/, + bool /*ssbo*/) { MLN_TRACE_FUNC(); return std::make_shared(data, size, *uboAllocator); diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index 0b42d58f844..0c34475a9a9 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -120,7 +120,10 @@ class Context final : public gfx::Context { #if MLN_DRAWABLE_RENDERER gfx::UniqueDrawableBuilder createDrawableBuilder(std::string name) override; - gfx::UniformBufferPtr createUniformBuffer(const void* data, std::size_t size, bool persistent = false, bool ssbo = false) override; + gfx::UniformBufferPtr createUniformBuffer(const void* data, + std::size_t size, + bool persistent = false, + bool ssbo = false) override; gfx::ShaderProgramBasePtr getGenericShader(gfx::ShaderRegistry&, const std::string& name) override; diff --git a/src/mbgl/renderer/layers/background_layer_tweaker.cpp b/src/mbgl/renderer/layers/background_layer_tweaker.cpp index dbfca5ef36c..2cccad00704 100644 --- a/src/mbgl/renderer/layers/background_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/background_layer_tweaker.cpp @@ -148,7 +148,8 @@ void BackgroundLayerTweaker::execute(LayerGroupBase& layerGroup, const PaintPara #if MLN_UBO_CONSOLIDATION const size_t drawableUBOVectorSize = sizeof(BackgroundDrawableUnionUBO) * drawableUBOVector.size(); if (!drawableUniformBuffer || drawableUniformBuffer->getSize() < drawableUBOVectorSize) { - drawableUniformBuffer = context.createUniformBuffer(drawableUBOVector.data(), drawableUBOVectorSize, false, true); + drawableUniformBuffer = context.createUniformBuffer( + drawableUBOVector.data(), drawableUBOVectorSize, false, true); } else { drawableUniformBuffer->update(drawableUBOVector.data(), drawableUBOVectorSize); } diff --git a/src/mbgl/renderer/layers/circle_layer_tweaker.cpp b/src/mbgl/renderer/layers/circle_layer_tweaker.cpp index 3b3ac5f6f50..c57a3eb31f8 100644 --- a/src/mbgl/renderer/layers/circle_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/circle_layer_tweaker.cpp @@ -118,7 +118,8 @@ void CircleLayerTweaker::execute(LayerGroupBase& layerGroup, const PaintParamete #if MLN_UBO_CONSOLIDATION const size_t drawableUBOVectorSize = sizeof(CircleDrawableUBO) * drawableUBOVector.size(); if (!drawableUniformBuffer || drawableUniformBuffer->getSize() < drawableUBOVectorSize) { - drawableUniformBuffer = context.createUniformBuffer(drawableUBOVector.data(), drawableUBOVectorSize, false, true); + drawableUniformBuffer = context.createUniformBuffer( + drawableUBOVector.data(), drawableUBOVectorSize, false, true); } else { drawableUniformBuffer->update(drawableUBOVector.data(), drawableUBOVectorSize); } diff --git a/src/mbgl/renderer/layers/fill_extrusion_layer_tweaker.cpp b/src/mbgl/renderer/layers/fill_extrusion_layer_tweaker.cpp index 044452fabfd..73b61aca4a5 100644 --- a/src/mbgl/renderer/layers/fill_extrusion_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/fill_extrusion_layer_tweaker.cpp @@ -155,14 +155,16 @@ void FillExtrusionLayerTweaker::execute(LayerGroupBase& layerGroup, const PaintP #if MLN_UBO_CONSOLIDATION const size_t drawableUBOVectorSize = sizeof(FillExtrusionDrawableUBO) * drawableUBOVector.size(); if (!drawableUniformBuffer || drawableUniformBuffer->getSize() < drawableUBOVectorSize) { - drawableUniformBuffer = context.createUniformBuffer(drawableUBOVector.data(), drawableUBOVectorSize, false, true); + drawableUniformBuffer = context.createUniformBuffer( + drawableUBOVector.data(), drawableUBOVectorSize, false, true); } else { drawableUniformBuffer->update(drawableUBOVector.data(), drawableUBOVectorSize); } const size_t tilePropsUBOVectorSize = sizeof(FillExtrusionTilePropsUBO) * tilePropsUBOVector.size(); if (!tilePropsUniformBuffer || tilePropsUniformBuffer->getSize() < tilePropsUBOVectorSize) { - tilePropsUniformBuffer = context.createUniformBuffer(tilePropsUBOVector.data(), tilePropsUBOVectorSize, false, true); + tilePropsUniformBuffer = context.createUniformBuffer( + tilePropsUBOVector.data(), tilePropsUBOVectorSize, false, true); } else { tilePropsUniformBuffer->update(tilePropsUBOVector.data(), tilePropsUBOVectorSize); } diff --git a/src/mbgl/renderer/layers/fill_layer_tweaker.cpp b/src/mbgl/renderer/layers/fill_layer_tweaker.cpp index 8530629f11d..3058fe8dc19 100644 --- a/src/mbgl/renderer/layers/fill_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/fill_layer_tweaker.cpp @@ -252,14 +252,16 @@ void FillLayerTweaker::execute(LayerGroupBase& layerGroup, const PaintParameters #if MLN_UBO_CONSOLIDATION const size_t drawableUBOVectorSize = sizeof(FillDrawableUnionUBO) * drawableUBOVector.size(); if (!drawableUniformBuffer || drawableUniformBuffer->getSize() < drawableUBOVectorSize) { - drawableUniformBuffer = context.createUniformBuffer(drawableUBOVector.data(), drawableUBOVectorSize, false, true); + drawableUniformBuffer = context.createUniformBuffer( + drawableUBOVector.data(), drawableUBOVectorSize, false, true); } else { drawableUniformBuffer->update(drawableUBOVector.data(), drawableUBOVectorSize); } const size_t tilePropsUBOVectorSize = sizeof(FillTilePropsUnionUBO) * tilePropsUBOVector.size(); if (!tilePropsUniformBuffer || tilePropsUniformBuffer->getSize() < tilePropsUBOVectorSize) { - tilePropsUniformBuffer = context.createUniformBuffer(tilePropsUBOVector.data(), tilePropsUBOVectorSize, false, true); + tilePropsUniformBuffer = context.createUniformBuffer( + tilePropsUBOVector.data(), tilePropsUBOVectorSize, false, true); } else { tilePropsUniformBuffer->update(tilePropsUBOVector.data(), tilePropsUBOVectorSize); } diff --git a/src/mbgl/renderer/layers/heatmap_layer_tweaker.cpp b/src/mbgl/renderer/layers/heatmap_layer_tweaker.cpp index 5572a8ba1ac..7d3e45c5a4f 100644 --- a/src/mbgl/renderer/layers/heatmap_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/heatmap_layer_tweaker.cpp @@ -93,7 +93,8 @@ void HeatmapLayerTweaker::execute(LayerGroupBase& layerGroup, const PaintParamet #if MLN_UBO_CONSOLIDATION const size_t drawableUBOVectorSize = sizeof(HeatmapDrawableUBO) * drawableUBOVector.size(); if (!drawableUniformBuffer || drawableUniformBuffer->getSize() < drawableUBOVectorSize) { - drawableUniformBuffer = context.createUniformBuffer(drawableUBOVector.data(), drawableUBOVectorSize, false, true); + drawableUniformBuffer = context.createUniformBuffer( + drawableUBOVector.data(), drawableUBOVectorSize, false, true); } else { drawableUniformBuffer->update(drawableUBOVector.data(), drawableUBOVectorSize); } diff --git a/src/mbgl/renderer/layers/hillshade_layer_tweaker.cpp b/src/mbgl/renderer/layers/hillshade_layer_tweaker.cpp index db085271f14..510c700ed75 100644 --- a/src/mbgl/renderer/layers/hillshade_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/hillshade_layer_tweaker.cpp @@ -100,14 +100,16 @@ void HillshadeLayerTweaker::execute(LayerGroupBase& layerGroup, const PaintParam auto& context = parameters.context; const size_t drawableUBOVectorSize = sizeof(HillshadeDrawableUBO) * drawableUBOVector.size(); if (!drawableUniformBuffer || drawableUniformBuffer->getSize() < drawableUBOVectorSize) { - drawableUniformBuffer = context.createUniformBuffer(drawableUBOVector.data(), drawableUBOVectorSize, false, true); + drawableUniformBuffer = context.createUniformBuffer( + drawableUBOVector.data(), drawableUBOVectorSize, false, true); } else { drawableUniformBuffer->update(drawableUBOVector.data(), drawableUBOVectorSize); } const size_t tilePropsUBOVectorSize = sizeof(HillshadeTilePropsUBO) * tilePropsUBOVector.size(); if (!tilePropsUniformBuffer || tilePropsUniformBuffer->getSize() < tilePropsUBOVectorSize) { - tilePropsUniformBuffer = context.createUniformBuffer(tilePropsUBOVector.data(), tilePropsUBOVectorSize, false, true); + tilePropsUniformBuffer = context.createUniformBuffer( + tilePropsUBOVector.data(), tilePropsUBOVectorSize, false, true); } else { tilePropsUniformBuffer->update(tilePropsUBOVector.data(), tilePropsUBOVectorSize); } diff --git a/src/mbgl/renderer/layers/line_layer_tweaker.cpp b/src/mbgl/renderer/layers/line_layer_tweaker.cpp index 87596e1f7c6..888a83011e2 100644 --- a/src/mbgl/renderer/layers/line_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/line_layer_tweaker.cpp @@ -364,14 +364,16 @@ void LineLayerTweaker::execute(LayerGroupBase& layerGroup, const PaintParameters #if MLN_UBO_CONSOLIDATION const size_t drawableUBOVectorSize = sizeof(LineDrawableUnionUBO) * drawableUBOVector.size(); if (!drawableUniformBuffer || drawableUniformBuffer->getSize() < drawableUBOVectorSize) { - drawableUniformBuffer = context.createUniformBuffer(drawableUBOVector.data(), drawableUBOVectorSize, false, true); + drawableUniformBuffer = context.createUniformBuffer( + drawableUBOVector.data(), drawableUBOVectorSize, false, true); } else { drawableUniformBuffer->update(drawableUBOVector.data(), drawableUBOVectorSize); } const size_t tilePropsUBOVectorSize = sizeof(LineTilePropsUnionUBO) * tilePropsUBOVector.size(); if (!tilePropsUniformBuffer || tilePropsUniformBuffer->getSize() < tilePropsUBOVectorSize) { - tilePropsUniformBuffer = context.createUniformBuffer(tilePropsUBOVector.data(), tilePropsUBOVectorSize, false, true); + tilePropsUniformBuffer = context.createUniformBuffer( + tilePropsUBOVector.data(), tilePropsUBOVectorSize, false, true); } else { tilePropsUniformBuffer->update(tilePropsUBOVector.data(), tilePropsUBOVectorSize); } diff --git a/src/mbgl/renderer/layers/raster_layer_tweaker.cpp b/src/mbgl/renderer/layers/raster_layer_tweaker.cpp index 0303017fc19..e195d3b681d 100644 --- a/src/mbgl/renderer/layers/raster_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/raster_layer_tweaker.cpp @@ -119,7 +119,8 @@ void RasterLayerTweaker::execute([[maybe_unused]] LayerGroupBase& layerGroup, auto& context = parameters.context; const size_t drawableUBOVectorSize = sizeof(RasterDrawableUBO) * drawableUBOVector.size(); if (!drawableUniformBuffer || drawableUniformBuffer->getSize() < drawableUBOVectorSize) { - drawableUniformBuffer = context.createUniformBuffer(drawableUBOVector.data(), drawableUBOVectorSize, false, true); + drawableUniformBuffer = context.createUniformBuffer( + drawableUBOVector.data(), drawableUBOVectorSize, false, true); } else { drawableUniformBuffer->update(drawableUBOVector.data(), drawableUBOVectorSize); } diff --git a/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp b/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp index e2e7a8ea781..d99a5d6875f 100644 --- a/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/symbol_layer_tweaker.cpp @@ -203,14 +203,16 @@ void SymbolLayerTweaker::execute(LayerGroupBase& layerGroup, const PaintParamete #if MLN_UBO_CONSOLIDATION const size_t drawableUBOVectorSize = sizeof(SymbolDrawableUBO) * drawableUBOVector.size(); if (!drawableUniformBuffer || drawableUniformBuffer->getSize() < drawableUBOVectorSize) { - drawableUniformBuffer = context.createUniformBuffer(drawableUBOVector.data(), drawableUBOVectorSize, false, true); + drawableUniformBuffer = context.createUniformBuffer( + drawableUBOVector.data(), drawableUBOVectorSize, false, true); } else { drawableUniformBuffer->update(drawableUBOVector.data(), drawableUBOVectorSize); } const size_t tilePropsUBOVectorSize = sizeof(SymbolTilePropsUBO) * tilePropsUBOVector.size(); if (!tilePropsUniformBuffer || tilePropsUniformBuffer->getSize() < tilePropsUBOVectorSize) { - tilePropsUniformBuffer = context.createUniformBuffer(tilePropsUBOVector.data(), tilePropsUBOVectorSize, false, true); + tilePropsUniformBuffer = context.createUniformBuffer( + tilePropsUBOVector.data(), tilePropsUBOVectorSize, false, true); } else { tilePropsUniformBuffer->update(tilePropsUBOVector.data(), tilePropsUBOVectorSize); } diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index bd3631d4af0..f28165ca2c8 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -253,7 +253,7 @@ void Renderer::Impl::render(const RenderTree& renderTree, // Update the debug layer groups orchestrator.updateDebugLayerGroups(renderTree, parameters); - + // Tweakers are run in the upload pass so they can set up uniforms. parameters.currentLayer = 0; orchestrator.visitLayerGroups([&](LayerGroupBase& layerGroup) { diff --git a/src/mbgl/renderer/sources/render_tile_source.cpp b/src/mbgl/renderer/sources/render_tile_source.cpp index 5a0ebe4b8a1..1f19253121b 100644 --- a/src/mbgl/renderer/sources/render_tile_source.cpp +++ b/src/mbgl/renderer/sources/render_tile_source.cpp @@ -108,7 +108,7 @@ class PolylineLayerTweaker : public LayerTweaker { /* .floorWidth = */ nullptr, }; layerUniforms.createOrUpdate(idLineExpressionUBO, &exprUBO, context); - + #if MLN_UBO_CONSOLIDATION int i = 0; std::vector drawableUBOVector(layerGroup.getDrawableCount()); @@ -140,7 +140,8 @@ class PolylineLayerTweaker : public LayerTweaker { /* .gapwidth_t = */ 0.f, /* .offset_t = */ 0.f, /* .width_t = */ 0.f, - /* .pad1 = */ 0}; + /* .pad1 = */ 0 + }; #if MLN_UBO_CONSOLIDATION drawable.setUBOIndex(i++); @@ -153,7 +154,8 @@ class PolylineLayerTweaker : public LayerTweaker { #if MLN_UBO_CONSOLIDATION const size_t drawableUBOVectorSize = sizeof(LineDrawableUnionUBO) * drawableUBOVector.size(); if (!drawableUniformBuffer || drawableUniformBuffer->getSize() < drawableUBOVectorSize) { - drawableUniformBuffer = context.createUniformBuffer(drawableUBOVector.data(), drawableUBOVectorSize, false, true); + drawableUniformBuffer = context.createUniformBuffer( + drawableUBOVector.data(), drawableUBOVectorSize, false, true); } else { drawableUniformBuffer->update(drawableUBOVector.data(), drawableUBOVectorSize); } @@ -336,7 +338,7 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr drawable->setTileID(tile.getOverscaledTileID()); tileLayerGroup->addDrawable(renderPass, tile.getOverscaledTileID(), std::move(drawable)); } - + if (!layerTweaker) { layerTweaker = std::make_shared(linePropertiesUBO); tileLayerGroup->addLayerTweaker(layerTweaker); @@ -428,13 +430,12 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr addPolylineDrawable(tileLayerGroup, tile); } #else - const DebugUBO debugUBO = { - /* .matrix = */ util::cast(tile.matrix), - /* .color = */ Color::red(), - /* .overlay_scale = */ 1.0f, - /* .pad1 = */ 0, - /* .pad2 = */ 0, - /* .pad3 = */ 0}; + const DebugUBO debugUBO = {/* .matrix = */ util::cast(tile.matrix), + /* .color = */ Color::red(), + /* .overlay_scale = */ 1.0f, + /* .pad1 = */ 0, + /* .pad2 = */ 0, + /* .pad3 = */ 0}; if (0 == updateDrawables(tileLayerGroup, tileID, debugUBO) && tile.getNeedsRendering()) { addDrawable(tileLayerGroup, diff --git a/src/mbgl/style/layers/custom_drawable_layer.cpp b/src/mbgl/style/layers/custom_drawable_layer.cpp index 45477520a95..6ffd5a4bc41 100644 --- a/src/mbgl/style/layers/custom_drawable_layer.cpp +++ b/src/mbgl/style/layers/custom_drawable_layer.cpp @@ -116,7 +116,7 @@ class LineDrawableTweaker : public gfx::DrawableTweaker { #endif /* .matrix = */ util::cast(matrix), /* .ratio = */ 1.0f / tileID.pixelsToTileUnits(1.0f, zoom), - + /* .color_t = */ 0.f, /* .blur_t = */ 0.f, /* .opacity_t = */ 0.f, @@ -131,7 +131,7 @@ class LineDrawableTweaker : public gfx::DrawableTweaker { // We would need to set up `idLineExpressionUBO` if the expression mask isn't empty assert(propsUBO.expressionMask == LineExpressionMask::None); - + const LineExpressionUBO exprUBO = { /* .color = */ nullptr, /* .blur = */ nullptr, @@ -241,21 +241,19 @@ class FillDrawableTweaker : public gfx::DrawableTweaker { const shaders::FillDrawableUBO drawableUBO = { #endif /* .matrix = */ util::cast(matrix), - + /* .color_t = */ 0.f, /* .opacity_t = */ 0.f, /* .pad1 = */ 0, /* .pad2 = */ 0 }; - const shaders::FillEvaluatedPropsUBO propsUBO = { - /* .color = */ color, - /* .outline_color = */ Color::white(), - /* .opacity = */ opacity, - /* .fade = */ 0.f, - /* .from_scale = */ 0.f, - /* .to_scale = */ 0.f - }; + const shaders::FillEvaluatedPropsUBO propsUBO = {/* .color = */ color, + /* .outline_color = */ Color::white(), + /* .opacity = */ opacity, + /* .fade = */ 0.f, + /* .from_scale = */ 0.f, + /* .to_scale = */ 0.f}; auto& drawableUniforms = drawable.mutableUniformBuffers(); drawableUniforms.createOrUpdate(idFillDrawableUBO, &drawableUBO, parameters.context); drawableUniforms.createOrUpdate(idFillEvaluatedPropsUBO, &propsUBO, parameters.context); diff --git a/src/mbgl/vulkan/buffer_resource.cpp b/src/mbgl/vulkan/buffer_resource.cpp index bff075701c5..c86365bc29e 100644 --- a/src/mbgl/vulkan/buffer_resource.cpp +++ b/src/mbgl/vulkan/buffer_resource.cpp @@ -62,7 +62,7 @@ BufferResource::BufferResource( const auto& align = deviceProps.limits.minUniformBufferOffsetAlignment; bufferWindowSize = (size + align - 1) & ~(align - 1); - //assert(bufferWindowSize != 0); + // assert(bufferWindowSize != 0); totalSize = bufferWindowSize * backend.getMaxFrames(); } diff --git a/src/mbgl/vulkan/context.cpp b/src/mbgl/vulkan/context.cpp index 5e0dacd4f2b..c7c11e5396c 100644 --- a/src/mbgl/vulkan/context.cpp +++ b/src/mbgl/vulkan/context.cpp @@ -73,13 +73,13 @@ void Context::initFrameResources() { const auto& device = backend.getDevice(); const auto frameCount = backend.getMaxFrames(); - descriptorPoolMap.emplace( - DescriptorSetType::Global, - DescriptorPoolGrowable(globalDescriptorPoolSize, 0, shaders::globalUBOCount, 0)); + descriptorPoolMap.emplace(DescriptorSetType::Global, + DescriptorPoolGrowable(globalDescriptorPoolSize, 0, shaders::globalUBOCount, 0)); descriptorPoolMap.emplace( DescriptorSetType::Layer, - DescriptorPoolGrowable(layerDescriptorPoolSize, shaders::maxSSBOCountPerLayer, shaders::maxUBOCountPerLayer, 0)); + DescriptorPoolGrowable( + layerDescriptorPoolSize, shaders::maxSSBOCountPerLayer, shaders::maxUBOCountPerLayer, 0)); descriptorPoolMap.emplace( DescriptorSetType::DrawableUniform, @@ -362,7 +362,8 @@ gfx::UniqueDrawableBuilder Context::createDrawableBuilder(std::string name) { } gfx::UniformBufferPtr Context::createUniformBuffer(const void* data, std::size_t size, bool persistent, bool ssbo) { - return std::make_shared(createBuffer(data, size, ssbo ? VK_BUFFER_USAGE_STORAGE_BUFFER_BIT : VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, persistent)); + return std::make_shared(createBuffer( + data, size, ssbo ? VK_BUFFER_USAGE_STORAGE_BUFFER_BIT : VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, persistent)); } gfx::ShaderProgramBasePtr Context::getGenericShader(gfx::ShaderRegistry& shaders, const std::string& name) { @@ -578,7 +579,8 @@ const std::unique_ptr& Context::getDummyUniformBuffer() { const std::unique_ptr& Context::getDummyStorageBuffer() { if (!dummyStorageBuffer) - dummyStorageBuffer = std::make_unique(*this, nullptr, 16, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, false); + dummyStorageBuffer = std::make_unique( + *this, nullptr, 16, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, false); return dummyStorageBuffer; } @@ -614,7 +616,8 @@ void Context::buildUniformDescriptorSetLayout(vk::UniqueDescriptorSetLayout& lay stageFlags |= vk::ShaderStageFlagBits::eFragment; } - const auto descriptorType = i < storageCount ? vk::DescriptorType::eStorageBuffer : vk::DescriptorType::eUniformBuffer; + const auto descriptorType = i < storageCount ? vk::DescriptorType::eStorageBuffer + : vk::DescriptorType::eUniformBuffer; bindings.push_back(vk::DescriptorSetLayoutBinding() .setBinding(static_cast(i)) diff --git a/src/mbgl/vulkan/descriptor_set.cpp b/src/mbgl/vulkan/descriptor_set.cpp index 8e13302b6f0..ed688f92d05 100644 --- a/src/mbgl/vulkan/descriptor_set.cpp +++ b/src/mbgl/vulkan/descriptor_set.cpp @@ -43,16 +43,18 @@ void DescriptorSet::createDescriptorPool(DescriptorPoolGrowable& growablePool) { const auto poolFlags = vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet; #endif - std::vector sizes; if (growablePool.descriptorStoragePerSet > 0) { - sizes.emplace_back(vk::DescriptorPoolSize(vk::DescriptorType::eStorageBuffer, maxSets * growablePool.descriptorStoragePerSet)); + sizes.emplace_back( + vk::DescriptorPoolSize(vk::DescriptorType::eStorageBuffer, maxSets * growablePool.descriptorStoragePerSet)); } if (growablePool.descriptorUniformsPerSet > 0) { - sizes.emplace_back(vk::DescriptorPoolSize(vk::DescriptorType::eUniformBuffer, maxSets * growablePool.descriptorUniformsPerSet)); + sizes.emplace_back(vk::DescriptorPoolSize(vk::DescriptorType::eUniformBuffer, + maxSets * growablePool.descriptorUniformsPerSet)); } if (growablePool.descriptorTexturesPerSet > 0) { - sizes.emplace_back(vk::DescriptorPoolSize(vk::DescriptorType::eCombinedImageSampler, maxSets * growablePool.descriptorTexturesPerSet)); + sizes.emplace_back(vk::DescriptorPoolSize(vk::DescriptorType::eCombinedImageSampler, + maxSets * growablePool.descriptorTexturesPerSet)); } const auto descriptorPoolInfo = vk::DescriptorPoolCreateInfo(poolFlags).setPoolSizes(sizes).setMaxSets(maxSets); @@ -163,13 +165,13 @@ void UniformDescriptorSet::update(const gfx::UniformBufferArray& uniforms, .setOffset(bufferResource.getVulkanBufferOffset()) .setRange(bufferResource.getSizeInBytes()); } else { - const auto& dummyBuffer = index < descriptorStorageCount ? context.getDummyStorageBuffer() : context.getDummyUniformBuffer(); - descriptorBufferInfo.setBuffer(dummyBuffer->getVulkanBuffer()) - .setOffset(0) - .setRange(VK_WHOLE_SIZE); + const auto& dummyBuffer = index < descriptorStorageCount ? context.getDummyStorageBuffer() + : context.getDummyUniformBuffer(); + descriptorBufferInfo.setBuffer(dummyBuffer->getVulkanBuffer()).setOffset(0).setRange(VK_WHOLE_SIZE); } - const auto descriptorType = index < descriptorStorageCount ? vk::DescriptorType::eStorageBuffer : vk::DescriptorType::eUniformBuffer; + const auto descriptorType = index < descriptorStorageCount ? vk::DescriptorType::eStorageBuffer + : vk::DescriptorType::eUniformBuffer; const auto writeDescriptorSet = vk::WriteDescriptorSet() .setBufferInfo(descriptorBufferInfo) diff --git a/src/mbgl/vulkan/drawable_impl.hpp b/src/mbgl/vulkan/drawable_impl.hpp index 432b93211b6..a159fa6adc0 100644 --- a/src/mbgl/vulkan/drawable_impl.hpp +++ b/src/mbgl/vulkan/drawable_impl.hpp @@ -24,8 +24,8 @@ using namespace platform; class Drawable::Impl final { public: Impl() - : uniformBuffers(DescriptorSetType::DrawableUniform, shaders::globalUBOCount, 0, shaders::maxUBOCountPerDrawable) { - } + : uniformBuffers( + DescriptorSetType::DrawableUniform, shaders::globalUBOCount, 0, shaders::maxUBOCountPerDrawable) {} ~Impl() = default; diff --git a/src/mbgl/vulkan/layer_group.cpp b/src/mbgl/vulkan/layer_group.cpp index 0bbefe9f2ef..9d9d57fba07 100644 --- a/src/mbgl/vulkan/layer_group.cpp +++ b/src/mbgl/vulkan/layer_group.cpp @@ -16,7 +16,10 @@ namespace vulkan { LayerGroup::LayerGroup(int32_t layerIndex_, std::size_t initialCapacity, std::string name_) : mbgl::LayerGroup(layerIndex_, initialCapacity, std::move(name_)), - uniformBuffers(DescriptorSetType::Layer, shaders::globalUBOCount, shaders::maxSSBOCountPerLayer, shaders::maxUBOCountPerLayer) {} + uniformBuffers(DescriptorSetType::Layer, + shaders::globalUBOCount, + shaders::maxSSBOCountPerLayer, + shaders::maxUBOCountPerLayer) {} void LayerGroup::upload(gfx::UploadPass& uploadPass) { if (!enabled) { diff --git a/src/mbgl/vulkan/tile_layer_group.cpp b/src/mbgl/vulkan/tile_layer_group.cpp index 16246a98942..f1326b13b6f 100644 --- a/src/mbgl/vulkan/tile_layer_group.cpp +++ b/src/mbgl/vulkan/tile_layer_group.cpp @@ -17,7 +17,10 @@ namespace vulkan { TileLayerGroup::TileLayerGroup(int32_t layerIndex_, std::size_t initialCapacity, std::string name_) : mbgl::TileLayerGroup(layerIndex_, initialCapacity, std::move(name_)), - uniformBuffers(DescriptorSetType::Layer, shaders::globalUBOCount, shaders::maxSSBOCountPerLayer, shaders::maxUBOCountPerLayer) {} + uniformBuffers(DescriptorSetType::Layer, + shaders::globalUBOCount, + shaders::maxSSBOCountPerLayer, + shaders::maxUBOCountPerLayer) {} void TileLayerGroup::upload(gfx::UploadPass& uploadPass) { if (!enabled || !getDrawableCount()) {