38 lines
954 B
C++
38 lines
954 B
C++
// =============================================
|
|
// Aster: context.h
|
|
// Copyright (c) 2020-2024 Anish Bhobe
|
|
// =============================================
|
|
|
|
#pragma once
|
|
|
|
#include "device.h"
|
|
#include "global.h"
|
|
|
|
/**
|
|
* @class Context
|
|
*
|
|
* @brief Vulkan context to handle device initialization logic.
|
|
*
|
|
* Handles the required hardware interactions.
|
|
*/
|
|
struct Context final
|
|
{
|
|
// Members
|
|
vk::Instance m_Instance;
|
|
vk::DebugUtilsMessengerEXT m_DebugMessenger;
|
|
|
|
// Ctor/Dtor
|
|
void Init(cstr appName, Version version, bool enableValidation = ENABLE_VALIDATION_DEFAULT_VALUE);
|
|
void Destroy();
|
|
|
|
[[nodiscard]] bool IsInDebugMode() const;
|
|
|
|
#if !defined(ASTER_NDEBUG)
|
|
constexpr static bool ENABLE_VALIDATION_DEFAULT_VALUE = true;
|
|
#else
|
|
constexpr static bool ENABLE_VALIDATION_DEFAULT_VALUE = false;
|
|
#endif
|
|
};
|
|
|
|
static_assert(std::is_trivially_copyable_v<Context>);
|
|
static_assert(std::is_trivially_copy_assignable_v<Context>); |