mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
begenning the refactor
This commit is contained in:
36
runtime/Includes/Renderer/Renderpass/FrameBuffer.h
git.filemode.normal_file
36
runtime/Includes/Renderer/Renderpass/FrameBuffer.h
git.filemode.normal_file
@@ -0,0 +1,36 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* vk_framebuffer.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/06 18:19:44 by maldavid #+# #+# */
|
||||
/* Updated: 2024/03/25 19:08:37 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef __MLX_VK_FRAMEBUFFER__
|
||||
#define __MLX_VK_FRAMEBUFFER__
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
class FrameBuffer
|
||||
{
|
||||
public:
|
||||
void init(class RenderPass& renderpass, class Image& image);
|
||||
void destroy() noexcept;
|
||||
|
||||
inline VkFramebuffer& operator()() noexcept { return _framebuffer; }
|
||||
inline VkFramebuffer& get() noexcept { return _framebuffer; }
|
||||
inline std::uint32_t getWidth() const noexcept { return _width; }
|
||||
inline std::uint32_t getHeight() const noexcept { return _height; }
|
||||
|
||||
private:
|
||||
VkFramebuffer _framebuffer = VK_NULL_HANDLE;
|
||||
std::uint32_t _width = 0;
|
||||
std::uint32_t _height = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __MLX_VK_FRAMEBUFFER__
|
||||
36
runtime/Includes/Renderer/Renderpass/RenderPass.h
git.filemode.normal_file
36
runtime/Includes/Renderer/Renderpass/RenderPass.h
git.filemode.normal_file
@@ -0,0 +1,36 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* vk_render_pass.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/06 18:22:00 by maldavid #+# #+# */
|
||||
/* Updated: 2024/03/25 19:08:30 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef __MLX_VK_RENDER_PASS__
|
||||
#define __MLX_VK_RENDER_PASS__
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
class RenderPass
|
||||
{
|
||||
public:
|
||||
void init(VkFormat attachement_format, VkImageLayout layout);
|
||||
void destroy() noexcept;
|
||||
|
||||
void begin(class CmdBuffer& cmd, class FrameBuffer& fb);
|
||||
void end(class CmdBuffer& cmd);
|
||||
|
||||
inline VkRenderPass& operator()() noexcept { return _render_pass; }
|
||||
inline VkRenderPass& get() noexcept { return _render_pass; }
|
||||
|
||||
private:
|
||||
VkRenderPass _render_pass = VK_NULL_HANDLE;
|
||||
bool _is_running = false;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __MLX_VK_RENDER_PASS__
|
||||
65
runtime/Includes/Renderer/Renderpass/Swapchain.h
git.filemode.normal_file
65
runtime/Includes/Renderer/Renderpass/Swapchain.h
git.filemode.normal_file
@@ -0,0 +1,65 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* vk_swapchain.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/06 18:23:27 by maldavid #+# #+# */
|
||||
/* Updated: 2024/03/25 19:08:26 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef __MLX_VK_SWAPCHAIN__
|
||||
#define __MLX_VK_SWAPCHAIN__
|
||||
|
||||
#include <renderer/images/vk_image.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
class SwapChain
|
||||
{
|
||||
friend class GraphicPipeline;
|
||||
friend class RenderPass;
|
||||
friend class Renderer;
|
||||
|
||||
public:
|
||||
struct SwapChainSupportDetails
|
||||
{
|
||||
VkSurfaceCapabilitiesKHR capabilities;
|
||||
std::vector<VkSurfaceFormatKHR> formats;
|
||||
std::vector<VkPresentModeKHR> present_modes;
|
||||
};
|
||||
|
||||
public:
|
||||
SwapChain() = default;
|
||||
|
||||
void init(class Renderer* renderer);
|
||||
void recreate();
|
||||
void destroy() noexcept;
|
||||
|
||||
SwapChainSupportDetails querySwapChainSupport(VkPhysicalDevice device);
|
||||
VkExtent2D chooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities);
|
||||
VkPresentModeKHR chooseSwapPresentMode([[maybe_unused]] const std::vector<VkPresentModeKHR> &availablePresentModes);
|
||||
|
||||
inline VkSwapchainKHR get() noexcept { return _swapchain; }
|
||||
inline VkSwapchainKHR operator()() noexcept { return _swapchain; }
|
||||
inline std::size_t getImagesNumber() const noexcept { return _images.size(); }
|
||||
inline Image& getImage(std::size_t i) noexcept { return _images[i]; }
|
||||
inline SwapChainSupportDetails getSupport() noexcept { return _swapchain_support; }
|
||||
inline VkExtent2D getExtent() noexcept { return _extent; }
|
||||
inline VkFormat getImagesFormat() const noexcept { return _swapchain_image_format; }
|
||||
|
||||
~SwapChain() = default;
|
||||
|
||||
private:
|
||||
SwapChainSupportDetails _swapchain_support;
|
||||
VkSwapchainKHR _swapchain;
|
||||
std::vector<Image> _images;
|
||||
VkFormat _swapchain_image_format;
|
||||
VkExtent2D _extent;
|
||||
class Renderer* _renderer = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __MLX_VK_SWAPCHAIN__
|
||||
Reference in New Issue
Block a user