Skip to content

Commit

Permalink
[clang-format] Lower ColumnLimit to 120
Browse files Browse the repository at this point in the history
  • Loading branch information
yeetari committed May 31, 2020
1 parent 31b422b commit 30a029d
Show file tree
Hide file tree
Showing 64 changed files with 1,084 additions and 747 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: Yes
ColumnLimit: 160
ColumnLimit: 120
IndentWidth: 4
5 changes: 3 additions & 2 deletions example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ int main(int argc, char *argv[]) {

auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>("vulkan-renderer.log", true);
auto vulkan_renderer_log = std::make_shared<spdlog::async_logger>("vulkan-renderer", spdlog::sinks_init_list{console_sink, file_sink},
spdlog::thread_pool(), spdlog::async_overflow_policy::block);
auto vulkan_renderer_log =
std::make_shared<spdlog::async_logger>("vulkan-renderer", spdlog::sinks_init_list{console_sink, file_sink},
spdlog::thread_pool(), spdlog::async_overflow_policy::block);
vulkan_renderer_log->set_level(spdlog::level::trace);
vulkan_renderer_log->set_pattern("%Y-%m-%d %T.%f %^%l%$ %5t [%-10n] %v");
vulkan_renderer_log->flush_on(spdlog::level::debug); // TODO: as long as we don't have a flush on crash
Expand Down
9 changes: 6 additions & 3 deletions include/inexor/vulkan-renderer/availability_checks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class AvailabilityChecksManager {

/// @brief Checks if a certain Vulkan device layer is available on the system.
/// https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/vkEnumerateDeviceLayerProperties.html
/// @note Device layers and device extensions are coupled to a certain graphics card which needs to be specified as parameter.
/// @note Device layers and device extensions are coupled to a certain graphics card which needs to be specified as
/// parameter.
/// @param graphics_card The selected graphics card.
/// @param device_layer_name The name of the Vulkan device layer.
/// @return true if the Vulkan device layer is available, false otherwise.
Expand All @@ -68,8 +69,10 @@ class AvailabilityChecksManager {
/// @param device_extension_name [in] The name of the Vulkan device extension.
/// @return true if the Vulkan device extension is available, false otherwise.
/// @note Available device extensions can be enabled by passing them as a parameter during Vulkan device creation.
/// @note Device layers and device extensions are coupled to a certain graphics card which needs to be specified as parameter.
[[nodiscard]] bool has_device_extension(const VkPhysicalDevice &graphics_card, const std::string &device_extension_name);
/// @note Device layers and device extensions are coupled to a certain graphics card which needs to be specified as
/// parameter.
[[nodiscard]] bool has_device_extension(const VkPhysicalDevice &graphics_card,
const std::string &device_extension_name);

/// @brief Checks if presentation is available for a certain combination of graphics card and window surface.
/// The present mode describes how the rendered image will be presented on the screen.
Expand Down
6 changes: 4 additions & 2 deletions include/inexor/vulkan-renderer/bezier_curve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
/// INTRODUCTION
/// A bezier curve (named after french mathematician PIERRE ETIENNE BEZIER) is a parametric curve
/// whose only purpose is to look soft and smooth. Bezier curves are all about elegance!
/// Those curves can be used to represent the path of a everything (imagin a camera which is moving along a path for example).
/// Those curves can be used to represent the path of a everything (imagin a camera which is moving along a path for
/// example).
///
/// Bezier curves are fast, flexible, beautiful and easy to compute. You just pass a bunch of parameter points to
/// your code and the final curve will be computed. Because every complex curve can be represented with a
/// chain of smaller curves, it is recommended to create a chain of curves. Bezier curves are essential
/// in the field of computer graphics and image processing. They can also be used for approximation, interpolation and more.
/// in the field of computer graphics and image processing. They can also be used for approximation, interpolation and
/// more.
///
/// COMPUTING
/// There are two ways to generate a bezier curves from a group of [n] points.
Expand Down
8 changes: 5 additions & 3 deletions include/inexor/vulkan-renderer/debug_callback.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
namespace inexor::vulkan_renderer {

/// @brief Vulkan validation layer callback.
VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_message_callback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT object_type, std::uint64_t object,
std::size_t location, std::int32_t message_code, const char *layer_prefix, const char *message,
void *user_data);
VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_message_callback(VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT object_type,
std::uint64_t object, std::size_t location,
std::int32_t message_code, const char *layer_prefix,
const char *message, void *user_data);
} // namespace inexor::vulkan_renderer
15 changes: 10 additions & 5 deletions include/inexor/vulkan-renderer/debug_marker_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,24 @@ class VulkanDebugMarkerManager {
void init(const VkDevice &device, const VkPhysicalDevice &graphics_card, bool enable_debug_markers = true);

/// @brief Sets the debug name of an object.
/// All Objects in Vulkan are represented by their 64-bit handles which are passed into this function along with the object type
void set_object_name(const VkDevice &device, const std::uint64_t &object, const VkDebugReportObjectTypeEXT &object_type, const char *name);
/// All Objects in Vulkan are represented by their 64-bit handles which are passed into this function along with the
/// object type
void set_object_name(const VkDevice &device, const std::uint64_t &object,
const VkDebugReportObjectTypeEXT &object_type, const char *name);

/// @brief Sets the tag for an object.
/// @note We can link a memory block of arbitrary size to an object.
void set_object_tag(const VkDevice &device, const std::uint64_t &object, const VkDebugReportObjectTypeEXT &object_type, const std::uint64_t &name,
void set_object_tag(const VkDevice &device, const std::uint64_t &object,
const VkDebugReportObjectTypeEXT &object_type, const std::uint64_t &name,
const std::size_t &tag_size, const void *tag);

/// Starts a new debug marker region.
void bind_region(const VkCommandBuffer &cmdbuffer, const std::string &debug_marker_name, const glm::vec4 &debug_marker_color);
void bind_region(const VkCommandBuffer &cmdbuffer, const std::string &debug_marker_name,
const glm::vec4 &debug_marker_color);

/// @brief Inserts a new debug marker into the command buffer.
void insert(const VkCommandBuffer &command_buffer, const std::string &debug_marker_name, const glm::vec4 &debug_marker_color);
void insert(const VkCommandBuffer &command_buffer, const std::string &debug_marker_name,
const glm::vec4 &debug_marker_color);

/// Ends the current debug marker region.
void end_region(const VkCommandBuffer &command_buffer);
Expand Down
3 changes: 2 additions & 1 deletion include/inexor/vulkan-renderer/error_handling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ namespace inexor::vulkan_renderer {
// @param message_box_title The title of the message box.
void display_error_message(const std::string &error_message, const std::string &message_box_title = "Error");

void display_fatal_error_message(const std::string &error_message, const std::string &message_box_title = "Fatal Error");
void display_fatal_error_message(const std::string &error_message,
const std::string &message_box_title = "Fatal Error");

void display_warning_message(const std::string &warning_message, const std::string &message_box_title = "Warning");

Expand Down
10 changes: 6 additions & 4 deletions include/inexor/vulkan-renderer/gpu_memory_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class GPUMemoryBuffer {
/// @param size [in] The size of the buffer in bytes.
/// @param buffer_usage [in] The Vulkan buffer usage flags.
/// @param memory_usage [in] The Vulkan Memory Allocator library's memory usage flags.
GPUMemoryBuffer(const VkDevice &device, const VmaAllocator &vma_allocator, const std::string &name, const VkDeviceSize &size,
const VkBufferUsageFlags &buffer_usage, const VmaMemoryUsage &memory_usage);
GPUMemoryBuffer(const VkDevice &device, const VmaAllocator &vma_allocator, const std::string &name,
const VkDeviceSize &size, const VkBufferUsageFlags &buffer_usage,
const VmaMemoryUsage &memory_usage);

/// @brief Creates a new GPU memory buffer.
/// @param device [in] The Vulkan device from which the buffer will be created.
Expand All @@ -47,8 +48,9 @@ class GPUMemoryBuffer {
/// @param data_size [in] The size of the data which will be copied.
/// @param buffer_usage [in] The Vulkan buffer usage flags.
/// @param memory_usage [in] The Vulkan Memory Allocator library's memory usage flags.
GPUMemoryBuffer(const VkDevice &device, const VmaAllocator &vma_allocator, const std::string &name, const VkDeviceSize &buffer_size, void *data,
const std::size_t data_size, const VkBufferUsageFlags &buffer_usage, const VmaMemoryUsage &memory_usage);
GPUMemoryBuffer(const VkDevice &device, const VmaAllocator &vma_allocator, const std::string &name,
const VkDeviceSize &buffer_size, void *data, const std::size_t data_size,
const VkBufferUsageFlags &buffer_usage, const VmaMemoryUsage &memory_usage);

virtual ~GPUMemoryBuffer();

Expand Down
12 changes: 7 additions & 5 deletions include/inexor/vulkan-renderer/mesh_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ class MeshBuffer {
MeshBuffer &operator=(MeshBuffer &&) noexcept = default;

/// @brief Creates a new vertex buffer and an associated index buffer.
MeshBuffer(const VkDevice device, VkQueue data_transfer_queue, const std::uint32_t data_transfer_queue_family_index, const VmaAllocator vma_allocator,
const std::string &name, const VkDeviceSize size_of_vertex_structure, const std::size_t number_of_vertices, void *vertices,
const VkDeviceSize size_of_index_structure, const std::size_t number_of_indices, void *indices);
MeshBuffer(const VkDevice device, VkQueue data_transfer_queue, const std::uint32_t data_transfer_queue_family_index,
const VmaAllocator vma_allocator, const std::string &name, const VkDeviceSize size_of_vertex_structure,
const std::size_t number_of_vertices, void *vertices, const VkDeviceSize size_of_index_structure,
const std::size_t number_of_indices, void *indices);

/// @brief Creates a vertex buffer without index buffer.
MeshBuffer(const VkDevice device, VkQueue data_transfer_queue, const std::uint32_t data_transfer_queue_family_index, const VmaAllocator vma_allocator,
const std::string &name, const VkDeviceSize size_of_vertex_structure, const std::size_t number_of_vertices, void *vertices);
MeshBuffer(const VkDevice device, VkQueue data_transfer_queue, const std::uint32_t data_transfer_queue_family_index,
const VmaAllocator vma_allocator, const std::string &name, const VkDeviceSize size_of_vertex_structure,
const std::size_t number_of_vertices, void *vertices);

~MeshBuffer();

Expand Down
5 changes: 3 additions & 2 deletions include/inexor/vulkan-renderer/octree_vertex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ struct OctreeVertex {

[[nodiscard]] static VkVertexInputBindingDescription get_vertex_binding_description();

/// @note You should use the format where the amount of color channels matches the number of components in the shader data type.
/// It is allowed to use more channels than the number of components in the shader, but they will be silently discarded.
/// @note You should use the format where the amount of color channels matches the number of components in the
/// shader data type. It is allowed to use more channels than the number of components in the shader, but they will
/// be silently discarded.
[[nodiscard]] static std::vector<VkVertexInputAttributeDescription> get_attribute_binding_description();
};

Expand Down
5 changes: 3 additions & 2 deletions include/inexor/vulkan-renderer/once_command_buffer.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "inexor/vulkan-renderer/wrapper/command_pool.hpp"
#include "inexor/vulkan-renderer/wrapper/command_buffer.hpp"
#include "inexor/vulkan-renderer/wrapper/command_pool.hpp"

#include <vulkan/vulkan_core.h>

Expand Down Expand Up @@ -34,7 +34,8 @@ class OnceCommandBuffer {
/// @brief Creates a new commandbuffer which is being called only once.
/// @param device [in] The Vulkan device.
/// @param data_transfer_queue [in] The data transfer queue.
OnceCommandBuffer(const VkDevice device, const VkQueue data_transfer_queue, const std::uint32_t data_transfer_queue_family_index);
OnceCommandBuffer(const VkDevice device, const VkQueue data_transfer_queue,
const std::uint32_t data_transfer_queue_family_index);

~OnceCommandBuffer();

Expand Down
6 changes: 4 additions & 2 deletions include/inexor/vulkan-renderer/renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ class VulkanRenderer {

std::shared_ptr<VulkanDebugMarkerManager> debug_marker_manager = std::make_shared<VulkanDebugMarkerManager>();

std::shared_ptr<AvailabilityChecksManager> availability_checks_manager = std::make_shared<AvailabilityChecksManager>();
std::shared_ptr<AvailabilityChecksManager> availability_checks_manager =
std::make_shared<AvailabilityChecksManager>();

std::shared_ptr<VulkanSettingsDecisionMaker> settings_decision_maker = std::make_shared<VulkanSettingsDecisionMaker>();
std::shared_ptr<VulkanSettingsDecisionMaker> settings_decision_maker =
std::make_shared<VulkanSettingsDecisionMaker>();

VkPresentModeKHR selected_present_mode;

Expand Down
Loading

0 comments on commit 30a029d

Please sign in to comment.