Skip to content

Commit

Permalink
[VK] Rename some aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-johansson committed Apr 18, 2023
1 parent f325583 commit 8f33e9c
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/core/engine/backends/vulkan_backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ class VulkanBackend final : public Backend {
vk::PipelineCachePtr mPipelineCache;
vk::ImGuiData mImGuiData;
vk::CommandPoolPtr mCommandPool;
vk::DescriptorSetLayout mShadingDescriptorSetLayout;
vk::PipelineLayout mShadingPipelineLayout;
vk::Pipeline mShadingPipeline;
vk::DescriptorSetLayoutPtr mShadingDescriptorSetLayout;
vk::PipelineLayoutPtr mShadingPipelineLayout;
vk::PipelinePtr mShadingPipeline;
Vector<vk::FrameData> mFrames;
usize mFrameIndex {0};
vk::MaterialBuffer mMaterialBuffer;
Expand Down
6 changes: 3 additions & 3 deletions src/core/graphics/vulkan/frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ namespace glow::vk {
struct FrameData final {
VkCommandBuffer command_buffer {VK_NULL_HANDLE};

Semaphore image_available_semaphore {create_semaphore()};
Semaphore render_finished_semaphore {create_semaphore()};
Fence in_flight_fence {create_fence(true)};
SemaphorePtr image_available_semaphore {create_semaphore()};
SemaphorePtr render_finished_semaphore {create_semaphore()};
FencePtr in_flight_fence {create_fence(true)};

Buffer static_matrix_ubo {Buffer::uniform(sizeof(StaticMatrices))};
Buffer material_ubo {Buffer::uniform(sizeof(MaterialBuffer))};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ struct DescriptorSetLayoutDeleter final {
void operator()(VkDescriptorSetLayout layout) noexcept;
};

using DescriptorSetLayout = Unique<VkDescriptorSetLayout_T, DescriptorSetLayoutDeleter>;
using DescriptorSetLayoutPtr = Unique<VkDescriptorSetLayout_T, DescriptorSetLayoutDeleter>;

} // namespace glow::vk
2 changes: 1 addition & 1 deletion src/core/graphics/vulkan/pipeline/pipeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct PipelineDeleter final {
void operator()(VkPipeline pipeline) noexcept;
};

using Pipeline = Unique<VkPipeline_T, PipelineDeleter>;
using PipelinePtr = Unique<VkPipeline_T, PipelineDeleter>;

[[nodiscard]] auto create_pipeline_shader_stage(VkShaderStageFlagBits stage,
VkShaderModule shader_module)
Expand Down
7 changes: 4 additions & 3 deletions src/core/graphics/vulkan/pipeline/pipeline_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,17 @@ class PipelineBuilder final {
VkBlendFactor src_factor = VK_BLEND_FACTOR_ONE,
VkBlendFactor dst_factor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
VkBlendFactor src_alpha_factor = VK_BLEND_FACTOR_ONE,
VkBlendFactor dst_alpha_factor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA) -> Self&;
VkBlendFactor dst_alpha_factor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA)
-> Self&;

[[nodiscard]] auto build(VkRenderPass pass, VkPipelineLayout layout) const
-> VkPipeline;

private:
VkPipelineCache mCache;

ShaderModule mVertexShader;
ShaderModule mFragmentShader;
ShaderModulePtr mVertexShader;
ShaderModulePtr mFragmentShader;
VkPipelineShaderStageCreateInfo mShaderStages[2] {};

VkPipelineDynamicStateCreateInfo mDynamicState {};
Expand Down
2 changes: 1 addition & 1 deletion src/core/graphics/vulkan/pipeline/pipeline_layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ struct PipelineLayoutDeleter final {
void operator()(VkPipelineLayout layout) noexcept;
};

using PipelineLayout = Unique<VkPipelineLayout_T, PipelineLayoutDeleter>;
using PipelineLayoutPtr = Unique<VkPipelineLayout_T, PipelineLayoutDeleter>;

} // namespace glow::vk
4 changes: 2 additions & 2 deletions src/core/graphics/vulkan/pipeline/shader_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void ShaderModuleDeleter::operator()(VkShaderModule shader) noexcept
vkDestroyShaderModule(get_device(), shader, nullptr);
}

auto create_shader_module(const Path& shader_path) -> ShaderModule
auto create_shader_module(const Path& shader_path) -> ShaderModulePtr
{
const auto code = load_binary_file(shader_path);
if (!code) {
Expand All @@ -29,7 +29,7 @@ auto create_shader_module(const Path& shader_path) -> ShaderModule
GLOW_VK_CALL(vkCreateShaderModule(get_device(), &create_info, nullptr, &shader),
"[VK] Could not create shader module");

return ShaderModule {shader};
return ShaderModulePtr {shader};
}

} // namespace glow::vk
4 changes: 2 additions & 2 deletions src/core/graphics/vulkan/pipeline/shader_module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ struct ShaderModuleDeleter final {
void operator()(VkShaderModule shader) noexcept;
};

using ShaderModule = Unique<VkShaderModule_T, ShaderModuleDeleter>;
using ShaderModulePtr = Unique<VkShaderModule_T, ShaderModuleDeleter>;

[[nodiscard]] auto create_shader_module(const Path& shader_path) -> ShaderModule;
[[nodiscard]] auto create_shader_module(const Path& shader_path) -> ShaderModulePtr;

} // namespace glow::vk
4 changes: 2 additions & 2 deletions src/core/graphics/vulkan/sync/fence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void FenceDeleter::operator()(VkFence fence) noexcept
vkDestroyFence(get_device(), fence, nullptr);
}

auto create_fence(const bool signaled) -> Fence
auto create_fence(const bool signaled) -> FencePtr
{
GLOW_ASSERT(get_device() != VK_NULL_HANDLE);

Expand All @@ -35,7 +35,7 @@ auto create_fence(const bool signaled) -> Fence
GLOW_VK_CALL(vkCreateFence(get_device(), &create_info, nullptr, &fence),
"[VK] Could not create fence");

return Fence {fence};
return FencePtr {fence};
}

void reset_fence(VkFence fence)
Expand Down
4 changes: 2 additions & 2 deletions src/core/graphics/vulkan/sync/fence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ struct FenceDeleter final {
};

/// Represents a binary semaphore, for CPU-side synchronization (known as a "fence").
using Fence = Unique<VkFence_T, FenceDeleter>;
using FencePtr = Unique<VkFence_T, FenceDeleter>;

[[nodiscard]] auto create_fence(bool signaled = true) -> Fence;
[[nodiscard]] auto create_fence(bool signaled = true) -> FencePtr;

/// Resets a fence to its unsignaled state.
void reset_fence(VkFence fence);
Expand Down
4 changes: 2 additions & 2 deletions src/core/graphics/vulkan/sync/semaphore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void SemaphoreDeleter::operator()(VkSemaphore semaphore) noexcept
vkDestroySemaphore(get_device(), semaphore, nullptr);
}

auto create_semaphore() -> Semaphore
auto create_semaphore() -> SemaphorePtr
{
GLOW_ASSERT(get_device() != VK_NULL_HANDLE);

Expand All @@ -25,7 +25,7 @@ auto create_semaphore() -> Semaphore
GLOW_VK_CALL(vkCreateSemaphore(get_device(), &create_info, nullptr, &semaphore),
"[VK] Could not create semaphore");

return Semaphore {semaphore};
return SemaphorePtr {semaphore};
}

} // namespace glow::vk
4 changes: 2 additions & 2 deletions src/core/graphics/vulkan/sync/semaphore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ struct SemaphoreDeleter final {
};

/// Represents a binary semaphore, for GPU-side synchronization.
using Semaphore = Unique<VkSemaphore_T, SemaphoreDeleter>;
using SemaphorePtr = Unique<VkSemaphore_T, SemaphoreDeleter>;

[[nodiscard]] auto create_semaphore() -> Semaphore;
[[nodiscard]] auto create_semaphore() -> SemaphorePtr;

} // namespace glow::vk

0 comments on commit 8f33e9c

Please sign in to comment.