Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 13, 2024
1 parent e3c2a15 commit 33100e3
Show file tree
Hide file tree
Showing 20 changed files with 111 additions and 113 deletions.
6 changes: 2 additions & 4 deletions include/mbgl/gfx/uniform_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ class UniformBufferArray {
const std::shared_ptr<UniformBuffer>& get(const size_t id) const;

/// Set a new uniform buffer element or replace the existing one.
virtual const std::shared_ptr<UniformBuffer>& set(const size_t id,
std::shared_ptr<UniformBuffer> uniformBuffer);
virtual const std::shared_ptr<UniformBuffer>& set(const size_t id, std::shared_ptr<UniformBuffer> uniformBuffer);

/// Create and add a new buffer or update an existing one
void createOrUpdate(
const size_t id, const std::vector<uint8_t>& data, gfx::Context&, bool persistent = false);
void createOrUpdate(const size_t id, const std::vector<uint8_t>& 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 <typename T>
Expand Down
4 changes: 1 addition & 3 deletions include/mbgl/shaders/gl/shader_program_gl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class ShaderProgramGL final : public gfx::ShaderProgramBase {
using SamplerLocationArray = std::array<std::optional<size_t>, shaders::maxTextureCountPerShader>;

ShaderProgramGL(UniqueProgram&& glProgram_);
ShaderProgramGL(UniqueProgram&&,
VertexAttributeArrayGL&& attributes,
SamplerLocationArray&& samplerLocations);
ShaderProgramGL(UniqueProgram&&, VertexAttributeArrayGL&& attributes, SamplerLocationArray&& samplerLocations);
ShaderProgramGL(ShaderProgramGL&& other);
~ShaderProgramGL() noexcept override = default;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/mtl/background.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct ShaderSource<BuiltIn::BackgroundShader, gfx::Backend::Type::Metal> {
static constexpr auto vertexMainFunction = "vertexMain";
static constexpr auto fragmentMainFunction = "fragmentMain";

static const std::array<AttributeInfo, 1> attributes;
static const std::array<AttributeInfo, 1> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 0> textures;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/mtl/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct ShaderSource<BuiltIn::DebugShader, gfx::Backend::Type::Metal> {
static constexpr auto vertexMainFunction = "vertexMain";
static constexpr auto fragmentMainFunction = "fragmentMain";

static const std::array<AttributeInfo, 1> attributes;
static const std::array<AttributeInfo, 1> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

Expand Down
4 changes: 2 additions & 2 deletions include/mbgl/shaders/mtl/fill.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ struct ShaderSource<BuiltIn::FillShader, gfx::Backend::Type::Metal> {
static constexpr auto vertexMainFunction = "vertexMain";
static constexpr auto fragmentMainFunction = "fragmentMain";

static const std::array<AttributeInfo, 3> attributes;
static const std::array<AttributeInfo, 3> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 0> textures;

Expand Down Expand Up @@ -439,7 +439,7 @@ struct ShaderSource<BuiltIn::FillOutlinePatternShader, gfx::Backend::Type::Metal
static constexpr auto vertexMainFunction = "vertexMain";
static constexpr auto fragmentMainFunction = "fragmentMain";

static const std::array<AttributeInfo, 4> attributes;
static const std::array<AttributeInfo, 4> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/mtl/fill_extrusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ struct ShaderSource<BuiltIn::FillExtrusionPatternShader, gfx::Backend::Type::Met
static constexpr auto vertexMainFunction = "vertexMain";
static constexpr auto fragmentMainFunction = "fragmentMain";

static const std::array<AttributeInfo, 6> attributes;
static const std::array<AttributeInfo, 6> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/mtl/hillshade_prepare.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct ShaderSource<BuiltIn::HillshadePrepareShader, gfx::Backend::Type::Metal>
static constexpr auto vertexMainFunction = "vertexMain";
static constexpr auto fragmentMainFunction = "fragmentMain";

static const std::array<AttributeInfo, 2> attributes;
static const std::array<AttributeInfo, 2> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/mtl/line.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ struct ShaderSource<BuiltIn::LineSDFShader, gfx::Backend::Type::Metal> {
static constexpr auto vertexMainFunction = "vertexMain";
static constexpr auto fragmentMainFunction = "fragmentMain";

static const std::array<AttributeInfo, 9> attributes;
static const std::array<AttributeInfo, 9> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

Expand Down
4 changes: 2 additions & 2 deletions include/mbgl/shaders/mtl/symbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct ShaderSource<BuiltIn::SymbolIconShader, gfx::Backend::Type::Metal> {
static constexpr auto vertexMainFunction = "vertexMain";
static constexpr auto fragmentMainFunction = "fragmentMain";

static const std::array<AttributeInfo, 6> attributes;
static const std::array<AttributeInfo, 6> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

Expand Down Expand Up @@ -422,7 +422,7 @@ struct ShaderSource<BuiltIn::SymbolTextAndIconShader, gfx::Backend::Type::Metal>
static constexpr auto vertexMainFunction = "vertexMain";
static constexpr auto fragmentMainFunction = "fragmentMain";

static const std::array<AttributeInfo, 9> attributes;
static const std::array<AttributeInfo, 9> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 2> textures;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/vulkan/background.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ template <>
struct ShaderSource<BuiltIn::BackgroundPatternShader, gfx::Backend::Type::Vulkan> {
static constexpr const char* name = "BackgroundPatternShader";

static const std::array<AttributeInfo, 1> attributes;
static const std::array<AttributeInfo, 1> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/vulkan/circle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ template <>
struct ShaderSource<BuiltIn::CircleShader, gfx::Backend::Type::Vulkan> {
static constexpr const char* name = "CircleShader";

static const std::array<AttributeInfo, 8> attributes;
static const std::array<AttributeInfo, 8> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 0> textures;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/vulkan/custom_symbol_icon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ template <>
struct ShaderSource<BuiltIn::CustomSymbolIconShader, gfx::Backend::Type::Vulkan> {
static constexpr const char* name = "CustomSymbolIconShader";

static const std::array<AttributeInfo, 2> attributes;
static const std::array<AttributeInfo, 2> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

Expand Down
4 changes: 2 additions & 2 deletions include/mbgl/shaders/vulkan/fill.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ template <>
struct ShaderSource<BuiltIn::FillOutlineShader, gfx::Backend::Type::Vulkan> {
static constexpr const char* name = "FillOutlineShader";

static const std::array<AttributeInfo, 3> attributes;
static const std::array<AttributeInfo, 3> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 0> textures;

Expand Down Expand Up @@ -216,7 +216,7 @@ template <>
struct ShaderSource<BuiltIn::FillPatternShader, gfx::Backend::Type::Vulkan> {
static constexpr const char* name = "FillPatternShader";

static const std::array<AttributeInfo, 4> attributes;
static const std::array<AttributeInfo, 4> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/vulkan/fill_extrusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ template <>
struct ShaderSource<BuiltIn::FillExtrusionShader, gfx::Backend::Type::Vulkan> {
static constexpr const char* name = "FillExtrusionShader";

static const std::array<AttributeInfo, 5> attributes;
static const std::array<AttributeInfo, 5> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 0> textures;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/vulkan/line.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ template <>
struct ShaderSource<BuiltIn::LineSDFShader, gfx::Backend::Type::Vulkan> {
static constexpr const char* name = "LineSDFShader";

static const std::array<AttributeInfo, 9> attributes;
static const std::array<AttributeInfo, 9> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/shaders/vulkan/symbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ template <>
struct ShaderSource<BuiltIn::SymbolSDFIconShader, gfx::Backend::Type::Vulkan> {
static constexpr const char* name = "SymbolSDFIconShader";

static const std::array<AttributeInfo, 10> attributes;
static const std::array<AttributeInfo, 10> attributes;
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
static const std::array<TextureInfo, 1> textures;

Expand Down
7 changes: 2 additions & 5 deletions include/mbgl/vulkan/uniform_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,8 @@ class UniformBufferArray final : public gfx::UniformBufferArray {
const std::shared_ptr<gfx::UniformBuffer>& set(const size_t id,
std::shared_ptr<gfx::UniformBuffer> 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(); }
Expand Down
13 changes: 6 additions & 7 deletions src/mbgl/gfx/uniform_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ const std::shared_ptr<UniformBuffer>& UniformBufferArray::set(const size_t id,
return uniformBufferVector[id];
}

void UniformBufferArray::createOrUpdate(
const size_t id, const std::vector<uint8_t>& 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<uint8_t>& 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 {
Expand Down
Loading

0 comments on commit 33100e3

Please sign in to comment.