Skip to content

Commit

Permalink
fmt : set clang-format column-limit to 160 from 80 for code visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowapril committed Oct 29, 2023
1 parent c3833a9 commit 35ff74b
Show file tree
Hide file tree
Showing 133 changed files with 1,850 additions and 3,350 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
ColumnLimit: 160
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
Expand Down
27 changes: 6 additions & 21 deletions Includes/VoxFlow/Core/Devices/Context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,17 @@ struct Context

void addInstanceLayer(const char* name, bool isOptional = false);
void addInstanceExtension(const char* name, bool isOptional = false);
void addDeviceExtension(const char* name, bool isOptional = false,
void* pFeatureStruct = nullptr,
uint32_t version = 0);
void addDeviceExtension(const char* name, bool isOptional = false, void* pFeatureStruct = nullptr, uint32_t version = 0);

void addRequiredQueue(std::string&& queueName, VkQueueFlags queueFlag,
uint32_t queueCount, float queuePriority,
bool isMainQueue);
void addRequiredQueue(std::string&& queueName, VkQueueFlags queueFlag, uint32_t queueCount, float queuePriority, bool isMainQueue);

std::string appEngine = "VoxFlow";
std::string appTitle = "VoxFlow";

struct Entry
{
explicit Entry(const char* entryName, const bool isOptional = false,
void* pFeatureStruct = nullptr,
const uint32_t version = 0)
: entryName(entryName),
isOptional(isOptional),
pFeatureStruct(pFeatureStruct),
version(version){};
explicit Entry(const char* entryName, const bool isOptional = false, void* pFeatureStruct = nullptr, const uint32_t version = 0)
: entryName(entryName), isOptional(isOptional), pFeatureStruct(pFeatureStruct), version(version){};

const char* entryName{ nullptr };
bool isOptional{ false };
Expand All @@ -52,14 +43,8 @@ struct Context

struct QueueSetup
{
explicit QueueSetup(std::string&& queueName, const VkQueueFlags flag,
const uint32_t queueCount, const float priority,
bool isMainQueue)
: queueName(std::move(queueName)),
flag(flag),
queueCount(queueCount),
priority(priority),
isMainQueue(isMainQueue)
explicit QueueSetup(std::string&& queueName, const VkQueueFlags flag, const uint32_t queueCount, const float priority, bool isMainQueue)
: queueName(std::move(queueName)), flag(flag), queueCount(queueCount), priority(priority), isMainQueue(isMainQueue)
{
}

Expand Down
16 changes: 5 additions & 11 deletions Includes/VoxFlow/Core/Devices/LogicalDevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class PipelineStreamingContext;
class LogicalDevice : NonCopyable
{
public:
LogicalDevice(const Context& ctx, PhysicalDevice* physicalDevice,
Instance* instance, const LogicalDeviceType deviceType);
LogicalDevice(const Context& ctx, PhysicalDevice* physicalDevice, Instance* instance, const LogicalDeviceType deviceType);
~LogicalDevice() override;
LogicalDevice(LogicalDevice&& other) noexcept;
LogicalDevice& operator=(LogicalDevice&& other) noexcept;
Expand Down Expand Up @@ -77,8 +76,7 @@ class LogicalDevice : NonCopyable
* @return descriptor set allocator pool which manage set and pool laid in
* each layout
*/
[[nodiscard]] DescriptorSetAllocatorPool* getDescriptorSetAllocatorPool()
const
[[nodiscard]] DescriptorSetAllocatorPool* getDescriptorSetAllocatorPool() const
{
return _descriptorSetAllocatorPool;
}
Expand All @@ -89,19 +87,15 @@ class LogicalDevice : NonCopyable
* @param resolution window resolution to create
* @return swapchain wrappging class instance
*/
std::shared_ptr<SwapChain> addSwapChain(const char* title,
const glm::ivec2 resolution);
std::shared_ptr<SwapChain> addSwapChain(const char* title, const glm::ivec2 resolution);

/**
* @param swapChainIndex swapchain index to querying
* @return swapchain ref-counted instance matched to given index
*/
[[nodiscard]] inline const std::shared_ptr<SwapChain>& getSwapChain(
const uint32_t swapChainIndex) const
[[nodiscard]] inline const std::shared_ptr<SwapChain>& getSwapChain(const uint32_t swapChainIndex) const
{
VOX_ASSERT(swapChainIndex < _swapChains.size(),
"Given Index({}), Num SwapChains({})", swapChainIndex,
_swapChains.size());
VOX_ASSERT(swapChainIndex < _swapChains.size(), "Given Index({}), Num SwapChains({})", swapChainIndex, _swapChains.size());
return _swapChains[swapChainIndex];
}

Expand Down
9 changes: 3 additions & 6 deletions Includes/VoxFlow/Core/Devices/PhysicalDevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@ class PhysicalDevice : NonCopyable
~PhysicalDevice() override = default;

[[nodiscard]] std::vector<VkLayerProperties> getPossibleLayers() const;
[[nodiscard]] std::vector<VkExtensionProperties> getPossibleExtensions()
const;
[[nodiscard]] std::vector<VkExtensionProperties> getPossibleExtensions() const;
[[nodiscard]] VkPhysicalDeviceMemoryProperties getMemoryProperty() const;
[[nodiscard]] std::vector<VkQueueFamilyProperties>
getQueueFamilyProperties() const;
[[nodiscard]] VkPhysicalDeviceProperties getPhysicalDeviceProperties()
const;
[[nodiscard]] std::vector<VkQueueFamilyProperties> getQueueFamilyProperties() const;
[[nodiscard]] VkPhysicalDeviceProperties getPhysicalDeviceProperties() const;

[[nodiscard]] VkPhysicalDevice get() const noexcept
{
Expand Down
15 changes: 5 additions & 10 deletions Includes/VoxFlow/Core/Devices/Queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class SwapChain;
class Queue : private NonCopyable
{
public:
explicit Queue(const std::string& debugName, LogicalDevice* logicalDevice, VkQueueFlags queueTypeFlags,
VkQueue _queueTypeBits, uint32_t familyIndex,
explicit Queue(const std::string& debugName, LogicalDevice* logicalDevice, VkQueueFlags queueTypeFlags, VkQueue _queueTypeBits, uint32_t familyIndex,
uint32_t queueIndex) noexcept;
~Queue();
Queue(Queue&& other) noexcept;
Expand Down Expand Up @@ -55,17 +54,13 @@ class Queue : private NonCopyable

// Submit given single command buffer to queue and returns FenceObject for
// waiting submission completed
FenceObject submitCommandBuffer(
const std::shared_ptr<CommandBuffer>& commandBuffer,
SwapChain* swapChain, const FrameContext* frameContext,
const bool waitCompletion);
FenceObject submitCommandBuffer(const std::shared_ptr<CommandBuffer>& commandBuffer, SwapChain* swapChain, const FrameContext* frameContext,
const bool waitCompletion);

// Submit given command buffers to queue and returns FenceObject for waiting
// submission completed
FenceObject submitCommandBufferBatch(
std::vector<std::shared_ptr<CommandBuffer>>&& batchedCommandBuffers,
SwapChain* swapChain, const FrameContext* frameContext,
const bool waitAllCompletion);
FenceObject submitCommandBufferBatch(std::vector<std::shared_ptr<CommandBuffer>>&& batchedCommandBuffers, SwapChain* swapChain,
const FrameContext* frameContext, const bool waitAllCompletion);

// Returns Timeline semaphore which synchronized with queue submission
[[nodiscard]] inline VkSemaphore* getSubmitTimelineSemaphore()
Expand Down
3 changes: 1 addition & 2 deletions Includes/VoxFlow/Core/Devices/RenderDevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ class RenderDevice final : private NonCopyable
return _physicalDevice;
}

[[nodiscard]] inline LogicalDevice* getLogicalDevice(
const LogicalDeviceType deviceType) const
[[nodiscard]] inline LogicalDevice* getLogicalDevice(const LogicalDeviceType deviceType) const
{
return _logicalDevices.at(static_cast<uint32_t>(deviceType)).get();
}
Expand Down
22 changes: 7 additions & 15 deletions Includes/VoxFlow/Core/Devices/SwapChain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ class Texture;
class SwapChain : private NonCopyable
{
public:
explicit SwapChain(Instance* instance, PhysicalDevice* physicalDevice,
LogicalDevice* logicalDevice, Queue* presentSupportQueue,
std::string&& titleName, const glm::uvec2 resolution) noexcept;
explicit SwapChain(Instance* instance, PhysicalDevice* physicalDevice, LogicalDevice* logicalDevice, Queue* presentSupportQueue, std::string&& titleName,
const glm::uvec2 resolution) noexcept;
~SwapChain();
SwapChain(SwapChain&& other) noexcept;
SwapChain& operator=(SwapChain&& other) noexcept;
Expand Down Expand Up @@ -58,19 +57,16 @@ class SwapChain : private NonCopyable

// Add semaphores and waiting values from queue which use swapchain's back
// buffer to submit command
void addWaitSemaphores(const uint32_t frameIndex,
VkSemaphore timelineSemaphore,
const uint64_t waitingValue);
void addWaitSemaphores(const uint32_t frameIndex, VkSemaphore timelineSemaphore, const uint64_t waitingValue);

// Wait all semaphores added with frameIndex
void waitForGpuComplete(const uint32_t frameIndex);

// Returns whether swapChain window should be removed.
bool shouldDestroySwapChain() const;

private:
void querySwapChainCapability(
VkSwapchainCreateInfoKHR& swapChainCreateInfo, const bool vsync);
private:
void querySwapChainCapability(VkSwapchainCreateInfoKHR& swapChainCreateInfo, const bool vsync);

private:
Instance* _instance = nullptr;
Expand Down Expand Up @@ -106,7 +102,6 @@ class SwapChain : private NonCopyable
std::array<SemaphoreWaitInfo, FRAME_BUFFER_COUNT> _waitSemaphoreInfos;
};


inline VkSwapchainKHR SwapChain::get() const noexcept
{
return _swapChain;
Expand Down Expand Up @@ -135,12 +130,9 @@ inline uint32_t SwapChain::getFrameIndex() const noexcept
{
return _frameIndex;
}
inline std::shared_ptr<Texture> SwapChain::getSwapChainImage(
const uint32_t index) const
inline std::shared_ptr<Texture> SwapChain::getSwapChainImage(const uint32_t index) const
{
VOX_ASSERT(index < static_cast<uint32_t>(_swapChainImages.size()),
"Given Index ({}), Num SwapChain Images ({})", index,
_swapChainImages.size());
VOX_ASSERT(index < static_cast<uint32_t>(_swapChainImages.size()), "Given Index ({}), Num SwapChain Images ({})", index, _swapChainImages.size());
return _swapChainImages[index];
}
inline glm::uvec2 SwapChain::getResolution() const noexcept
Expand Down
3 changes: 1 addition & 2 deletions Includes/VoxFlow/Core/FrameGraph/BlackBoard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class BlackBoard : private NonCopyable
}
ResourceHandle& operator[](std::string_view name)
{
auto [iter, _] =
_handleContainer.insert_or_assign(name, INVALID_RESOURCE_HANDLE);
auto [iter, _] = _handleContainer.insert_or_assign(name, INVALID_RESOURCE_HANDLE);
return iter->second;
}

Expand Down
4 changes: 1 addition & 3 deletions Includes/VoxFlow/Core/FrameGraph/DependencyGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ class DependencyGraph : private NonCopyable
EdgeContainer getIncomingEdges(NodeID id);
EdgeContainer getOutgoingEdges(NodeID id);

template <typename ResourceEdgeType, typename... Args,
std::enable_if_t<std::is_base_of_v<Edge, ResourceEdgeType>,
bool> = true>
template <typename ResourceEdgeType, typename... Args, std::enable_if_t<std::is_base_of_v<Edge, ResourceEdgeType>, bool> = true>
DependencyGraph::Edge* link(NodeID fromID, NodeID toID, Args... args)
{
Node* fromNode = getNode(fromID);
Expand Down
Loading

0 comments on commit 35ff74b

Please sign in to comment.