mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
begenning the refactor
This commit is contained in:
51
runtime/Includes/Renderer/Core/Queues.h
git.filemode.normal_file
51
runtime/Includes/Renderer/Core/Queues.h
git.filemode.normal_file
@@ -0,0 +1,51 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Queues.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/08 19:01:49 by maldavid #+# #+# */
|
||||
/* Updated: 2024/03/27 22:50:52 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef __MLX_VK_QUEUES__
|
||||
#define __MLX_VK_QUEUES__
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
class Queues
|
||||
{
|
||||
public:
|
||||
struct QueueFamilyIndices
|
||||
{
|
||||
std::optional<std::uint32_t> graphics_family;
|
||||
std::optional<std::uint32_t> present_family;
|
||||
|
||||
inline bool isComplete() { return graphics_family.has_value() && present_family.has_value(); }
|
||||
};
|
||||
|
||||
public:
|
||||
QueueFamilyIndices FindQueueFamilies(VkPhysicalDevice device);
|
||||
|
||||
void Init();
|
||||
|
||||
inline VkQueue& GetGraphic() noexcept { return _graphics_queue; }
|
||||
inline VkQueue& GetPresent() noexcept { return _present_queue; }
|
||||
inline QueueFamilyIndices GetFamilies() noexcept
|
||||
{
|
||||
if(m_families.has_value())
|
||||
return *m_families;
|
||||
FatalError("Vulkan : cannot get queue families, not init");
|
||||
return {}; // just to avoid warnings
|
||||
}
|
||||
|
||||
private:
|
||||
VkQueue m_graphics_queue;
|
||||
VkQueue m_present_queue;
|
||||
std::optional<QueueFamilyIndices> m_families;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __MLX_VK_QUEUES__
|
||||
Reference in New Issue
Block a user