diff options
Diffstat (limited to 'src/platform/vulkan/vulkan_common.h')
| -rw-r--r-- | src/platform/vulkan/vulkan_common.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/platform/vulkan/vulkan_common.h b/src/platform/vulkan/vulkan_common.h index 8f02f17..cb86d69 100644 --- a/src/platform/vulkan/vulkan_common.h +++ b/src/platform/vulkan/vulkan_common.h @@ -1,10 +1,10 @@ #pragma once -// Shared internals of the Vulkan RHI backend: the enum-mapping helpers, the +// shared internals of the Vulkan RHI backend: the enum-mapping helpers, the // opaque resource classes (Buffer/Texture/RenderTarget/Pipeline/CommandList), and -// the VulkanDevice declaration. The implementation is split across vulkan_device +// the VulkanDevice declaration. the implementation is split across vulkan_device // (lifecycle + frame loop), vulkan_swapchain (instance/device/swapchain/passes), -// vulkan_resources (buffer/texture/target/pipeline) and vulkan_cubemap. This +// vulkan_resources (buffer/texture/target/pipeline) and vulkan_cubemap. this // header is private to platform/vulkan/ — nothing outside includes it. #include "vulkan_device.h" // rendering/rhi.h (base classes + factory decls) @@ -63,7 +63,7 @@ namespace Donut::RHI inline auto vk_cull(CullMode c) -> VkCullModeFlags { return c == CullMode::None ? VK_CULL_MODE_NONE : c == CullMode::Back ? VK_CULL_MODE_BACK_BIT : VK_CULL_MODE_FRONT_BIT; } - // Buffer: host-visible + coherent, persistently mapped. + // buffer: host-visible + coherent, persistently mapped. class VkBufferR : public Buffer { public: @@ -81,7 +81,7 @@ namespace Donut::RHI VkDevice m_device; VkBuffer m_buf; VkDeviceMemory m_mem; void* m_mapped; size_t m_size; }; - // Texture: sampled image (2D or cube). Owns its handles unless it is a borrowed + // texture: sampled image (2D or cube). owns its handles unless it is a borrowed // wrapper around a render-target view. class VkTextureR : public Texture { @@ -138,7 +138,7 @@ namespace Donut::RHI VkTextureR m_color; // borrowed wrapper (view+sampler) for sampling }; - // Pipeline: the graphics pipeline + its (set-0) descriptor layout. + // pipeline: the graphics pipeline + its (set-0) descriptor layout. class VkPipelineR : public Pipeline { public: @@ -155,8 +155,9 @@ namespace Donut::RHI std::vector<ResourceSlot> m_resources; }; - // CommandList: records into the frame's command buffer. Per-draw descriptor - // sets are allocated from a per-frame pool (no push-descriptor extension). + // CommandList: records into the frame's command buffer. MoltenVK has no + // push-descriptor extension, so we just grab a fresh descriptor set per draw + // from a per-frame pool. kinda wasteful, but it works and that's what counts. class VkCommandListR : public CommandList { public: @@ -219,7 +220,7 @@ namespace Donut::RHI auto draw_indexed(uint32_t index_count) -> void override { flush_descriptors(); vkCmdDrawIndexed(m_cmd, index_count, 1, 0, 0, 0); } - // Allocate + write + bind a descriptor set for the current pipeline's + // allocate + write + bind a descriptor set for the current pipeline's // declared resources, using whatever was bound since bind_pipeline. auto flush_descriptors() -> void { @@ -246,7 +247,7 @@ namespace Donut::RHI vkCmdBindDescriptorSets(m_cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipe->m_layout, 0, 1, &set, 0, nullptr); } - // Set by the device at begin_frame: + // set by the device at begin_frame: VkDevice m_device = VK_NULL_HANDLE; VkCommandBuffer m_cmd = VK_NULL_HANDLE; VkRenderPass m_swapchain_rp = VK_NULL_HANDLE; @@ -259,7 +260,7 @@ namespace Donut::RHI VkDescriptorImageInfo m_img_info[MAX_BINDINGS]{}; }; - // The backend device. Its methods are defined across vulkan_device.cpp, + // the backend device. its methods are defined across vulkan_device.cpp, // vulkan_swapchain.cpp, vulkan_resources.cpp and vulkan_cubemap.cpp. class VulkanDevice : public Device { @@ -298,7 +299,7 @@ namespace Donut::RHI auto pick_physical_and_device() -> bool; auto create_swapchain() -> bool; auto create_image_views() -> bool; - // Render passes are format-driven and cached: a pipeline/target's + // render passes are format-driven and cached: a pipeline/target's // attachment signature (colour + optional depth, present vs sampled) // maps to one pass. `present` = presented swapchain image. auto get_render_pass(VkFormat color, VkFormat depth, bool present) -> VkRenderPass; |
