Bigfoot / Sonarqube (game) (push) Skipped
Bigfoot / Sonarqube (toolmode) (push) Skipped
Bigfoot / Build & Test Debug with clang_asan (Unity Build: OFF, Variant: game) (push) Failing after 2m13s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 2m16s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 1m52s
Bigfoot / Build & Test Debug with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m3s
Bigfoot / Build & Test Debug with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m10s
Bigfoot / Build & Test Debug with clang (Unity Build: ON, Variant: game) (push) Successful in 40s
Bigfoot / Build & Test Debug with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 45s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: ON, Variant: game) (push) Failing after 1m42s
Bigfoot / Build & Test Release with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m3s
Bigfoot / Build & Test Release with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m25s
Bigfoot / Build & Test Release with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 1m47s
Bigfoot / Build & Test Release with clang (Unity Build: ON, Variant: game) (push) Successful in 50s
Bigfoot / Build & Test Release with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 1m10s
Bigfoot / Build & Test Release with clang_asan (Unity Build: OFF, Variant: game) (push) Failing after 1m41s
Bigfoot / Build & Test Release with clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 1m36s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m13s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 49s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 2m18s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: ON, Variant: game) (push) Failing after 1m42s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 1m50s
Bigfoot / Build & Test Release with clang_asan (Unity Build: ON, Variant: game) (push) Failing after 1m30s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m15s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: ON, Variant: game) (push) Successful in 48s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: OFF, Variant: game) (push) Failing after 2m20s
Bigfoot / Clang Format Checks (push) Successful in 10s
83 lines
2.9 KiB
C++
83 lines
2.9 KiB
C++
/*********************************************************************
|
|
* \file VulkanDevice.cpp
|
|
*
|
|
* \author Romain BOULLARD
|
|
* \date September 2026
|
|
*********************************************************************/
|
|
#include <GraphicsVulkan/VulkanDevice.hpp>
|
|
|
|
#include <GraphicsVulkan/VulkanInstance.hpp>
|
|
#include <GraphicsVulkan/VulkanSurface.hpp>
|
|
|
|
#include <Utils/TargetMacros.h>
|
|
|
|
#include <SDL3/SDL.h>
|
|
#include <gtest/gtest.h>
|
|
|
|
namespace Bigfoot::Vulkan
|
|
{
|
|
class VulkanDeviceFixture: public ::testing::Test
|
|
{
|
|
protected:
|
|
void SetUp() override
|
|
{
|
|
SDL_Init(SDL_INIT_VIDEO);
|
|
|
|
m_window = SDL_CreateWindow("VulkanDeviceTests", 64, 64, SDL_WINDOW_HIDDEN | SDL_WINDOW_VULKAN);
|
|
|
|
const SDL_PropertiesID windowProperties = SDL_GetWindowProperties(m_window);
|
|
|
|
#ifdef BIGFOOT_WINDOWS
|
|
m_surfaceCreateInfo.m_windowHandle = static_cast<HWND>(
|
|
SDL_GetPointerProperty(windowProperties, SDL_PROP_WINDOW_WIN32_HWND_POINTER, nullptr));
|
|
m_surfaceCreateInfo.m_windowInstance = GetModuleHandle(nullptr);
|
|
#elif defined BIGFOOT_LINUX
|
|
m_surfaceCreateInfo.m_display = static_cast<wl_display*>(
|
|
SDL_GetPointerProperty(windowProperties, SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER, nullptr));
|
|
m_surfaceCreateInfo.m_surface = static_cast<wl_surface*>(
|
|
SDL_GetPointerProperty(windowProperties, SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, nullptr));
|
|
#endif
|
|
}
|
|
|
|
void TearDown() override
|
|
{
|
|
SDL_DestroyWindow(m_window);
|
|
SDL_Quit();
|
|
}
|
|
|
|
VulkanInstance m_instance {"VulkanDeviceTests", Version {1, 0, 0}};
|
|
SDL_Window* m_window = nullptr;
|
|
SurfaceCreateInfo m_surfaceCreateInfo;
|
|
};
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(VulkanDeviceFixture, WithoutSurface_ShouldCreateAValidDeviceWithoutAPresentQueue)
|
|
{
|
|
const VulkanDevice device {m_instance, nullptr, {}};
|
|
|
|
EXPECT_TRUE(device.GetPhysicalDeviceHandle());
|
|
EXPECT_TRUE(device.GetHandle());
|
|
EXPECT_NE(device.GetQueue(GraphicsQueueType::Graphics), nullptr);
|
|
EXPECT_NE(device.GetQueue(GraphicsQueueType::Compute), nullptr);
|
|
EXPECT_NE(device.GetQueue(GraphicsQueueType::Transfer), nullptr);
|
|
EXPECT_EQ(device.GetQueue(GraphicsQueueType::Present), nullptr);
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(VulkanDeviceFixture, WithSurface_ShouldCreateAValidDeviceWithAPresentQueue)
|
|
{
|
|
const VulkanSurface surface {m_instance, m_surfaceCreateInfo};
|
|
|
|
const VulkanDevice device {m_instance, &surface, {}};
|
|
|
|
EXPECT_TRUE(device.GetPhysicalDeviceHandle());
|
|
EXPECT_TRUE(device.GetHandle());
|
|
EXPECT_NE(device.GetQueue(GraphicsQueueType::Graphics), nullptr);
|
|
EXPECT_NE(device.GetQueue(GraphicsQueueType::Compute), nullptr);
|
|
EXPECT_NE(device.GetQueue(GraphicsQueueType::Transfer), nullptr);
|
|
EXPECT_NE(device.GetQueue(GraphicsQueueType::Present), nullptr);
|
|
}
|
|
} // namespace Bigfoot::Vulkan
|