6 Commits
Author SHA1 Message Date
rboullard d8b7698d4b Update mimalloc
Bigfoot / Sonarqube (game) (push) Skipped
Bigfoot / Sonarqube (toolmode) (push) Skipped
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Failing after 35s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 46s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 46s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Failing after 42s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Failing after 40s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Failing after 34s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 48s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 51s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Failing after 39s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 34s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Failing after 1m46s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 1m53s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Failing after 44s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Failing after 1m45s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 1m59s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Failing after 30s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Failing after 27s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 32s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Failing after 39s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 40s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Failing after 34s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Failing after 27s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Failing after 37s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 39s
Bigfoot / Clang Format Checks (push) Successful in 11s
2026-09-09 00:46:56 +02:00
rboullard e27d69b36e VulkanSurface 2026-09-09 00:46:41 +02:00
rboullard 7f3b46867f Graphics queue 2026-09-09 00:37:10 +02:00
rboullard fcf9bfa19e VulkanInstance 2026-09-09 00:31:38 +02:00
rboullard 6895daa676 VulkanFormatters 2026-09-09 00:05:05 +02:00
rboullard 246ea70e93 GraphicsAPI 2026-09-08 23:36:37 +02:00
18 changed files with 885 additions and 2 deletions
@@ -0,0 +1,6 @@
namespace Bigfoot;
enum GraphicsAPI: byte
{
Vulkan
}
@@ -0,0 +1,71 @@
// automatically generated by the FlatBuffers compiler, do not modify
#ifndef FLATBUFFERS_GENERATED_GRAPHICSAPI_BIGFOOT_H_
#define FLATBUFFERS_GENERATED_GRAPHICSAPI_BIGFOOT_H_
#include "flatbuffers/flatbuffers.h"
// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 19,
"Non-compatible flatbuffers version included");
// Ensure the included flatbuffers.h is Bigfoot's fork - stock
// flatbuffers (or a differently versioned Bigfoot fork) is not compatible.
#ifndef FLATBUFFERS_BIGFOOT_VERSION
#error "This file requires Bigfoot's flatbuffers fork - stock flatbuffers is not compatible"
#endif
static_assert(FLATBUFFERS_BIGFOOT_VERSION == 1,
"Non-compatible Bigfoot flatbuffers fork version included");
#include "EASTL/unique_ptr.h"
#include "EASTL/string.h"
#include "EASTL/vector.h"
namespace Bigfoot {
enum class GraphicsAPI : int8_t {
Vulkan = 0,
MIN = Vulkan,
MAX = Vulkan
};
inline const GraphicsAPI (&EnumValuesGraphicsAPI())[1] {
static const GraphicsAPI values[] = {
GraphicsAPI::Vulkan
};
return values;
}
inline const char * const *EnumNamesGraphicsAPI() {
static const char * const names[2] = {
"Vulkan",
nullptr
};
return names;
}
inline const char *EnumNameGraphicsAPI(GraphicsAPI e) {
if (::flatbuffers::IsOutRange(e, GraphicsAPI::Vulkan, GraphicsAPI::Vulkan)) return "";
const size_t index = static_cast<size_t>(e);
return EnumNamesGraphicsAPI()[index];
}
inline const ::flatbuffers::TypeTable *GraphicsAPITypeTable() {
static const ::flatbuffers::TypeCode type_codes[] = {
{ ::flatbuffers::ET_CHAR, 0, 0 }
};
static const ::flatbuffers::TypeFunction type_refs[] = {
Bigfoot::GraphicsAPITypeTable
};
static const ::flatbuffers::TypeTable tt = {
::flatbuffers::ST_ENUM, 1, type_codes, type_refs, nullptr, nullptr, nullptr
};
return &tt;
}
} // namespace Bigfoot
#endif // FLATBUFFERS_GENERATED_GRAPHICSAPI_BIGFOOT_H_
@@ -0,0 +1,43 @@
/*********************************************************************
* \file GraphicsInstance.hpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#ifndef BIGFOOT_GRAPHICSINTERFACE_GRAPHICSINSTANCE_HPP
#define BIGFOOT_GRAPHICSINTERFACE_GRAPHICSINSTANCE_HPP
#include <Utils/Factory.hpp>
#include <Utils/Version.hpp>
#include <GraphicsInterface/GraphicsAPI_generated.hpp>
#include <EASTL/functional.h>
#include <EASTL/string_view.h>
#include <EASTL/unique_ptr.h>
namespace Bigfoot
{
class GraphicsInstance
{
public:
virtual ~GraphicsInstance() = default;
GraphicsInstance(const GraphicsInstance& p_instance) = delete;
GraphicsInstance(GraphicsInstance&& p_instance) = delete;
GraphicsInstance& operator=(const GraphicsInstance& p_instance) = delete;
GraphicsInstance& operator=(GraphicsInstance&& p_instance) = delete;
protected:
GraphicsInstance() = default;
};
/****************************************************************************************/
using GraphicsInstanceFactory =
Factory<GraphicsInstance,
GraphicsAPI,
eastl::function<eastl::unique_ptr<GraphicsInstance>(eastl::string_view, Version)>>;
} // namespace Bigfoot
#endif
@@ -0,0 +1,47 @@
/*********************************************************************
* \file GraphicsQueue.hpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#ifndef BIGFOOT_GRAPHICSINTERFACE_GRAPHICSQUEUE_HPP
#define BIGFOOT_GRAPHICSINTERFACE_GRAPHICSQUEUE_HPP
namespace Bigfoot
{
/**
* The kind of work a GraphicsQueue submit
*/
enum class GraphicsQueueType
{
Graphics,
Compute,
Transfer,
Present
};
class GraphicsQueue
{
public:
virtual ~GraphicsQueue() = default;
/**
* Get the kind of work this queue can be submitted
*
* \return The queue type
*/
[[nodiscard]]
virtual GraphicsQueueType GetType() const = 0;
GraphicsQueue(const GraphicsQueue& p_queue) = delete;
GraphicsQueue(GraphicsQueue&& p_queue) = delete;
GraphicsQueue& operator=(const GraphicsQueue& p_queue) = delete;
GraphicsQueue& operator=(GraphicsQueue&& p_queue) = delete;
protected:
GraphicsQueue() = default;
};
} // namespace Bigfoot
#endif
@@ -0,0 +1,65 @@
/*********************************************************************
* \file GraphicsSurface.hpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#ifndef BIGFOOT_GRAPHICSINTERFACE_GRAPHICSSURFACE_HPP
#define BIGFOOT_GRAPHICSINTERFACE_GRAPHICSSURFACE_HPP
#include <GraphicsInterface/GraphicsInstance.hpp>
#include <Utils/Factory.hpp>
#include <Utils/TargetMacros.h>
#include <GraphicsInterface/GraphicsAPI_generated.hpp>
#include <EASTL/functional.h>
#include <EASTL/unique_ptr.h>
#ifdef BIGFOOT_WINDOWS
#include <Windows.h>
#elif defined BIGFOOT_LINUX
#include <X11/X.h>
#include <X11/Xlib.h>
#endif
namespace Bigfoot
{
/**
* The native window handles needed to create a GraphicsSurface
*/
struct SurfaceCreateInfo
{
#ifdef BIGFOOT_WINDOWS
HWND m_windowHandle = nullptr;
HINSTANCE m_windowInstance = nullptr;
#elif defined BIGFOOT_LINUX
Display* m_display = nullptr;
Window m_window = 0;
#endif
};
class GraphicsSurface
{
public:
virtual ~GraphicsSurface() = default;
GraphicsSurface(const GraphicsSurface& p_surface) = delete;
GraphicsSurface(GraphicsSurface&& p_surface) = delete;
GraphicsSurface& operator=(const GraphicsSurface& p_surface) = delete;
GraphicsSurface& operator=(GraphicsSurface&& p_surface) = delete;
protected:
GraphicsSurface() = default;
};
/****************************************************************************************/
using GraphicsSurfaceFactory =
Factory<GraphicsSurface,
GraphicsAPI,
eastl::function<eastl::unique_ptr<GraphicsSurface>(const GraphicsInstance&, const SurfaceCreateInfo&)>>;
} // namespace Bigfoot
#endif
@@ -7,7 +7,8 @@ set(PublicDependencies
set(PrivateDependencies)
set(BigfootPublicDependencies
GraphicsInterface)
set(BigfootPrivateDependencies)
set(BigfootPrivateDependencies
Engine)
bigfoot_create_package_lib(
"${PublicDependencies}"
@@ -0,0 +1,51 @@
/*********************************************************************
* \file VulkanFormatters.hpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#ifndef BIGFOOT_GRAPHICSVULKAN_VULKANFORMATTERS_HPP
#define BIGFOOT_GRAPHICSVULKAN_VULKANFORMATTERS_HPP
#include <GraphicsVulkan/VulkanInclude.hpp>
#include <Utils/TargetMacros.h>
#include <fmt/format.h>
template<>
struct fmt::formatter<vk::Result>
{
static constexpr auto parse(format_parse_context& ctx)
{
return ctx.begin();
}
static auto format(const vk::Result p_result, format_context& ctx)
{
return fmt::format_to(ctx.out(), "{}", vk::to_string(p_result));
}
};
#ifdef BIGFOOT_NOT_OPTIMIZED
#include <quill/DeferredFormatCodec.h>
template<>
struct fmtquill::formatter<vk::Result>
{
static constexpr auto parse(format_parse_context& ctx)
{
return ctx.begin();
}
static auto format(const vk::Result p_result, format_context& ctx)
{
return fmtquill::format_to(ctx.out(), "{}", vk::to_string(p_result));
}
};
template<>
struct quill::Codec<vk::Result>: quill::DeferredFormatCodec<vk::Result>
{
};
#endif
#endif
@@ -0,0 +1,13 @@
/*********************************************************************
* \file VulkanInclude.hpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#ifndef BIGFOOT_GRAPHICSVULKAN_VULKANINCLUDE_HPP
#define BIGFOOT_GRAPHICSVULKAN_VULKANINCLUDE_HPP
#define VULKAN_HPP_ASSERT(result)
#define VULKAN_HPP_ASSERT_ON_RESULT(result)
#include <vulkan/vulkan.hpp>
#endif
@@ -0,0 +1,59 @@
/*********************************************************************
* \file VulkanInstance.hpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#ifndef BIGFOOT_GRAPHICSVULKAN_VULKANINSTANCE_HPP
#define BIGFOOT_GRAPHICSVULKAN_VULKANINSTANCE_HPP
#include <GraphicsVulkan/VulkanInclude.hpp>
#include <GraphicsInterface/GraphicsInstance.hpp>
#include <Utils/TargetMacros.h>
#include <Utils/Version.hpp>
#include <EASTL/string_view.h>
namespace Bigfoot::Vulkan
{
class VulkanInstance final: public GraphicsInstance
{
public:
/**
* Constructor. Creates a vk::Instance
*
* \param p_applicationName The name of the application
* \param p_applicationVersion The version of the application
*/
VulkanInstance(eastl::string_view p_applicationName, Version p_applicationVersion);
~VulkanInstance() override;
/**
* Get the underlying Vulkan instance handle
*
* \return The vk::Instance handle
*/
[[nodiscard]]
vk::Instance GetHandle() const;
private:
/**
* The vulkan loader.
*/
vk::detail::DynamicLoader m_loader;
/**
* The vulkan instance.
*/
vk::Instance m_instance;
/**
* The debug messenger (used for validation callbacks).
*/
BIGFOOT_NOT_OPTIMIZED_ONLY(vk::DebugUtilsMessengerEXT m_debugMessenger);
};
} // namespace Bigfoot::Vulkan
#endif
@@ -0,0 +1,71 @@
/*********************************************************************
* \file VulkanQueue.hpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#ifndef BIGFOOT_GRAPHICSVULKAN_VULKANQUEUE_HPP
#define BIGFOOT_GRAPHICSVULKAN_VULKANQUEUE_HPP
#include <GraphicsVulkan/VulkanInclude.hpp>
#include <GraphicsInterface/GraphicsQueue.hpp>
#include <cstdint>
namespace Bigfoot::Vulkan
{
class VulkanQueue final: public GraphicsQueue
{
public:
/**
* Constructor
*
* \param p_queue The underlying Vulkan queue handle
* \param p_familyIndex The queue family index this queue was retrieved from
* \param p_type The kind of work this queue can submit
*/
VulkanQueue(vk::Queue p_queue, std::uint32_t p_familyIndex, GraphicsQueueType p_type);
/**
* Get the kind of work this queue can be submitted
*
* \return The queue type
*/
[[nodiscard]]
GraphicsQueueType GetType() const override;
/**
* Get the underlying Vulkan queue handle
*
* \return The vk::Queue handle
*/
[[nodiscard]]
vk::Queue GetHandle() const;
/**
* Get the index of the queue family this queue was retrieved from
*
* \return The queue family index
*/
[[nodiscard]]
std::uint32_t GetFamilyIndex() const;
private:
/**
* The vulkn queue
*/
vk::Queue m_queue;
/**
* The index of the queue family this queue was retrieved from
*/
std::uint32_t m_familyIndex;
/**
* The kind of work this queue can submit
*/
GraphicsQueueType m_type;
};
} // namespace Bigfoot::Vulkan
#endif
@@ -0,0 +1,51 @@
/*********************************************************************
* \file VulkanSurface.hpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#ifndef BIGFOOT_GRAPHICSVULKAN_VULKANSURFACE_HPP
#define BIGFOOT_GRAPHICSVULKAN_VULKANSURFACE_HPP
#include <GraphicsVulkan/VulkanInclude.hpp>
#include <GraphicsVulkan/VulkanInstance.hpp>
#include <GraphicsInterface/GraphicsSurface.hpp>
namespace Bigfoot::Vulkan
{
class VulkanSurface final: public GraphicsSurface
{
public:
/**
* Constructor.
* Creates a vk::SurfaceKHR for the given native window.
*
* \param p_instance The instance to create the surface from
* \param p_surfaceCreateInfo The native window handles to create the surface for
*/
VulkanSurface(const VulkanInstance& p_instance, const SurfaceCreateInfo& p_surfaceCreateInfo);
~VulkanSurface() override;
/**
* Get the underlying Vulkan surface handle
*
* \return The vk::SurfaceKHR handle
*/
[[nodiscard]]
vk::SurfaceKHR GetHandle() const;
private:
/**
* The instance
*/
const VulkanInstance& m_instance;
/**
* The surface
*/
vk::SurfaceKHR m_surface;
};
} // namespace Bigfoot::Vulkan
#endif
@@ -0,0 +1,160 @@
/*********************************************************************
* \file VulkanInstance.cpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#include <GraphicsVulkan/VulkanInstance.hpp>
#include <GraphicsVulkan/GraphicsVulkanAssertHandler.hpp>
#include <GraphicsVulkan/VulkanFormatters.hpp>
#include <Engine/EngineInfo_generated.hpp>
#include <EASTL/algorithm.h>
#include <EASTL/string.h>
#include <EASTL/vector.h>
#include <cstdint>
#include <vector>
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
namespace Bigfoot::Vulkan
{
[[nodiscard]]
std::uint32_t ToVulkanVersion(const Bigfoot::Version p_version)
{
return VK_MAKE_VERSION(p_version.GetMajor(), p_version.GetMinor(), p_version.GetPatch());
}
/****************************************************************************************/
#ifdef BIGFOOT_NOT_OPTIMIZED
vk::Bool32 VulkanDebugCallback(const vk::DebugUtilsMessageSeverityFlagBitsEXT p_severity,
[[maybe_unused]] vk::DebugUtilsMessageTypeFlagsEXT p_type,
const vk::DebugUtilsMessengerCallbackDataEXT* p_callbackData,
[[maybe_unused]] void* p_userData)
{
switch (p_severity)
{
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eError:
BIGFOOT_LOG_ERROR(::Bigfoot::GRAPHICSVULKAN_LOGGER, "{}", p_callbackData->pMessage);
break;
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning:
BIGFOOT_LOG_WARN(::Bigfoot::GRAPHICSVULKAN_LOGGER, "{}", p_callbackData->pMessage);
break;
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eInfo:
BIGFOOT_LOG_INFO(::Bigfoot::GRAPHICSVULKAN_LOGGER, "{}", p_callbackData->pMessage);
break;
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eVerbose:
default:
BIGFOOT_LOG_TRACE(::Bigfoot::GRAPHICSVULKAN_LOGGER, "{}", p_callbackData->pMessage);
break;
}
return VK_FALSE;
}
#endif
/****************************************************************************************/
VulkanInstance::VulkanInstance(const eastl::string_view p_applicationName, const Version p_applicationVersion)
{
const PFN_vkGetInstanceProcAddr getInstanceProcAddr = m_loader.getProcAddress<PFN_vkGetInstanceProcAddr>(
"vkGetInstanceProcAddr");
CRITICAL_ASSERT(GraphicsVulkanAssertHandler, getInstanceProcAddr != nullptr, "vkGetInstanceProcAddr not found!");
VULKAN_HPP_DEFAULT_DISPATCHER.init(getInstanceProcAddr);
const eastl::string applicationName {p_applicationName};
const vk::ApplicationInfo applicationInfo {applicationName.c_str(),
ToVulkanVersion(p_applicationVersion),
BIGFOOT_NAME.data(),
ToVulkanVersion(BIGFOOT_VERSION),
VK_API_VERSION_1_3};
eastl::vector<const char*> enabledLayers;
eastl::vector<const char*> enabledExtensions {
VK_KHR_SURFACE_EXTENSION_NAME,
BIGFOOT_WINDOWS_OR_LINUX(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_EXTENSION_NAME)};
#ifdef BIGFOOT_NOT_OPTIMIZED
const vk::ResultValue<std::vector<vk::LayerProperties>> availableLayers = vk::enumerateInstanceLayerProperties();
CRITICAL_ASSERT(GraphicsVulkanAssertHandler,
availableLayers.result == vk::Result::eSuccess,
"({}) Failed to enumerate Vulkan instance layers",
availableLayers.result);
const bool validationLayerAvailable = eastl::find_if(availableLayers.value.begin(),
availableLayers.value.end(),
[](const vk::LayerProperties& p_layer)
{
return eastl::string_view {p_layer.layerName.data()} ==
"VK_LAYER_KHRONOS_validation";
}) != availableLayers.value.end();
if (validationLayerAvailable)
{
enabledLayers.push_back("VK_LAYER_KHRONOS_validation");
enabledExtensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
}
else
{
BIGFOOT_LOG_WARN(GRAPHICSVULKAN_LOGGER, "Vulkan validation layer requested but not available");
}
#endif
const vk::InstanceCreateInfo instanceCreateInfo {{}, &applicationInfo, enabledLayers, enabledExtensions};
const vk::ResultValue<vk::Instance> instance = vk::createInstance(instanceCreateInfo);
CRITICAL_ASSERT(GraphicsVulkanAssertHandler,
instance.result == vk::Result::eSuccess,
"({}) Failed to create Vulkan instance",
instance.result);
m_instance = instance.value;
VULKAN_HPP_DEFAULT_DISPATCHER.init(m_instance);
#ifdef BIGFOOT_NOT_OPTIMIZED
if (validationLayerAvailable)
{
vk::DebugUtilsMessengerCreateInfoEXT messengerCreateInfo {};
messengerCreateInfo.messageSeverity = vk::DebugUtilsMessageSeverityFlagsEXT {
vk::DebugUtilsMessageSeverityFlagBitsEXT::eVerbose | vk::DebugUtilsMessageSeverityFlagBitsEXT::eInfo |
vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning | vk::DebugUtilsMessageSeverityFlagBitsEXT::eError};
messengerCreateInfo.messageType = vk::DebugUtilsMessageTypeFlagsEXT {
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation |
vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance};
messengerCreateInfo.pfnUserCallback = &VulkanDebugCallback;
const vk::ResultValue<vk::DebugUtilsMessengerEXT> messenger = m_instance.createDebugUtilsMessengerEXT(
messengerCreateInfo);
CRITICAL_ASSERT(GraphicsVulkanAssertHandler,
messenger.result == vk::Result::eSuccess,
"({}) Failed to create Vulkan debug messenger",
messenger.result);
m_debugMessenger = messenger.value;
}
#endif
}
/****************************************************************************************/
VulkanInstance::~VulkanInstance()
{
#ifdef BIGFOOT_NOT_OPTIMIZED
if (m_debugMessenger)
{
m_instance.destroyDebugUtilsMessengerEXT(m_debugMessenger);
}
#endif
m_instance.destroy();
}
/****************************************************************************************/
vk::Instance VulkanInstance::GetHandle() const
{
return m_instance;
}
} // namespace Bigfoot::Vulkan
@@ -0,0 +1,38 @@
/*********************************************************************
* \file VulkanQueue.cpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#include <GraphicsVulkan/VulkanQueue.hpp>
namespace Bigfoot::Vulkan
{
VulkanQueue::VulkanQueue(const vk::Queue p_queue, const std::uint32_t p_familyIndex, const GraphicsQueueType p_type):
m_queue(p_queue),
m_familyIndex(p_familyIndex),
m_type(p_type)
{
}
/****************************************************************************************/
GraphicsQueueType VulkanQueue::GetType() const
{
return m_type;
}
/****************************************************************************************/
vk::Queue VulkanQueue::GetHandle() const
{
return m_queue;
}
/****************************************************************************************/
std::uint32_t VulkanQueue::GetFamilyIndex() const
{
return m_familyIndex;
}
} // namespace Bigfoot::Vulkan
@@ -0,0 +1,47 @@
/*********************************************************************
* \file VulkanSurface.cpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#include <GraphicsVulkan/VulkanSurface.hpp>
#include <GraphicsVulkan/GraphicsVulkanAssertHandler.hpp>
#include <GraphicsVulkan/VulkanFormatters.hpp>
namespace Bigfoot::Vulkan
{
VulkanSurface::VulkanSurface(const VulkanInstance& p_instance, const SurfaceCreateInfo& p_surfaceCreateInfo):
m_instance(p_instance)
{
#ifdef BIGFOOT_WINDOWS
const vk::Win32SurfaceCreateInfoKHR createInfo {{},
p_surfaceCreateInfo.m_windowInstance,
p_surfaceCreateInfo.m_windowHandle};
const vk::ResultValue<vk::SurfaceKHR> surface = m_instance.GetHandle().createWin32SurfaceKHR(createInfo);
#elif defined BIGFOOT_LINUX
const vk::XlibSurfaceCreateInfoKHR createInfo {{}, p_surfaceCreateInfo.m_display, p_surfaceCreateInfo.m_window};
const vk::ResultValue<vk::SurfaceKHR> surface = m_instance.GetHandle().createXlibSurfaceKHR(createInfo);
#endif
CRITICAL_ASSERT(GraphicsVulkanAssertHandler,
surface.result == vk::Result::eSuccess,
"({}) Failed to create Vulkan surface",
surface.result);
m_surface = surface.value;
}
/****************************************************************************************/
VulkanSurface::~VulkanSurface()
{
m_instance.GetHandle().destroySurfaceKHR(m_surface);
}
/****************************************************************************************/
vk::SurfaceKHR VulkanSurface::GetHandle() const
{
return m_surface;
}
} // namespace Bigfoot::Vulkan
@@ -0,0 +1,68 @@
/*********************************************************************
* \file VulkanFormatters.cpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#include <GraphicsVulkan/VulkanFormatters.hpp>
#include <Utils/Log/LogMacros.hpp>
#include <Utils/Singleton.hpp>
#include <GraphicsVulkan/GraphicsVulkanLogger_generated.hpp>
#include <fmt/format.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <fstream>
#include <sstream>
#include <string>
namespace Bigfoot::Vulkan
{
class VulkanFormattersFixture: public ::testing::Test
{
protected:
};
/****************************************************************************************/
TEST_F(VulkanFormattersFixture, FormatsASuccessResultAsItsToString)
{
EXPECT_EQ(fmt::format("{}", vk::Result::eSuccess), vk::to_string(vk::Result::eSuccess));
}
/****************************************************************************************/
TEST_F(VulkanFormattersFixture, FormatsAnErrorResultAsItsToString)
{
EXPECT_EQ(fmt::format("{}", vk::Result::eErrorDeviceLost), vk::to_string(vk::Result::eErrorDeviceLost));
}
/****************************************************************************************/
#ifdef BIGFOOT_NOT_OPTIMIZED
class VulkanFormattersLogFixture: public ::testing::Test
{
protected:
static std::string ReadFileSinkContent()
{
Singleton<Log>::GetInstance().Flush();
std::ifstream file {std::string {Log::FILE_SINK_PATH.data()}};
std::stringstream buffer;
buffer << file.rdbuf();
return buffer.str();
}
};
/****************************************************************************************/
TEST_F(VulkanFormattersLogFixture, LogsAResultArgumentAsItsToString)
{
BIGFOOT_LOG_INFO(GRAPHICSVULKAN_LOGGER, "{}", vk::Result::eErrorOutOfHostMemory);
EXPECT_THAT(ReadFileSinkContent(), ::testing::HasSubstr(vk::to_string(vk::Result::eErrorOutOfHostMemory)));
}
#endif
} // namespace Bigfoot::Vulkan
@@ -0,0 +1,26 @@
/*********************************************************************
* \file VulkanInstance.cpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#include <GraphicsVulkan/VulkanInstance.hpp>
#include <gtest/gtest.h>
namespace Bigfoot::Vulkan
{
class VulkanInstanceFixture: public ::testing::Test
{
protected:
};
/****************************************************************************************/
TEST_F(VulkanInstanceFixture, Constructor_ShouldCreateAValidInstance)
{
const VulkanInstance instance {"VulkanInstanceTests", Version {1, 0, 0}};
EXPECT_TRUE(instance.GetHandle());
}
} // namespace Bigfoot::Vulkan
@@ -0,0 +1,66 @@
/*********************************************************************
* \file VulkanSurface.cpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#include <GraphicsVulkan/VulkanSurface.hpp>
#include <GraphicsVulkan/VulkanInstance.hpp>
#include <Utils/TargetMacros.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#ifdef BIGFOOT_WINDOWS
#define GLFW_EXPOSE_NATIVE_WIN32
#elif defined BIGFOOT_LINUX
#define GLFW_EXPOSE_NATIVE_X11
#endif
#include <GLFW/glfw3native.h>
#include <gtest/gtest.h>
namespace Bigfoot::Vulkan
{
class VulkanSurfaceFixture: public ::testing::Test
{
protected:
void SetUp() override
{
ASSERT_EQ(glfwInit(), GLFW_TRUE);
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
m_window = glfwCreateWindow(64, 64, "VulkanSurfaceTests", nullptr, nullptr);
ASSERT_NE(m_window, nullptr);
#ifdef BIGFOOT_WINDOWS
m_surfaceCreateInfo.m_windowHandle = glfwGetWin32Window(m_window);
m_surfaceCreateInfo.m_windowInstance = GetModuleHandle(nullptr);
#elif defined BIGFOOT_LINUX
m_surfaceCreateInfo.m_display = glfwGetX11Display();
m_surfaceCreateInfo.m_window = glfwGetX11Window(m_window);
#endif
}
void TearDown() override
{
glfwDestroyWindow(m_window);
glfwTerminate();
}
VulkanInstance m_instance {"VulkanSurfaceTests", Version {1, 0, 0}};
GLFWwindow* m_window = nullptr;
SurfaceCreateInfo m_surfaceCreateInfo;
};
/****************************************************************************************/
TEST_F(VulkanSurfaceFixture, Constructor_ShouldCreateAValidSurface)
{
const VulkanSurface surface {m_instance, m_surfaceCreateInfo};
EXPECT_TRUE(surface.GetHandle());
}
} // namespace Bigfoot::Vulkan
+1 -1
View File
@@ -68,7 +68,7 @@ class Bigfoot(ConanFile):
self.requires("eastl/3.27.01@bigfootdev/main", transitive_headers=True)
self.requires("eastdc/25082026@bigfootdev/main", transitive_headers=True)
self.requires("unordered_dense/4.9.2", transitive_headers=True)
self.requires("mimalloc/3.3.2", transitive_headers=True)
self.requires("mimalloc/3.5.1@bigfootdev/main", transitive_headers=True)
self.requires("stduuid/1.2.3@bigfootdev/main", transitive_headers=True)
self.requires("sqlite3/3.53.3@bigfootdev/main", transitive_headers=True)
self.requires("rapidhash/3.0@bigfootdev/main", transitive_headers=True)