From 33100e3a7cb8fdba119d1b68ee3958fada06be97 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 22:28:51 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- include/mbgl/gfx/uniform_buffer.hpp | 6 +- include/mbgl/shaders/gl/shader_program_gl.hpp | 4 +- include/mbgl/shaders/mtl/background.hpp | 2 +- include/mbgl/shaders/mtl/debug.hpp | 2 +- include/mbgl/shaders/mtl/fill.hpp | 4 +- include/mbgl/shaders/mtl/fill_extrusion.hpp | 2 +- .../mbgl/shaders/mtl/hillshade_prepare.hpp | 2 +- include/mbgl/shaders/mtl/line.hpp | 2 +- include/mbgl/shaders/mtl/symbol.hpp | 4 +- include/mbgl/shaders/vulkan/background.hpp | 2 +- include/mbgl/shaders/vulkan/circle.hpp | 2 +- .../shaders/vulkan/custom_symbol_icon.hpp | 2 +- include/mbgl/shaders/vulkan/fill.hpp | 4 +- .../mbgl/shaders/vulkan/fill_extrusion.hpp | 2 +- include/mbgl/shaders/vulkan/line.hpp | 2 +- include/mbgl/shaders/vulkan/symbol.hpp | 2 +- include/mbgl/vulkan/uniform_buffer.hpp | 7 +- src/mbgl/gfx/uniform_buffer.cpp | 13 +- src/mbgl/shaders/gl/shader_info.cpp | 145 +++++++++--------- src/mbgl/vulkan/context.cpp | 15 +- 20 files changed, 111 insertions(+), 113 deletions(-) diff --git a/include/mbgl/gfx/uniform_buffer.hpp b/include/mbgl/gfx/uniform_buffer.hpp index a1d9023b304..d1acdc94ae2 100644 --- a/include/mbgl/gfx/uniform_buffer.hpp +++ b/include/mbgl/gfx/uniform_buffer.hpp @@ -62,12 +62,10 @@ class UniformBufferArray { const std::shared_ptr& get(const size_t id) const; /// Set a new uniform buffer element or replace the existing one. - virtual const std::shared_ptr& set(const size_t id, - std::shared_ptr uniformBuffer); + virtual const std::shared_ptr& set(const size_t id, std::shared_ptr uniformBuffer); /// Create and add a new buffer or update an existing one - void createOrUpdate( - const size_t id, const std::vector& data, gfx::Context&, bool persistent = false); + void createOrUpdate(const size_t id, const std::vector& data, gfx::Context&, bool persistent = false); virtual void createOrUpdate( const size_t id, const void* data, std::size_t size, gfx::Context&, bool persistent = false); template diff --git a/include/mbgl/shaders/gl/shader_program_gl.hpp b/include/mbgl/shaders/gl/shader_program_gl.hpp index cc4c778b648..df370fa17b2 100644 --- a/include/mbgl/shaders/gl/shader_program_gl.hpp +++ b/include/mbgl/shaders/gl/shader_program_gl.hpp @@ -19,9 +19,7 @@ class ShaderProgramGL final : public gfx::ShaderProgramBase { using SamplerLocationArray = std::array, shaders::maxTextureCountPerShader>; ShaderProgramGL(UniqueProgram&& glProgram_); - ShaderProgramGL(UniqueProgram&&, - VertexAttributeArrayGL&& attributes, - SamplerLocationArray&& samplerLocations); + ShaderProgramGL(UniqueProgram&&, VertexAttributeArrayGL&& attributes, SamplerLocationArray&& samplerLocations); ShaderProgramGL(ShaderProgramGL&& other); ~ShaderProgramGL() noexcept override = default; diff --git a/include/mbgl/shaders/mtl/background.hpp b/include/mbgl/shaders/mtl/background.hpp index 3d307ecedc1..cb683aefde7 100644 --- a/include/mbgl/shaders/mtl/background.hpp +++ b/include/mbgl/shaders/mtl/background.hpp @@ -80,7 +80,7 @@ struct ShaderSource { static constexpr auto vertexMainFunction = "vertexMain"; static constexpr auto fragmentMainFunction = "fragmentMain"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/mtl/debug.hpp b/include/mbgl/shaders/mtl/debug.hpp index 5300da6ef0d..633c6a0a985 100644 --- a/include/mbgl/shaders/mtl/debug.hpp +++ b/include/mbgl/shaders/mtl/debug.hpp @@ -34,7 +34,7 @@ struct ShaderSource { static constexpr auto vertexMainFunction = "vertexMain"; static constexpr auto fragmentMainFunction = "fragmentMain"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/mtl/fill.hpp b/include/mbgl/shaders/mtl/fill.hpp index a46a2907066..b589a8dca4d 100644 --- a/include/mbgl/shaders/mtl/fill.hpp +++ b/include/mbgl/shaders/mtl/fill.hpp @@ -147,7 +147,7 @@ struct ShaderSource { static constexpr auto vertexMainFunction = "vertexMain"; static constexpr auto fragmentMainFunction = "fragmentMain"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; @@ -439,7 +439,7 @@ struct ShaderSource attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/mtl/fill_extrusion.hpp b/include/mbgl/shaders/mtl/fill_extrusion.hpp index 440df5ba361..c6540fabed7 100644 --- a/include/mbgl/shaders/mtl/fill_extrusion.hpp +++ b/include/mbgl/shaders/mtl/fill_extrusion.hpp @@ -189,7 +189,7 @@ struct ShaderSource attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/mtl/hillshade_prepare.hpp b/include/mbgl/shaders/mtl/hillshade_prepare.hpp index 450399b85a6..8b3770b4d61 100644 --- a/include/mbgl/shaders/mtl/hillshade_prepare.hpp +++ b/include/mbgl/shaders/mtl/hillshade_prepare.hpp @@ -39,7 +39,7 @@ struct ShaderSource static constexpr auto vertexMainFunction = "vertexMain"; static constexpr auto fragmentMainFunction = "fragmentMain"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/mtl/line.hpp b/include/mbgl/shaders/mtl/line.hpp index f9656143ff0..b95c3d0c666 100644 --- a/include/mbgl/shaders/mtl/line.hpp +++ b/include/mbgl/shaders/mtl/line.hpp @@ -757,7 +757,7 @@ struct ShaderSource { static constexpr auto vertexMainFunction = "vertexMain"; static constexpr auto fragmentMainFunction = "fragmentMain"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/mtl/symbol.hpp b/include/mbgl/shaders/mtl/symbol.hpp index 496b3239a7a..e3e9bcf9158 100644 --- a/include/mbgl/shaders/mtl/symbol.hpp +++ b/include/mbgl/shaders/mtl/symbol.hpp @@ -79,7 +79,7 @@ struct ShaderSource { static constexpr auto vertexMainFunction = "vertexMain"; static constexpr auto fragmentMainFunction = "fragmentMain"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; @@ -422,7 +422,7 @@ struct ShaderSource static constexpr auto vertexMainFunction = "vertexMain"; static constexpr auto fragmentMainFunction = "fragmentMain"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/vulkan/background.hpp b/include/mbgl/shaders/vulkan/background.hpp index ec9b6ef0284..a1946e249a5 100644 --- a/include/mbgl/shaders/vulkan/background.hpp +++ b/include/mbgl/shaders/vulkan/background.hpp @@ -63,7 +63,7 @@ template <> struct ShaderSource { static constexpr const char* name = "BackgroundPatternShader"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/vulkan/circle.hpp b/include/mbgl/shaders/vulkan/circle.hpp index b96c2689273..a68a38e89a9 100644 --- a/include/mbgl/shaders/vulkan/circle.hpp +++ b/include/mbgl/shaders/vulkan/circle.hpp @@ -18,7 +18,7 @@ template <> struct ShaderSource { static constexpr const char* name = "CircleShader"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/vulkan/custom_symbol_icon.hpp b/include/mbgl/shaders/vulkan/custom_symbol_icon.hpp index ce0e3763877..f294035d436 100644 --- a/include/mbgl/shaders/vulkan/custom_symbol_icon.hpp +++ b/include/mbgl/shaders/vulkan/custom_symbol_icon.hpp @@ -17,7 +17,7 @@ template <> struct ShaderSource { static constexpr const char* name = "CustomSymbolIconShader"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/vulkan/fill.hpp b/include/mbgl/shaders/vulkan/fill.hpp index 4920915449a..63cca0cf192 100644 --- a/include/mbgl/shaders/vulkan/fill.hpp +++ b/include/mbgl/shaders/vulkan/fill.hpp @@ -111,7 +111,7 @@ template <> struct ShaderSource { static constexpr const char* name = "FillOutlineShader"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; @@ -216,7 +216,7 @@ template <> struct ShaderSource { static constexpr const char* name = "FillPatternShader"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/vulkan/fill_extrusion.hpp b/include/mbgl/shaders/vulkan/fill_extrusion.hpp index c4f82e32392..6ad1da24fd3 100644 --- a/include/mbgl/shaders/vulkan/fill_extrusion.hpp +++ b/include/mbgl/shaders/vulkan/fill_extrusion.hpp @@ -19,7 +19,7 @@ template <> struct ShaderSource { static constexpr const char* name = "FillExtrusionShader"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/vulkan/line.hpp b/include/mbgl/shaders/vulkan/line.hpp index f47893a0f45..4dc3cdbd601 100644 --- a/include/mbgl/shaders/vulkan/line.hpp +++ b/include/mbgl/shaders/vulkan/line.hpp @@ -755,7 +755,7 @@ template <> struct ShaderSource { static constexpr const char* name = "LineSDFShader"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/shaders/vulkan/symbol.hpp b/include/mbgl/shaders/vulkan/symbol.hpp index c183b500530..dfca8285b51 100644 --- a/include/mbgl/shaders/vulkan/symbol.hpp +++ b/include/mbgl/shaders/vulkan/symbol.hpp @@ -188,7 +188,7 @@ template <> struct ShaderSource { static constexpr const char* name = "SymbolSDFIconShader"; - static const std::array attributes; + static const std::array attributes; static constexpr std::array instanceAttributes{}; static const std::array textures; diff --git a/include/mbgl/vulkan/uniform_buffer.hpp b/include/mbgl/vulkan/uniform_buffer.hpp index 68305401bce..83854bee3a2 100644 --- a/include/mbgl/vulkan/uniform_buffer.hpp +++ b/include/mbgl/vulkan/uniform_buffer.hpp @@ -53,11 +53,8 @@ class UniformBufferArray final : public gfx::UniformBufferArray { const std::shared_ptr& set(const size_t id, std::shared_ptr uniformBuffer) override; - void createOrUpdate(const size_t id, - const void* data, - std::size_t size, - gfx::Context& context, - bool persistent = false) override; + void createOrUpdate( + const size_t id, const void* data, std::size_t size, gfx::Context& context, bool persistent = false) override; void bindDescriptorSets(CommandEncoder& encoder); void freeDescriptorSets() { descriptorSet.reset(); } diff --git a/src/mbgl/gfx/uniform_buffer.cpp b/src/mbgl/gfx/uniform_buffer.cpp index bf4edd7f6d6..5f357b99944 100644 --- a/src/mbgl/gfx/uniform_buffer.cpp +++ b/src/mbgl/gfx/uniform_buffer.cpp @@ -36,16 +36,15 @@ const std::shared_ptr& UniformBufferArray::set(const size_t id, return uniformBufferVector[id]; } -void UniformBufferArray::createOrUpdate( - const size_t id, const std::vector& data, gfx::Context& context, bool persistent) { - createOrUpdate(id, data.data(), data.size(), context, persistent); -} - void UniformBufferArray::createOrUpdate(const size_t id, - const void* data, - const std::size_t size, + const std::vector& data, gfx::Context& context, bool persistent) { + createOrUpdate(id, data.data(), data.size(), context, persistent); +} + +void UniformBufferArray::createOrUpdate( + const size_t id, const void* data, const std::size_t size, gfx::Context& context, bool persistent) { if (auto& ubo = get(id); ubo && ubo->getSize() == size) { ubo->update(data, size); } else { diff --git a/src/mbgl/shaders/gl/shader_info.cpp b/src/mbgl/shaders/gl/shader_info.cpp index e017a8ce117..c51b8da8b0e 100644 --- a/src/mbgl/shaders/gl/shader_info.cpp +++ b/src/mbgl/shaders/gl/shader_info.cpp @@ -18,7 +18,7 @@ TextureInfo::TextureInfo(std::string_view name_, std::size_t id_) id(id_) {} // Background -using BackgroundShaderInfo= ShaderInfo; +using BackgroundShaderInfo = ShaderInfo; const std::vector BackgroundShaderInfo::uniformBlocks = { UniformBlockInfo{"BackgroundDrawableUBO", idBackgroundDrawableUBO}, @@ -33,12 +33,12 @@ const std::vector BackgroundShaderInfo::textures = {}; using BackgroundPatternShaderInfo = ShaderInfo; const std::vector BackgroundPatternShaderInfo::uniformBlocks = { - UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, - UniformBlockInfo{"BackgroundPatternDrawableUBO", idBackgroundDrawableUBO}, - UniformBlockInfo{"BackgroundPatternPropsUBO", idBackgroundPropsUBO}, + UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, + UniformBlockInfo{"BackgroundPatternDrawableUBO", idBackgroundDrawableUBO}, + UniformBlockInfo{"BackgroundPatternPropsUBO", idBackgroundPropsUBO}, }; const std::vector BackgroundPatternShaderInfo::attributes = { - AttributeInfo{"a_pos", idBackgroundPosVertexAttribute}, + AttributeInfo{"a_pos", idBackgroundPosVertexAttribute}, }; const std::vector BackgroundPatternShaderInfo::textures = { TextureInfo{"u_image", idBackgroundImageTexture}, @@ -68,8 +68,8 @@ const std::vector CircleShaderInfo::textures = {}; using CollisionBoxShaderInfo = ShaderInfo; const std::vector CollisionBoxShaderInfo::uniformBlocks = { - UniformBlockInfo{"CollisionDrawableUBO", idCollisionDrawableUBO}, - UniformBlockInfo{"CollisionTilePropsUBO", idCollisionTilePropsUBO}, + UniformBlockInfo{"CollisionDrawableUBO", idCollisionDrawableUBO}, + UniformBlockInfo{"CollisionTilePropsUBO", idCollisionTilePropsUBO}, }; const std::vector CollisionBoxShaderInfo::attributes = { AttributeInfo{"a_pos", idCollisionPosVertexAttribute}, @@ -84,8 +84,8 @@ const std::vector CollisionBoxShaderInfo::textures = {}; using CollisionCircleShaderInfo = ShaderInfo; const std::vector CollisionCircleShaderInfo::uniformBlocks = { - UniformBlockInfo{"CollisionDrawableUBO", idCollisionDrawableUBO}, - UniformBlockInfo{"CollisionTilePropsUBO", idCollisionTilePropsUBO}, + UniformBlockInfo{"CollisionDrawableUBO", idCollisionDrawableUBO}, + UniformBlockInfo{"CollisionTilePropsUBO", idCollisionTilePropsUBO}, }; const std::vector CollisionCircleShaderInfo::attributes = { AttributeInfo{"a_pos", idCollisionPosVertexAttribute}, @@ -99,7 +99,7 @@ const std::vector CollisionCircleShaderInfo::textures = {}; using CustomSymbolIconShaderInfo = ShaderInfo; const std::vector CustomSymbolIconShaderInfo::uniformBlocks = { - UniformBlockInfo{"CustomSymbolIconDrawableUBO", idCustomSymbolDrawableUBO}, + UniformBlockInfo{"CustomSymbolIconDrawableUBO", idCustomSymbolDrawableUBO}, }; const std::vector CustomSymbolIconShaderInfo::attributes = { AttributeInfo{"a_pos", idCustomSymbolPosVertexAttribute}, @@ -140,9 +140,9 @@ const std::vector FillShaderInfo::textures = {}; using FillOutlineShaderInfo = ShaderInfo; const std::vector FillOutlineShaderInfo::uniformBlocks = { - UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, - UniformBlockInfo{"FillOutlineDrawableUBO", idFillDrawableUBO}, - UniformBlockInfo{"FillEvaluatedPropsUBO", idFillEvaluatedPropsUBO}, + UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, + UniformBlockInfo{"FillOutlineDrawableUBO", idFillDrawableUBO}, + UniformBlockInfo{"FillEvaluatedPropsUBO", idFillEvaluatedPropsUBO}, }; const std::vector FillOutlineShaderInfo::attributes = { AttributeInfo{"a_pos", idFillPosVertexAttribute}, @@ -155,10 +155,10 @@ const std::vector FillOutlineShaderInfo::textures = {}; using FillPatternShaderInfo = ShaderInfo; const std::vector FillPatternShaderInfo::uniformBlocks = { - UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, - UniformBlockInfo{"FillPatternDrawableUBO", idFillDrawableUBO}, - UniformBlockInfo{"FillPatternTilePropsUBO", idFillTilePropsUBO}, - UniformBlockInfo{"FillEvaluatedPropsUBO", idFillEvaluatedPropsUBO}, + UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, + UniformBlockInfo{"FillPatternDrawableUBO", idFillDrawableUBO}, + UniformBlockInfo{"FillPatternTilePropsUBO", idFillTilePropsUBO}, + UniformBlockInfo{"FillEvaluatedPropsUBO", idFillEvaluatedPropsUBO}, }; const std::vector FillPatternShaderInfo::attributes = { AttributeInfo{"a_pos", idFillPosVertexAttribute}, @@ -174,32 +174,33 @@ const std::vector FillPatternShaderInfo::textures = { using FillOutlinePatternShaderInfo = ShaderInfo; const std::vector FillOutlinePatternShaderInfo::uniformBlocks = { - UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, - UniformBlockInfo{"FillOutlinePatternDrawableUBO", idFillDrawableUBO}, - UniformBlockInfo{"FillOutlinePatternTilePropsUBO", idFillTilePropsUBO}, - UniformBlockInfo{"FillEvaluatedPropsUBO", idFillEvaluatedPropsUBO}, + UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, + UniformBlockInfo{"FillOutlinePatternDrawableUBO", idFillDrawableUBO}, + UniformBlockInfo{"FillOutlinePatternTilePropsUBO", idFillTilePropsUBO}, + UniformBlockInfo{"FillEvaluatedPropsUBO", idFillEvaluatedPropsUBO}, }; const std::vector FillOutlinePatternShaderInfo::attributes = { - AttributeInfo{"a_pos", idFillPosVertexAttribute}, - AttributeInfo{"a_opacity", idFillOpacityVertexAttribute}, - AttributeInfo{"a_pattern_from", idFillPatternFromVertexAttribute}, - AttributeInfo{"a_pattern_to", idFillPatternToVertexAttribute}, + AttributeInfo{"a_pos", idFillPosVertexAttribute}, + AttributeInfo{"a_opacity", idFillOpacityVertexAttribute}, + AttributeInfo{"a_pattern_from", idFillPatternFromVertexAttribute}, + AttributeInfo{"a_pattern_to", idFillPatternToVertexAttribute}, }; const std::vector FillOutlinePatternShaderInfo::textures = { TextureInfo{"u_image", idFillImageTexture}, }; // Fill Outline Triangulated -using FillOutlineTriangulatedShaderInfo = ShaderInfo; +using FillOutlineTriangulatedShaderInfo = + ShaderInfo; const std::vector FillOutlineTriangulatedShaderInfo::uniformBlocks = { - UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, - UniformBlockInfo{"FillOutlineTriangulatedDrawableUBO", idFillDrawableUBO}, - UniformBlockInfo{"FillEvaluatedPropsUBO", idFillEvaluatedPropsUBO}, + UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, + UniformBlockInfo{"FillOutlineTriangulatedDrawableUBO", idFillDrawableUBO}, + UniformBlockInfo{"FillEvaluatedPropsUBO", idFillEvaluatedPropsUBO}, }; const std::vector FillOutlineTriangulatedShaderInfo::attributes = { - AttributeInfo{"a_pos_normal", idLinePosNormalVertexAttribute}, - AttributeInfo{"a_data", idLineDataVertexAttribute}, + AttributeInfo{"a_pos_normal", idLinePosNormalVertexAttribute}, + AttributeInfo{"a_data", idLineDataVertexAttribute}, }; const std::vector FillOutlineTriangulatedShaderInfo::textures = {}; @@ -207,9 +208,9 @@ const std::vector FillOutlineTriangulatedShaderInfo::textures = {}; using FillExtrusionShaderInfo = ShaderInfo; const std::vector FillExtrusionShaderInfo::uniformBlocks = { - UniformBlockInfo{"FillExtrusionDrawableUBO", idFillExtrusionDrawableUBO}, - UniformBlockInfo{"FillExtrusionTilePropsUBO", idFillExtrusionTilePropsUBO}, - UniformBlockInfo{"FillExtrusionPropsUBO", idFillExtrusionPropsUBO}, + UniformBlockInfo{"FillExtrusionDrawableUBO", idFillExtrusionDrawableUBO}, + UniformBlockInfo{"FillExtrusionTilePropsUBO", idFillExtrusionTilePropsUBO}, + UniformBlockInfo{"FillExtrusionPropsUBO", idFillExtrusionPropsUBO}, }; const std::vector FillExtrusionShaderInfo::attributes = { AttributeInfo{"a_pos", idFillExtrusionPosVertexAttribute}, @@ -224,18 +225,18 @@ const std::vector FillExtrusionShaderInfo::textures = {}; using FillExtrusionPatternShaderInfo = ShaderInfo; const std::vector FillExtrusionPatternShaderInfo::uniformBlocks = { - UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, - UniformBlockInfo{"FillExtrusionDrawableUBO", idFillExtrusionDrawableUBO}, - UniformBlockInfo{"FillExtrusionTilePropsUBO", idFillExtrusionTilePropsUBO}, - UniformBlockInfo{"FillExtrusionPropsUBO", idFillExtrusionPropsUBO}, + UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, + UniformBlockInfo{"FillExtrusionDrawableUBO", idFillExtrusionDrawableUBO}, + UniformBlockInfo{"FillExtrusionTilePropsUBO", idFillExtrusionTilePropsUBO}, + UniformBlockInfo{"FillExtrusionPropsUBO", idFillExtrusionPropsUBO}, }; const std::vector FillExtrusionPatternShaderInfo::attributes = { - AttributeInfo{"a_pos", idFillExtrusionPosVertexAttribute}, - AttributeInfo{"a_normal_ed", idFillExtrusionNormalEdVertexAttribute}, - AttributeInfo{"a_base", idFillExtrusionBaseVertexAttribute}, - AttributeInfo{"a_height", idFillExtrusionHeightVertexAttribute}, - AttributeInfo{"a_pattern_from", idFillExtrusionPatternFromVertexAttribute}, - AttributeInfo{"a_pattern_to", idFillExtrusionPatternToVertexAttribute}, + AttributeInfo{"a_pos", idFillExtrusionPosVertexAttribute}, + AttributeInfo{"a_normal_ed", idFillExtrusionNormalEdVertexAttribute}, + AttributeInfo{"a_base", idFillExtrusionBaseVertexAttribute}, + AttributeInfo{"a_height", idFillExtrusionHeightVertexAttribute}, + AttributeInfo{"a_pattern_from", idFillExtrusionPatternFromVertexAttribute}, + AttributeInfo{"a_pattern_to", idFillExtrusionPatternToVertexAttribute}, }; const std::vector FillExtrusionPatternShaderInfo::textures = { TextureInfo{"u_image", idFillExtrusionImageTexture}, @@ -259,8 +260,8 @@ const std::vector HeatmapShaderInfo::textures = {}; using HeatmapTextureShaderInfo = ShaderInfo; const std::vector HeatmapTextureShaderInfo::uniformBlocks = { - UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, - UniformBlockInfo{"HeatmapTexturePropsUBO", idHeatmapTexturePropsUBO}, + UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, + UniformBlockInfo{"HeatmapTexturePropsUBO", idHeatmapTexturePropsUBO}, }; const std::vector HeatmapTextureShaderInfo::attributes = { AttributeInfo{"a_pos", idHeatmapPosVertexAttribute}, @@ -274,8 +275,8 @@ const std::vector HeatmapTextureShaderInfo::textures = { using HillshadePrepareShaderInfo = ShaderInfo; const std::vector HillshadePrepareShaderInfo::uniformBlocks = { - UniformBlockInfo{"HillshadePrepareDrawableUBO", idHillshadePrepareDrawableUBO}, - UniformBlockInfo{"HillshadePrepareTilePropsUBO", idHillshadePrepareTilePropsUBO}, + UniformBlockInfo{"HillshadePrepareDrawableUBO", idHillshadePrepareDrawableUBO}, + UniformBlockInfo{"HillshadePrepareTilePropsUBO", idHillshadePrepareTilePropsUBO}, }; const std::vector HillshadePrepareShaderInfo::attributes = { AttributeInfo{"a_pos", idHillshadePosVertexAttribute}, @@ -325,9 +326,9 @@ const std::vector LineShaderInfo::textures = {}; using LineGradientShaderInfo = ShaderInfo; const std::vector LineGradientShaderInfo::uniformBlocks = { - UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, - UniformBlockInfo{"LineGradientDrawableUBO", idLineDrawableUBO}, - UniformBlockInfo{"LineEvaluatedPropsUBO", idLineEvaluatedPropsUBO}, + UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, + UniformBlockInfo{"LineGradientDrawableUBO", idLineDrawableUBO}, + UniformBlockInfo{"LineEvaluatedPropsUBO", idLineEvaluatedPropsUBO}, }; const std::vector LineGradientShaderInfo::attributes = { AttributeInfo{"a_pos_normal", idLinePosNormalVertexAttribute}, @@ -346,10 +347,10 @@ const std::vector LineGradientShaderInfo::textures = { using LinePatternShaderInfo = ShaderInfo; const std::vector LinePatternShaderInfo::uniformBlocks = { - UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, - UniformBlockInfo{"LinePatternDrawableUBO", idLineDrawableUBO}, - UniformBlockInfo{"LinePatternTilePropsUBO", idLineTilePropsUBO}, - UniformBlockInfo{"LineEvaluatedPropsUBO", idLineEvaluatedPropsUBO}, + UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, + UniformBlockInfo{"LinePatternDrawableUBO", idLineDrawableUBO}, + UniformBlockInfo{"LinePatternTilePropsUBO", idLineTilePropsUBO}, + UniformBlockInfo{"LineEvaluatedPropsUBO", idLineEvaluatedPropsUBO}, }; const std::vector LinePatternShaderInfo::attributes = { AttributeInfo{"a_pos_normal", idLinePosNormalVertexAttribute}, @@ -431,10 +432,10 @@ const std::vector SymbolIconShaderInfo::textures = { using SymbolSDFIconShaderInfo = ShaderInfo; const std::vector SymbolSDFIconShaderInfo::uniformBlocks = { - UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, - UniformBlockInfo{"SymbolDrawableUBO", idSymbolDrawableUBO}, - UniformBlockInfo{"SymbolTilePropsUBO", idSymbolTilePropsUBO}, - UniformBlockInfo{"SymbolEvaluatedPropsUBO", idSymbolEvaluatedPropsUBO}, + UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, + UniformBlockInfo{"SymbolDrawableUBO", idSymbolDrawableUBO}, + UniformBlockInfo{"SymbolTilePropsUBO", idSymbolTilePropsUBO}, + UniformBlockInfo{"SymbolEvaluatedPropsUBO", idSymbolEvaluatedPropsUBO}, }; const std::vector SymbolSDFIconShaderInfo::attributes = { AttributeInfo{"a_pos_offset", idSymbolPosOffsetVertexAttribute}, @@ -456,21 +457,21 @@ const std::vector SymbolSDFIconShaderInfo::textures = { using SymbolTextAndIconShaderInfo = ShaderInfo; const std::vector SymbolTextAndIconShaderInfo::uniformBlocks = { - UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, - UniformBlockInfo{"SymbolDrawableUBO", idSymbolDrawableUBO}, - UniformBlockInfo{"SymbolTilePropsUBO", idSymbolTilePropsUBO}, - UniformBlockInfo{"SymbolEvaluatedPropsUBO", idSymbolEvaluatedPropsUBO}, + UniformBlockInfo{"GlobalPaintParamsUBO", idGlobalPaintParamsUBO}, + UniformBlockInfo{"SymbolDrawableUBO", idSymbolDrawableUBO}, + UniformBlockInfo{"SymbolTilePropsUBO", idSymbolTilePropsUBO}, + UniformBlockInfo{"SymbolEvaluatedPropsUBO", idSymbolEvaluatedPropsUBO}, }; const std::vector SymbolTextAndIconShaderInfo::attributes = { - AttributeInfo{"a_pos_offset", idSymbolPosOffsetVertexAttribute}, - AttributeInfo{"a_data", idSymbolDataVertexAttribute}, - AttributeInfo{"a_projected_pos", idSymbolProjectedPosVertexAttribute}, - AttributeInfo{"a_fade_opacity", idSymbolFadeOpacityVertexAttribute}, - AttributeInfo{"a_fill_color", idSymbolColorVertexAttribute}, - AttributeInfo{"a_halo_color", idSymbolHaloColorVertexAttribute}, - AttributeInfo{"a_opacity", idSymbolOpacityVertexAttribute}, - AttributeInfo{"a_halo_width", idSymbolHaloWidthVertexAttribute}, - AttributeInfo{"a_halo_blur", idSymbolHaloBlurVertexAttribute}, + AttributeInfo{"a_pos_offset", idSymbolPosOffsetVertexAttribute}, + AttributeInfo{"a_data", idSymbolDataVertexAttribute}, + AttributeInfo{"a_projected_pos", idSymbolProjectedPosVertexAttribute}, + AttributeInfo{"a_fade_opacity", idSymbolFadeOpacityVertexAttribute}, + AttributeInfo{"a_fill_color", idSymbolColorVertexAttribute}, + AttributeInfo{"a_halo_color", idSymbolHaloColorVertexAttribute}, + AttributeInfo{"a_opacity", idSymbolOpacityVertexAttribute}, + AttributeInfo{"a_halo_width", idSymbolHaloWidthVertexAttribute}, + AttributeInfo{"a_halo_blur", idSymbolHaloBlurVertexAttribute}, }; const std::vector SymbolTextAndIconShaderInfo::textures = { TextureInfo{"u_texture", idSymbolImageTexture}, diff --git a/src/mbgl/vulkan/context.cpp b/src/mbgl/vulkan/context.cpp index daa98ce7e51..cdedf8b0913 100644 --- a/src/mbgl/vulkan/context.cpp +++ b/src/mbgl/vulkan/context.cpp @@ -114,10 +114,14 @@ void Context::initFrameResources() { buildUniformDescriptorSetLayout( globalUniformDescriptorSetLayout, 0, shaders::globalUBOCount, "GlobalUniformDescriptorSetLayout"); - buildUniformDescriptorSetLayout( - layerUniformDescriptorSetLayout, shaders::layerUBOStartId, shaders::maxUBOCountPerLayer, "LayerUniformDescriptorSetLayout"); - buildUniformDescriptorSetLayout( - drawableUniformDescriptorSetLayout, shaders::globalUBOCount, shaders::maxUBOCountPerDrawable, "DrawableUniformDescriptorSetLayout"); + buildUniformDescriptorSetLayout(layerUniformDescriptorSetLayout, + shaders::layerUBOStartId, + shaders::maxUBOCountPerLayer, + "LayerUniformDescriptorSetLayout"); + buildUniformDescriptorSetLayout(drawableUniformDescriptorSetLayout, + shaders::globalUBOCount, + shaders::maxUBOCountPerDrawable, + "DrawableUniformDescriptorSetLayout"); buildImageDescriptorSetLayout(); } @@ -445,7 +449,8 @@ void Context::bindGlobalUniformBuffers(gfx::RenderPass& renderPass) const noexce const shaders::GlobalPlatformParamsUBO platformUBO = { /* .rotation0 = */ {cosf(surfaceRotation), -sinf(surfaceRotation)}, /* .rotation1 = */ {sinf(surfaceRotation), cosf(surfaceRotation)}}; - context.globalUniformBuffers.createOrUpdate(shaders::idGlobalPlatformParamsUBO, &platformUBO, sizeof(platformUBO), context); + context.globalUniformBuffers.createOrUpdate( + shaders::idGlobalPlatformParamsUBO, &platformUBO, sizeof(platformUBO), context); } context.globalUniformBuffers.bindDescriptorSets(renderPassImpl.getEncoder());