Skip to content

Commit

Permalink
Vulkan renderer backend (maplibre#2564)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bart Louwers <[email protected]>
  • Loading branch information
3 people authored Aug 1, 2024
1 parent 88993b9 commit 072aa32
Show file tree
Hide file tree
Showing 103 changed files with 11,459 additions and 135 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
strategy:
fail-fast: true
matrix:
renderer: [legacy, drawable]
renderer: [legacy, drawable, vulkan]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -83,14 +83,18 @@ jobs:
libpng-dev \
libglfw3-dev \
libwebp-dev \
libopengl0
libopengl0 \
mesa-vulkan-drivers
- if: matrix.renderer == 'drawable'
run: echo renderer_flag_cmake=-DMLN_DRAWABLE_RENDERER=ON >> "$GITHUB_ENV"

- if: matrix.renderer == 'legacy'
run: echo renderer_flag_cmake=-DMLN_LEGACY_RENDERER=ON >> "$GITHUB_ENV"

- if: matrix.renderer == 'vulkan'
run: echo renderer_flag_cmake="-DMLN_DRAWABLE_RENDERER=ON -DMLN_LEGACY_RENDERER=OFF -DMLN_WITH_VULKAN=ON -DMLN_WITH_OPENGL=OFF" >> "$GITHUB_ENV"

- name: Build MapLibre Native Core
env:
CI: 1
Expand Down Expand Up @@ -143,6 +147,7 @@ jobs:
- run: chmod +x build/mbgl-test-runner

- name: Run C++ tests
continue-on-error: ${{ matrix.renderer == 'vulkan' }}
run: xvfb-run -a build/mbgl-test-runner

# render tests
Expand Down
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@
[submodule "vendor/unordered_dense"]
path = vendor/unordered_dense
url = https://github.com/martinus/unordered_dense.git
[submodule "vendor/Vulkan-Headers"]
path = vendor/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git
[submodule "vendor/VulkanMemoryAllocator"]
path = vendor/VulkanMemoryAllocator
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
[submodule "vendor/glslang"]
path = vendor/glslang
url = https://github.com/KhronosGroup/glslang.git
152 changes: 122 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ option(MLN_WITH_SANITIZER "Use [address|thread|undefined] here" OFF)
option(MLN_WITH_RTTI "Compile with runtime type information" OFF)
option(MLN_WITH_OPENGL "Build with OpenGL renderer" ON)
option(MLN_WITH_EGL "Build with EGL renderer" OFF)
option(MLN_WITH_VULKAN "Build with Vulkan renderer" OFF)
option(MLN_WITH_OSMESA "Build with OSMesa (Software) renderer" OFF)
option(MLN_WITH_WERROR "Make all compilation warnings errors" ON)
option(MLN_LEGACY_RENDERER "Include the legacy rendering pathway" ON)
Expand Down Expand Up @@ -162,16 +163,6 @@ if(MLN_DRAWABLE_RENDERER)
${PROJECT_SOURCE_DIR}/include/mbgl/renderer/render_target.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/shader_program_base.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/util/suppress_copies.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/gl/shader_info.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/gl/shader_program_gl.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/buffer_allocator.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/drawable_gl.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/drawable_gl_builder.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/layer_group_gl.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/uniform_block_gl.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/uniform_buffer_gl.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/vertex_attribute_gl.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/texture2d.hpp
)
list(APPEND SRC_FILES
${PROJECT_SOURCE_DIR}/src/mbgl/gfx/drawable.cpp
Expand Down Expand Up @@ -219,16 +210,12 @@ if(MLN_DRAWABLE_RENDERER)
${PROJECT_SOURCE_DIR}/src/mbgl/renderer/layers/collision_layer_tweaker.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/renderer/layers/collision_layer_tweaker.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/shader_program_base.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/gl/shader_program_gl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/buffer_allocator.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/drawable_gl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/drawable_gl_builder.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/drawable_gl_impl.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/layer_group_gl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/texture2d.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/uniform_block_gl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/uniform_buffer_gl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/vertex_attribute_gl.cpp
)

target_compile_definitions(
mbgl-core
PUBLIC
"MLN_DRAWABLE_RENDERER=$<BOOL:${MLN_DRAWABLE_RENDERER}>"
)
endif()

Expand All @@ -252,6 +239,10 @@ list(APPEND INCLUDE_FILES
${PROJECT_SOURCE_DIR}/include/mbgl/gfx/shader_group.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gfx/shader.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gfx/types.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gfx/backend.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/style/layers/custom_layer.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/style/layers/custom_layer_render_parameters.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/layermanager/custom_layer_factory.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/layermanager/background_layer_factory.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/layermanager/circle_layer_factory.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/layermanager/fill_extrusion_layer_factory.hpp
Expand Down Expand Up @@ -854,6 +845,11 @@ list(APPEND SRC_FILES
${PROJECT_SOURCE_DIR}/src/mbgl/style/style_impl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/style_impl.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/types.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_layer.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_layer_render_parameters.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/layermanager/custom_layer_factory.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_layer_impl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_layer_impl.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/text/bidi.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/text/check_max_angle.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/text/check_max_angle.hpp
Expand Down Expand Up @@ -1005,11 +1001,6 @@ if(MLN_WITH_OPENGL)
)
list(APPEND
INCLUDE_FILES
${PROJECT_SOURCE_DIR}/include/mbgl/gfx/backend.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/style/layers/custom_layer.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/style/layers/custom_layer_render_parameters.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/style/layers/mtl/custom_layer_render_parameters.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/layermanager/custom_layer_factory.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/renderable_resource.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/renderer_backend.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/layermanager/location_indicator_layer_factory.hpp
Expand Down Expand Up @@ -1081,11 +1072,6 @@ if(MLN_WITH_OPENGL)
${PROJECT_SOURCE_DIR}/src/mbgl/gl/context.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/fence.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/fence.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_layer.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_layer_render_parameters.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/layermanager/custom_layer_factory.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_layer_impl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_layer_impl.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/debugging_extension.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/debugging_extension.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/defines.hpp
Expand Down Expand Up @@ -1159,6 +1145,7 @@ if(MLN_WITH_OPENGL)
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/symbol_layer_ubo.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/widevector_ubo.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/gl/shader_program_gl.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/buffer_allocator.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/drawable_gl.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/drawable_gl_builder.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/layer_group_gl.hpp
Expand All @@ -1170,6 +1157,7 @@ if(MLN_WITH_OPENGL)
list(APPEND SRC_FILES
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/gl/shader_info.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/gl/shader_program_gl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/buffer_allocator.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/drawable_gl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/drawable_gl_builder.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/drawable_gl_impl.hpp
Expand Down Expand Up @@ -1287,6 +1275,96 @@ if(MBGL_WITH_METAL)
)
endif()

if(MLN_WITH_VULKAN)
message(STATUS "Configuring Vulkan renderer backend")

target_compile_definitions(
mbgl-core
PRIVATE
MLN_RENDER_BACKEND_VULKAN=1
)

list(APPEND
INCLUDE_FILES
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/buffer_resource.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/command_encoder.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/context.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/drawable.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/drawable_builder.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/index_buffer_resource.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/layer_group.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/offscreen_texture.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/pipeline.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/renderer_backend.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/render_pass.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/renderable_resource.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/texture2d.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/tile_layer_group.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/uniform_buffer.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/upload_pass.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/vulkan/vertex_attribute.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/shader_group.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/shader_program.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/background.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/circle.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/clipping_mask.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/collision.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/common.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/debug.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/fill.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/heatmap.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/hillshade.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/line.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/raster.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/vulkan/symbol.hpp
)

list(APPEND
SRC_FILES
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/buffer_resource.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/command_encoder.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/context.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/drawable.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/drawable_builder.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/drawable_impl.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/index_buffer_resource.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/layer_group.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/offscreen_texture.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/pipeline.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/renderer_backend.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/render_pass.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/renderable_resource.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/texture2d.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/tile_layer_group.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/uniform_buffer.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/upload_pass.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/vulkan/vertex_attribute.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/shader_program.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/background.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/circle.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/clipping_mask.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/collision.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/debug.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/fill.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/heatmap.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/hillshade.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/line.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/raster.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/vulkan/symbol.cpp
)

#TODO merge with MLN_DRAWABLE_RENDERER? These are added only for GL path
list(APPEND
SRC_FILES
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_drawable_layer.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/layermanager/custom_drawable_layer_factory.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_drawable_layer_impl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_drawable_layer_impl.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/renderer/layers/render_custom_drawable_layer.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/renderer/layers/render_custom_drawable_layer.hpp
)
endif()

target_sources(
mbgl-core PRIVATE
${INCLUDE_FILES}
Expand Down Expand Up @@ -1424,6 +1502,20 @@ export(TARGETS
FILE MapboxCoreTargets.cmake
)

if(MLN_WITH_VULKAN)
include(${PROJECT_SOURCE_DIR}/vendor/vulkan.cmake)

target_link_libraries(
mbgl-core
PUBLIC
mbgl-vendor-vulkan-headers
mbgl-vendor-VulkanMemoryAllocator
glslang
SPIRV
glslang-default-resource-limits
)
endif()

set_target_properties(
mbgl-core
PROPERTIES
Expand Down
5 changes: 5 additions & 0 deletions include/mbgl/gfx/backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ class Backend {
enum class Type : uint8_t {
OpenGL, ///< The OpenGL API backend
Metal, ///< The Metal API backend
Vulkan, ///< The Vulkan API backend
TYPE_MAX, ///< Not a valid backend type, used to determine the number
///< of available backends (ie for array allocation).
};

#if MLN_RENDER_BACKEND_METAL
static constexpr Type DefaultType = Type::Metal;
#elif MLN_RENDER_BACKEND_VULKAN
static constexpr Type DefaultType = Type::Vulkan;
#else // assume MLN_RENDER_BACKEND_OPENGL
static constexpr Type DefaultType = Type::OpenGL;
#endif
Expand All @@ -38,6 +41,8 @@ class Backend {
static std::unique_ptr<T> Create(Args... args) {
#if MLN_RENDER_BACKEND_METAL
return Create<Type::Metal, T, Args...>(std::forward<Args>(args)...);
#elif MLN_RENDER_BACKEND_VULKAN
return Create<Type::Vulkan, T, Args...>(std::forward<Args>(args)...);
#else // assume MLN_RENDER_BACKEND_OPENGL
return Create<Type::OpenGL, T, Args...>(std::forward<Args>(args)...);
#endif
Expand Down
6 changes: 3 additions & 3 deletions include/mbgl/gfx/drawable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Drawable {
int32_t getLineWidth() const { return lineWidth; }

/// Set line width
void setLineWidth(int32_t value) { lineWidth = value; }
virtual void setLineWidth(int32_t value) { lineWidth = value; }

/// @brief Get the texture at the given internal ID.
const gfx::Texture2DPtr& getTexture(size_t id) const;
Expand All @@ -122,7 +122,7 @@ class Drawable {
bool getEnableColor() const { return enableColor; }

/// Set whether to render to the color target
void setEnableColor(bool value) { enableColor = value; }
virtual void setEnableColor(bool value) { enableColor = value; }

/// Whether to do stenciling (based on the Tile ID or 3D)
bool getEnableStencil() const { return enableStencil; }
Expand Down Expand Up @@ -175,7 +175,7 @@ class Drawable {
const gfx::CullFaceMode& getCullFaceMode() const;

/// Set cull face mode
void setCullFaceMode(const gfx::CullFaceMode&);
virtual void setCullFaceMode(const gfx::CullFaceMode&);

/// Get color mode
const gfx::ColorMode& getColorMode() const;
Expand Down
6 changes: 2 additions & 4 deletions include/mbgl/gfx/uniform_block.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ using UniqueUniformBlock = std::unique_ptr<UniformBlock>;

/// @brief This class represents an uniform block
class UniformBlock {
protected:
/// @brief Constructor. Can only be created by UniformBlockArray implementations
public:
/// @brief Constructor
/// @param index_
/// @param size_
UniformBlock(int index_, std::size_t size_)
Expand All @@ -23,8 +23,6 @@ class UniformBlock {
UniformBlock(UniformBlock&& other)
: index(other.index),
size(other.size) {}

public:
/// @brief Destructor
virtual ~UniformBlock() = default;

Expand Down
15 changes: 4 additions & 11 deletions include/mbgl/gl/uniform_block_gl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,15 @@
namespace mbgl {
namespace gl {

class UniformBlockArrayGL;

class UniformBlockGL final : public gfx::UniformBlock {
// Can only be created by UniformBlockArrayGL
private:
friend UniformBlockArrayGL;

public:
UniformBlockGL(int index_, std::size_t size_)
: UniformBlock(index_, size_) {}
UniformBlockGL(const UniformBlockGL& other)
: UniformBlock(other) {}
UniformBlockGL(UniformBlockGL&& other)
: UniformBlock(std::move(other)) {}

public:
~UniformBlockGL() override = default;
void bindBuffer(const gfx::UniformBuffer& uniformBuffer) override;
void unbindBuffer() override;
};
Expand All @@ -44,11 +38,10 @@ class UniformBlockArrayGL final : public gfx::UniformBlockArray {

private:
std::unique_ptr<gfx::UniformBlock> create(int index, std::size_t size) override {
return std::unique_ptr<gfx::UniformBlock>(new UniformBlockGL(index, size));
return std::make_unique<UniformBlockGL>(index, size);
}
std::unique_ptr<gfx::UniformBlock> copy(const gfx::UniformBlock& uniformBlocks) override {
return std::unique_ptr<gfx::UniformBlock>(
new UniformBlockGL(static_cast<const UniformBlockGL&>(uniformBlocks)));
return std::make_unique<UniformBlockGL>(static_cast<const UniformBlockGL&>(uniformBlocks));
}
};

Expand Down
Loading

0 comments on commit 072aa32

Please sign in to comment.