Compare commits
1 Commits
v2
...
feb438a3e6
| Author | SHA1 | Date | |
|---|---|---|---|
|
feb438a3e6
|
@@ -28,8 +28,6 @@ set(NOVA_LIBRARY_INSTALL OFF CACHE BOOL "Enable library installation targets")
|
|||||||
set(NOVA_BACKEND_VULKAN ON CACHE BOOL "Enable Vulkan backend")
|
set(NOVA_BACKEND_VULKAN ON CACHE BOOL "Enable Vulkan backend")
|
||||||
# set(NOVA_BACKEND_WEBGPU ON CACHE BOOL "Enable WebGPU backend")
|
# set(NOVA_BACKEND_WEBGPU ON CACHE BOOL "Enable WebGPU backend")
|
||||||
|
|
||||||
set(NOVA_USE_VOLK ON CACHE BOOL "Use volk for Vulkan function loading")
|
|
||||||
|
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
NOVA_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
|
NOVA_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
|
||||||
NOVA_VERSION_MINOR=${PROJECT_VERSION_MINOR}
|
NOVA_VERSION_MINOR=${PROJECT_VERSION_MINOR}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
# Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
# Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
set(NOVA_ENGINE_SRC
|
set(NOVA_ENGINE_SRC
|
||||||
core/debug.cpp
|
core/debug.cpp
|
||||||
graphics/context.cpp
|
graphics/context.cpp
|
||||||
@@ -33,21 +31,7 @@ if (NOVA_BACKEND_VULKAN)
|
|||||||
target_sources(nova PRIVATE ${NOVA_VULKAN_SRC})
|
target_sources(nova PRIVATE ${NOVA_VULKAN_SRC})
|
||||||
target_compile_definitions(nova PRIVATE NOVA_BACKEND_VULKAN)
|
target_compile_definitions(nova PRIVATE NOVA_BACKEND_VULKAN)
|
||||||
target_include_directories(nova PRIVATE ${Vulkan_INCLUDE_DIRS})
|
target_include_directories(nova PRIVATE ${Vulkan_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(nova PRIVATE Vulkan::Vulkan)
|
||||||
if (NOVA_USE_VOLK)
|
|
||||||
FetchContent_Declare(
|
|
||||||
volk
|
|
||||||
GIT_REPOSITORY https://github.com/zeux/volk.git
|
|
||||||
GIT_TAG f30088b3f4160810b53e19258dd2f7395e5f0ba3 # 1.4.328.1
|
|
||||||
)
|
|
||||||
FetchContent_MakeAvailable(volk)
|
|
||||||
|
|
||||||
target_compile_definitions(nova PRIVATE NOVA_USE_VOLK)
|
|
||||||
target_include_directories(nova PRIVATE ${volk_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(nova PRIVATE volk::volk)
|
|
||||||
else()
|
|
||||||
target_link_libraries(nova PRIVATE Vulkan::Vulkan)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(nova PROPERTIES
|
set_target_properties(nova PROPERTIES
|
||||||
|
|||||||
@@ -4,10 +4,6 @@
|
|||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(NOVA_USE_VOLK)
|
|
||||||
#include <volk.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
@@ -17,14 +13,6 @@
|
|||||||
|
|
||||||
namespace nova::gfx {
|
namespace nova::gfx {
|
||||||
|
|
||||||
VulkanContext::VulkanContext() {
|
|
||||||
#if defined(NOVA_USE_VOLK)
|
|
||||||
if (volkInitialize() != VK_SUCCESS) {
|
|
||||||
throw std::runtime_error("Failed to initialize volk");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
API VulkanContext::get_api() const {
|
API VulkanContext::get_api() const {
|
||||||
return API::VULKAN;
|
return API::VULKAN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,10 @@
|
|||||||
|
|
||||||
#include <nova/graphics/context.hpp>
|
#include <nova/graphics/context.hpp>
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
|
|
||||||
namespace nova::gfx {
|
namespace nova::gfx {
|
||||||
|
|
||||||
class VulkanContext final : public IContext {
|
class VulkanContext final : public IContext {
|
||||||
public:
|
public:
|
||||||
VulkanContext();
|
|
||||||
|
|
||||||
API get_api() const override;
|
API get_api() const override;
|
||||||
std::string get_api_name() const override;
|
std::string get_api_name() const override;
|
||||||
|
|
||||||
@@ -23,9 +19,6 @@ class VulkanContext final : public IContext {
|
|||||||
std::string get_api_version_string() const override;
|
std::string get_api_version_string() const override;
|
||||||
|
|
||||||
std::unique_ptr<IDevice> create_device() override;
|
std::unique_ptr<IDevice> create_device() override;
|
||||||
|
|
||||||
private:
|
|
||||||
VkInstance m_instance = VK_NULL_HANDLE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nova::gfx
|
} // namespace nova::gfx
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#if defined(NOVA_BACKEND_VULKAN)
|
#include "backends/vulkan/context.hpp"
|
||||||
#include "backends/vulkan/context.hpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace nova::gfx {
|
namespace nova::gfx {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user