update
This commit is contained in:
5
.gitmodules
vendored
5
.gitmodules
vendored
@@ -39,4 +39,7 @@
|
||||
url = https://github.com/shader-slang/slang.git
|
||||
[submodule "dependencies/libFGL"]
|
||||
path = dependencies/libFGL
|
||||
url = git@github.com:KJNeko/libFGL.git
|
||||
url = git@github.com:KJNeko/libFGL.git
|
||||
[submodule "dependencies/gtest"]
|
||||
path = dependencies/gtest
|
||||
url = https://github.com/google/googletest.git
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.25.0)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 26)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
project(TitorGameEngine LANGUAGES CXX C)
|
||||
|
||||
@@ -14,7 +13,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
|
||||
message("-- CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_BUILD_TYPE)
|
||||
|
||||
add_subdirectory(dependencies/vma)
|
||||
include(dependencies/glfw)
|
||||
include(dependencies/glm)
|
||||
include(cmake_modules/dependencies/tracy.cmake)
|
||||
|
||||
@@ -3,4 +3,38 @@ if (NOT Vulkan_FOUND)
|
||||
error("Vulkan not found")
|
||||
endif ()
|
||||
|
||||
#add_library(VulkanCppModule)
|
||||
#add_library(Vulkan::cppm ALIAS VulkanCppModule)
|
||||
#
|
||||
#target_compile_definitions(VulkanCppModule PUBLIC
|
||||
# VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1
|
||||
# VULKAN_HPP_NO_STRUCT_CONSTRUCTORS=1
|
||||
# VULKAN_HPP_NO_STD_MODULE=1
|
||||
#)
|
||||
#
|
||||
#target_include_directories(VulkanCppModule PRIVATE "${Vulkan_INCLUDE_DIR}")
|
||||
#
|
||||
#target_link_libraries(VulkanCppModule PUBLIC Vulkan::Vulkan)
|
||||
#
|
||||
#target_sources(VulkanCppModule
|
||||
# PUBLIC
|
||||
# FILE_SET cxx_modules TYPE CXX_MODULES
|
||||
# BASE_DIRS "${Vulkan_INCLUDE_DIR}"
|
||||
# FILES "${Vulkan_INCLUDE_DIR}/vulkan/vulkan.cppm"
|
||||
#)
|
||||
#
|
||||
#if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.28" AND VULKAN_HEADERS_ENABLE_MODULE AND COMPILER_SUPPORTS_CXX_MODULES)
|
||||
# add_library(Vulkan-Module)
|
||||
# add_library(Vulkan::VulkanHppModule ALIAS Vulkan-Module)
|
||||
# target_sources(Vulkan-Module
|
||||
# PUBLIC
|
||||
# FILE_SET module
|
||||
# TYPE CXX_MODULES
|
||||
# BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
# FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/vulkan/vulkan.cppm"
|
||||
# )
|
||||
# target_compile_features(Vulkan-Module PUBLIC cxx_std_20)
|
||||
# target_link_libraries(Vulkan-Module PUBLIC Vulkan-Headers)
|
||||
#endif ()
|
||||
|
||||
message("Vulkan include: ${Vulkan_INCLUDE_DIR}")
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
add_subdirectory(vma)
|
||||
add_subdirectory(engine)
|
||||
add_subdirectory(renderer)
|
||||
add_subdirectory(objectloaders)
|
||||
add_subdirectory(editor)
|
||||
#add_subdirectory(editor)
|
||||
#add_subdirectory(engine)
|
||||
|
||||
message("-- Creating SYMLINK ${CMAKE_BINARY_DIR}/shaders -> ${CMAKE_CURRENT_SOURCE_DIR}/shaders")
|
||||
file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/shaders ${CMAKE_BINARY_DIR}/bin/shaders SYMBOLIC)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
include(dependencies/imgui)
|
||||
|
||||
target_compile_definitions(FGLEngine PUBLIC VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC)
|
||||
|
||||
file(GLOB_RECURSE SOURCE_FILES
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "engine/debug/timing/FlameGraph.hpp"
|
||||
#include "engine/flags.hpp"
|
||||
#include "engine/math/literals/size.hpp"
|
||||
#include "engine/memory/buffers/BufferHandle.hpp"
|
||||
#include "engine/memory/buffers/VulkanBuffer.hpp"
|
||||
#include "safe_include.hpp"
|
||||
|
||||
namespace fgl::engine::gui
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Created by kj16609 on 6/5/24.
|
||||
//
|
||||
|
||||
|
||||
// ReSharper disable CppDFAInfiniteRecursion
|
||||
// ReSharper disable CppInconsistentNaming
|
||||
// ReSharper disable CppZeroConstantCanBeReplacedWithNullptr
|
||||
@@ -12,8 +13,6 @@
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
// clang-format off
|
||||
#include <imgui.h>
|
||||
#include <imgui/misc/cpp/imgui_stdlib.h>
|
||||
// clang-format on
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
|
||||
@@ -11,24 +11,13 @@ target_compile_definitions(FGLEngine PUBLIC VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC
|
||||
target_link_libraries(FGLEngine PUBLIC stdc++exp)
|
||||
|
||||
include(dependencies/spdlog)
|
||||
include(dependencies/imgui)
|
||||
|
||||
target_link_libraries(FGLEngine PUBLIC Vulkan::Vulkan ImGui FGLLoader spdlog slang glm)
|
||||
target_include_directories(FGLEngine SYSTEM PUBLIC ${GLM_INCLUDE_DIRS})
|
||||
target_link_libraries(FGLEngine PUBLIC glfw Tracy::TracyClient VMA)
|
||||
target_link_libraries(FGLEngine PUBLIC glfw Tracy::TracyClient)
|
||||
target_include_directories(FGLEngine PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
target_compile_features(FGLEngine PUBLIC cxx_std_23)
|
||||
|
||||
target_precompile_headers(FGLEngine PUBLIC
|
||||
<spdlog/spdlog.h>
|
||||
|
||||
<glm/vec4.hpp>
|
||||
<glm/vec3.hpp>
|
||||
<glm/vec2.hpp>
|
||||
|
||||
<imgui.h>
|
||||
)
|
||||
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_UPPER_BUILD_TYPE)
|
||||
|
||||
if (NOT DEFINED FGL_ENABLE_IMGUI AND CMAKE_UPPER_BUILD_TYPE STREQUAL "DEBUG")
|
||||
@@ -37,15 +26,6 @@ endif ()
|
||||
|
||||
message("-- FGL_ENABLE_IMGUI: ${FGL_ENABLE_IMGUI}")
|
||||
|
||||
|
||||
if (FGL_ENABLE_IMGUI)
|
||||
target_compile_definitions(FGLEngine PUBLIC ENABLE_IMGUI=1)
|
||||
target_compile_definitions(FGLEngine PUBLIC ENABLE_IMGUI_DRAWERS=1)
|
||||
else ()
|
||||
target_compile_definitions(FGLEngine PUBLIC ENABLE_IMGUI=0)
|
||||
target_compile_definitions(FGLEngine PUBLIC ENABLE_IMGUI_DRAWERS=0)
|
||||
endif ()
|
||||
|
||||
if (DEFINED FGL_ENABLE_TESTS AND FGL_ENABLE_TESTS)
|
||||
target_compile_definitions(FGLEngine PUBLIC FGL_TESTS=1)
|
||||
target_compile_definitions(FGLEngine PUBLIC FGL_ENABLE_TEST_ASSERT=1)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "engine/flags.hpp"
|
||||
#include "engine/math/Average.hpp"
|
||||
#include "engine/math/literals/size.hpp"
|
||||
#include "memory/buffers/BufferHandle.hpp"
|
||||
#include "memory/buffers/VulkanBuffer.hpp"
|
||||
#include "systems/RenderGraph.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
//
|
||||
// Created by kj16609 on 3/1/24.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#define FGL_DELETE_DEFAULT_CTOR( ClassName ) ClassName() = delete
|
||||
#define FGL_DELETE_COPY_ASSIGN( ClassName ) ClassName& operator=( const ClassName& ) = delete
|
||||
#define FGL_DELETE_COPY_CTOR( ClassName ) ClassName( const ClassName& ) = delete
|
||||
#define FGL_DELETE_MOVE_ASSIGN( ClassName ) ClassName& operator=( ClassName&& ) = delete
|
||||
#define FGL_DELETE_MOVE_CTOR( ClassName ) ClassName( ClassName&& ) = delete
|
||||
#define FGL_DELETE_COPY( ClassName ) \
|
||||
FGL_DELETE_COPY_CTOR( ClassName ); \
|
||||
FGL_DELETE_COPY_ASSIGN( ClassName )
|
||||
#define FGL_DELETE_MOVE( ClassName ) \
|
||||
FGL_DELETE_MOVE_CTOR( ClassName ); \
|
||||
FGL_DELETE_MOVE_ASSIGN( ClassName )
|
||||
#define FGL_DELETE_ALL_RO5( ClassName ) \
|
||||
FGL_DELETE_DEFAULT_CTOR( ClassName ); \
|
||||
FGL_DELETE_COPY( ClassName ); \
|
||||
FGL_DELETE_MOVE( ClassName )
|
||||
|
||||
#define FGL_DEFAULT_DEFAULT_CTOR( ClassName ) ClassName() = default
|
||||
#define FGL_DEFAULT_COPY_ASSIGN( ClassName ) ClassName& operator=( const ClassName& ) = default
|
||||
#define FGL_DEFAULT_COPY_CTOR( ClassName ) [[nodiscard]] ClassName( const ClassName& ) = default
|
||||
#define FGL_DEFAULT_MOVE_ASSIGN( ClassName ) ClassName& operator=( ClassName&& ) = default
|
||||
#define FGL_DEFAULT_MOVE_CTOR( ClassName ) [[nodiscard]] ClassName( ClassName&& ) = default
|
||||
#define FGL_DEFAULT_COPY( ClassName ) \
|
||||
FGL_DEFAULT_COPY_CTOR( ClassName ); \
|
||||
FGL_DEFAULT_COPY_ASSIGN( ClassName )
|
||||
#define FGL_DEFAULT_MOVE( ClassName ) \
|
||||
FGL_DEFAULT_MOVE_CTOR( ClassName ); \
|
||||
FGL_DEFAULT_MOVE_ASSIGN( ClassName )
|
||||
#define FGL_DEFAULT_ALL_RO5( ClassName ) \
|
||||
FGL_DEFAULT_DEFAULT_CTOR( ClassName ); \
|
||||
FGL_DEFAULT_COPY( ClassName ); \
|
||||
FGL_DEFAULT_MOVE( ClassName )
|
||||
|
||||
#define FGL_PACKED __attribute__( ( packed ) )
|
||||
#define FGL_PACKED_ALIGNED( al ) __attribute__( ( packed, aligned( al ) ) )
|
||||
#define FGL_FLATTEN [[gnu::flatten]]
|
||||
#define FGL_ARTIFICIAL [[gnu::artificial]]
|
||||
#define FGL_HOT [[gnu::hot]]
|
||||
#define FGL_COLD [[gnu::cold]]
|
||||
#define FGL_FLATTEN_HOT FGL_FLATTEN FGL_HOT
|
||||
#define FGL_FORCE_INLINE [[gnu::always_inline]]
|
||||
#define FGL_FORCE_INLINE_FLATTEN FGL_FLATTEN FGL_FORCE_INLINE
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define FGL_ASSUME( ... ) \
|
||||
FGL_ASSERT( ( __VA_ARGS__ ), "FGL_ASSUME: Check failed!" ); \
|
||||
[[gnu::assume( __VA_ARGS__ )]];
|
||||
#else
|
||||
#define FGL_ASSUME( ... ) [[gnu::assume( __VA_ARGS__ )]]
|
||||
#endif
|
||||
|
||||
#define FGL_ALIGN( bytesize ) [[gnu::alligned( bitsize )]]
|
||||
|
||||
#define FGL_FUNC_CLEANUP( func ) [[gnu::cleanup( func )]]
|
||||
|
||||
//! Warns if the variable is used as a string (strlen)
|
||||
#define FGL_NONSTRING_DATA [[gnu::nonstring]]
|
||||
|
||||
//! Warns if the structure field is not alligned with a set number of bytes
|
||||
#define FGL_STRICT_ALIGNMENT( bytesize ) [[gnu::warn_if_not_aligned( bytesize )]]
|
||||
|
||||
#ifndef NDEBUG
|
||||
#include <format>
|
||||
#include <stdexcept>
|
||||
#pragma GCC diagnostic push
|
||||
// Placed here to prevent strict warnings from preventing compilation, This is intentional.
|
||||
#pragma GCC diagnostic ignored "-Wterminate"
|
||||
#define FGL_ASSERT( test, msg ) \
|
||||
if ( !( test ) ) \
|
||||
throw std::runtime_error( std::format( "{}:{}:{}: {}", __FILE__, __LINE__, __PRETTY_FUNCTION__, msg ) );
|
||||
#pragma GCC diagnostic pop
|
||||
#else
|
||||
#define FGL_ASSERT( test, msg )
|
||||
#endif
|
||||
|
||||
#define FGL_UNIMPLEMENTED() FGL_ASSERT( false, "unimplemented" );
|
||||
|
||||
#ifndef NDEBUG
|
||||
#include <utility>
|
||||
#define FGL_UNREACHABLE() \
|
||||
FGL_ASSERT( false, "Should have been unreachable!" ); \
|
||||
std::unreachable()
|
||||
#else
|
||||
#define FGL_UNREACHABLE() std::unreachable()
|
||||
#endif
|
||||
|
||||
#define FGL_NOTNAN( value ) FGL_ASSERT( !std::isnan( value ), "Value is NaN!" )
|
||||
#define FGL_NOTNANVEC3( vec3 ) \
|
||||
FGL_ASSERT( !std::isnan( ( vec3 ).x ), "X value was NaN!" ); \
|
||||
FGL_ASSERT( !std::isnan( ( vec3 ).y ), "Y value was NaN!" ); \
|
||||
FGL_ASSERT( !std::isnan( ( vec3 ).z ), "Z value was NaN!" )
|
||||
|
||||
#define FGL_TODO() throw std::runtime_error( std::format( "TODO: {}:{}:{}", __FILE__, __LINE__, __PRETTY_FUNCTION__ ) );
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
class RenderGraph;
|
||||
class CameraViewpoint;
|
||||
struct PrimitiveRenderInfo;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <tracy/Tracy.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace fgl::engine
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "engine/debug/logging/logging.hpp"
|
||||
#include "engine/math/literals/size.hpp"
|
||||
#include "material/Material.hpp"
|
||||
#include "memory/buffers/BufferHandle.hpp"
|
||||
#include "memory/buffers/VulkanBuffer.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "engine/memory/buffers/BufferHandle.hpp"
|
||||
#include "engine/memory/buffers/VulkanBuffer.hpp"
|
||||
#include "material/Material.hpp"
|
||||
#include "memory/buffers/vector/DeviceVector.hpp"
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "engine/debug/logging/logging.hpp"
|
||||
#include "engine/rendering/devices/Device.hpp"
|
||||
#include "vma/vma_impl.hpp"
|
||||
#include "memory/vma_impl.hpp"
|
||||
#include "vulkan/vulkan.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
|
||||
@@ -15,14 +15,14 @@ namespace fgl::engine
|
||||
|
||||
inline static IDPool< MaterialID > material_id_counter { 1 };
|
||||
|
||||
TextureID getTexID( const std::shared_ptr< Texture >& tex )
|
||||
{
|
||||
if ( tex ) return tex->getID();
|
||||
return constants::INVALID_TEXTURE_ID;
|
||||
}
|
||||
|
||||
void MaterialProperties::writeData( DeviceMaterialData& data ) const
|
||||
{
|
||||
auto getTexID = []( const std::shared_ptr< Texture >& tex )
|
||||
{
|
||||
if ( tex ) return tex->getID();
|
||||
return constants::INVALID_TEXTURE_ID;
|
||||
};
|
||||
|
||||
// PBR
|
||||
data.color.color_texture_id = getTexID( m_pbr.m_color_tex );
|
||||
data.color.color_factors = m_pbr.m_color_factors;
|
||||
|
||||
@@ -32,13 +32,15 @@ namespace fgl::engine
|
||||
|
||||
namespace memory
|
||||
{
|
||||
class BufferHandle;
|
||||
class VulkanBuffer;
|
||||
}
|
||||
|
||||
struct ModelBuilder;
|
||||
|
||||
ModelGPUBuffers& getModelBuffers();
|
||||
|
||||
|
||||
|
||||
// Primitive render info, Contains the vertex and index info
|
||||
constexpr descriptors::Descriptor RENDER_INFO_DESCRIPTOR { 0,
|
||||
vk::DescriptorType::eStorageBuffer,
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <glm/gtx/hash.hpp>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include <meta>
|
||||
|
||||
#include "Model.hpp"
|
||||
#include "ModelInstance.hpp"
|
||||
#include "VertexAttribute.hpp"
|
||||
@@ -39,24 +41,23 @@ namespace fgl::engine
|
||||
{
|
||||
AttributeBuilder builder { SimpleVertex::getAttributeDescriptions() };
|
||||
|
||||
#pragma GCC diagnostic push // TODO: Fix with reflection once we get it in 20 years
|
||||
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||
// builder.add< decltype( ModelVertex::m_position ), offsetof( ModelVertex, m_position ) >( 0 );
|
||||
// builder.add< decltype( ModelVertex::m_color ), offsetof( ModelVertex, m_color ) >( 0 );
|
||||
builder.add< decltype( ModelVertex::m_normal ), offsetof( ModelVertex, m_normal ) >( 0 );
|
||||
builder.add< decltype( ModelVertex::m_tangent ), offsetof( ModelVertex, m_tangent ) >( 0 );
|
||||
builder.add< decltype( ModelVertex::m_uv ), offsetof( ModelVertex, m_uv ) >( 0 );
|
||||
#pragma GCC diagnostic pop
|
||||
builder.add< decltype( ModelVertex::m_normal ), std::meta::offset_of( ^^ModelVertex::m_normal ).bytes >( 0 );
|
||||
builder.add< decltype( ModelVertex::m_tangent ), std::meta::offset_of( ^^ModelVertex::m_tangent ).bytes >( 0 );
|
||||
builder.add< decltype( ModelVertex::m_uv ), std::meta::offset_of( ^^ModelVertex::m_uv ).bytes >( 0 );
|
||||
|
||||
builder
|
||||
.add< decltype( InstanceRenderInfo::m_model_matrix ), offsetof( InstanceRenderInfo, m_model_matrix ) >( 1 );
|
||||
builder.add<
|
||||
decltype( InstanceRenderInfo::m_model_matrix ),
|
||||
std::meta::offset_of( ^^InstanceRenderInfo::m_model_matrix ).bytes >( 1 );
|
||||
|
||||
// builder.add<
|
||||
// decltype( InstanceRenderInfo::m_normal_matrix ),
|
||||
// offsetof( InstanceRenderInfo, m_normal_matrix ) >( 1 );
|
||||
|
||||
builder
|
||||
.add< decltype( InstanceRenderInfo::m_material_id ), offsetof( InstanceRenderInfo, m_material_id ) >( 1 );
|
||||
builder.add<
|
||||
decltype( InstanceRenderInfo::m_material_id ),
|
||||
std::meta::offset_of( ^^InstanceRenderInfo::m_material_id ).bytes >( 1 );
|
||||
|
||||
return builder.get();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "SimpleVertex.hpp"
|
||||
|
||||
#include <meta>
|
||||
#include <vector>
|
||||
|
||||
#include "ModelVertex.hpp"
|
||||
@@ -28,8 +29,9 @@ namespace fgl::engine
|
||||
{
|
||||
AttributeBuilder builder {};
|
||||
|
||||
builder.add< decltype( SimpleVertex::m_position ), offsetof( SimpleVertex, m_position ) >( 0 );
|
||||
builder.add< decltype( SimpleVertex::m_color ), offsetof( SimpleVertex, m_color ) >( 0 );
|
||||
builder
|
||||
.add< decltype( SimpleVertex::m_position ), std::meta::offset_of( ^^SimpleVertex::m_position ).bytes >( 0 );
|
||||
builder.add< decltype( SimpleVertex::m_color ), std::meta::offset_of( ^^SimpleVertex::m_color ).bytes >( 0 );
|
||||
|
||||
return builder.get();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace fgl::engine
|
||||
{
|
||||
return vk::Format::eR32G32B32Sfloat;
|
||||
}
|
||||
else if constexpr ( std::same_as< T, glm::vec4 > || std ::same_as< T, glm::mat4 > )
|
||||
else if constexpr ( std::same_as< T, glm::vec4 > || std::same_as< T, glm::mat4 > )
|
||||
{
|
||||
return vk::Format::eR32G32B32A32Sfloat;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "engine/primitives/Transform.hpp"
|
||||
#include "memory/buffers/BufferHandle.hpp"
|
||||
#include "memory/buffers/VulkanBuffer.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace fgl::engine
|
||||
|
||||
namespace memory
|
||||
{
|
||||
class BufferHandle;
|
||||
class VulkanBuffer;
|
||||
}
|
||||
|
||||
} // namespace fgl::engine
|
||||
|
||||
@@ -136,9 +136,7 @@ namespace fgl::engine
|
||||
memory::TransferManager::getInstance()
|
||||
.copyToImage( std::forward< std::vector< std::byte > >( data ), *m_image );
|
||||
|
||||
#if ENABLE_IMGUI
|
||||
createImGuiSet();
|
||||
#endif
|
||||
}
|
||||
|
||||
Texture::Texture( const std::filesystem::path& path, Sampler&& sampler, const vk::Format format ) :
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "engine/constants.hpp"
|
||||
#include "engine/types.hpp"
|
||||
|
||||
struct ImTextureRef;
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
class Sampler;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "engine/assets/image/ImageHandle.hpp"
|
||||
#include "engine/debug/logging/logging.hpp"
|
||||
#include "engine/memory/buffers/BufferHandle.hpp"
|
||||
#include "engine/memory/buffers/VulkanBuffer.hpp"
|
||||
#include "engine/memory/buffers/exceptions.hpp"
|
||||
#include "engine/memory/buffers/vector/HostVector.hpp"
|
||||
#include "engine/utils.hpp"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "engine/memory/buffers/BufferHandle.hpp"
|
||||
#include "engine/memory/buffers/VulkanBuffer.hpp"
|
||||
|
||||
namespace vk
|
||||
{
|
||||
@@ -29,7 +29,7 @@ namespace fgl::engine
|
||||
namespace memory
|
||||
{
|
||||
class BufferSuballocationHandle;
|
||||
class BufferHandle;
|
||||
class VulkanBuffer;
|
||||
} // namespace memory
|
||||
} // namespace fgl::engine
|
||||
|
||||
|
||||
@@ -8,18 +8,10 @@
|
||||
#include "engine/assets/image/ImageHandle.hpp"
|
||||
#include "engine/assets/texture/Texture.hpp"
|
||||
#include "engine/math/literals/size.hpp"
|
||||
#include "engine/memory/buffers/BufferHandle.hpp"
|
||||
#include "engine/memory/buffers/BufferSuballocation.hpp"
|
||||
#include "engine/memory/buffers/VulkanBuffer.hpp"
|
||||
#include "engine/memory/buffers/vector/HostVector.hpp"
|
||||
|
||||
#ifdef ENABLE_IMGUI
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
#include <imgui.h>
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
namespace fgl::engine::memory
|
||||
{
|
||||
void TransferManager::recordCommands( vk::raii::CommandBuffer& command_buffer )
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace fgl::engine
|
||||
|
||||
class BufferSuballocation;
|
||||
} // namespace memory
|
||||
|
||||
} // namespace fgl::engine
|
||||
|
||||
namespace fgl::engine::memory
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "RenderCamera.hpp"
|
||||
#include "engine/memory/buffers/BufferHandle.hpp"
|
||||
#include "engine/memory/buffers/VulkanBuffer.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "CameraInfo.hpp"
|
||||
#include "RenderCamera.hpp"
|
||||
#include "assets/model/Model.hpp"
|
||||
#include "math/literals/size.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "GBufferSwapchain.hpp"
|
||||
|
||||
#include <meta>
|
||||
|
||||
#include "engine/descriptors/DescriptorSet.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
|
||||
@@ -6,12 +6,6 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#include <imgui.h>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include "engine/FGL_DEFINES.hpp"
|
||||
#include "engine/clock.hpp"
|
||||
#include "engine/debug/logging/logging.hpp"
|
||||
|
||||
@@ -77,6 +77,12 @@ namespace fgl::engine::descriptors
|
||||
std::size_t array_idx,
|
||||
std::size_t item_size );
|
||||
|
||||
template<typename T>
|
||||
void bindAttachmentObject(T& t, std::size_t view_idx)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void bindAttachment( std::uint32_t binding_idx, const ImageView& view, vk::ImageLayout layout );
|
||||
|
||||
void bindTexture( std::uint32_t binding_idx, const std::shared_ptr< Texture >& tex_ptr );
|
||||
|
||||
@@ -4,17 +4,12 @@
|
||||
|
||||
#include "drawers.hpp"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#include <imgui.h>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include "editor/src/gui/helpers.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
/*
|
||||
void drawComponentTransform( ComponentTransform& transform )
|
||||
{
|
||||
if ( ImGui::CollapsingHeader( "Transform" ) )
|
||||
@@ -35,5 +30,6 @@ namespace fgl::engine
|
||||
ImGui::DragFloat3( "Scale", &transform.scale.x, speed );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
} // namespace fgl::engine
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
void drawComponentTransform( ComponentTransform& transform );
|
||||
// void drawComponentTransform( ComponentTransform& transform );
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace fgl::engine::memory
|
||||
{
|
||||
class BufferHandle;
|
||||
class VulkanBuffer;
|
||||
class SuballocationView;
|
||||
|
||||
class BufferSuballocationHandle;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "BufferSuballocationHandle.hpp"
|
||||
|
||||
#include "BufferHandle.hpp"
|
||||
#include "BufferSuballocation.hpp"
|
||||
#include "VulkanBuffer.hpp"
|
||||
#include "assets/transfer/TransferManager.hpp"
|
||||
#include "engine/debug/logging/logging.hpp"
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "BufferHandle.hpp"
|
||||
#include "FGL_DEFINES.hpp"
|
||||
#include "VulkanBuffer.hpp"
|
||||
#include "engine/debug/Track.hpp"
|
||||
|
||||
namespace vk::raii
|
||||
@@ -19,7 +19,7 @@ namespace vk::raii
|
||||
|
||||
namespace fgl::engine::memory
|
||||
{
|
||||
class BufferHandle;
|
||||
class VulkanBuffer;
|
||||
|
||||
class BufferSuballocationHandle : public std::enable_shared_from_this< BufferSuballocationHandle >
|
||||
{
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
// Created by kj16609 on 12/30/23.
|
||||
//
|
||||
|
||||
#include "BufferHandle.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <tuple>
|
||||
|
||||
#include "BufferSuballocationHandle.hpp"
|
||||
#include "VulkanBuffer.hpp"
|
||||
#include "align.hpp"
|
||||
#include "assets/transfer/TransferManager.hpp"
|
||||
#include "engine/debug/logging/logging.hpp"
|
||||
@@ -18,7 +17,7 @@
|
||||
namespace fgl::engine::memory
|
||||
{
|
||||
|
||||
std::tuple< vk::Buffer, VmaAllocationInfo, VmaAllocation > BufferHandle::allocBuffer(
|
||||
std::tuple< vk::Buffer, VmaAllocationInfo, VmaAllocation > VulkanBuffer::allocBuffer(
|
||||
const vk::DeviceSize memory_size, vk::BufferUsageFlags usage, const vk::MemoryPropertyFlags property_flags )
|
||||
{
|
||||
// Used for resizing.
|
||||
@@ -71,12 +70,12 @@ namespace fgl::engine::memory
|
||||
VmaAllocation >( std::move( buffer ), std::move( alloc_info ), std::move( allocation ) );
|
||||
}
|
||||
|
||||
void BufferHandle::deallocBuffer( const vk::Buffer& buffer, const VmaAllocation& allocation )
|
||||
void VulkanBuffer::deallocBuffer( const vk::Buffer& buffer, const VmaAllocation& allocation )
|
||||
{
|
||||
vmaDestroyBuffer( Device::getInstance().allocator(), buffer, allocation );
|
||||
}
|
||||
|
||||
void BufferHandle::swap( BufferHandle& other ) noexcept
|
||||
void VulkanBuffer::swap( VulkanBuffer& other ) noexcept
|
||||
{
|
||||
std::swap( m_buffer, other.m_buffer );
|
||||
std::swap( m_allocation, other.m_allocation );
|
||||
@@ -91,7 +90,7 @@ namespace fgl::engine::memory
|
||||
std::swap( m_free_blocks, other.m_free_blocks );
|
||||
}
|
||||
|
||||
BufferHandle::BufferHandle(
|
||||
VulkanBuffer::VulkanBuffer(
|
||||
vk::DeviceSize memory_size,
|
||||
const vk::BufferUsageFlags usage,
|
||||
const vk::MemoryPropertyFlags memory_properties ) :
|
||||
@@ -108,7 +107,7 @@ namespace fgl::engine::memory
|
||||
m_free_blocks.emplace_back( 0, memory_size );
|
||||
}
|
||||
|
||||
BufferHandle::~BufferHandle()
|
||||
VulkanBuffer::~VulkanBuffer()
|
||||
{
|
||||
if ( !m_active_suballocations.empty() )
|
||||
{
|
||||
@@ -139,7 +138,17 @@ namespace fgl::engine::memory
|
||||
deallocBuffer( m_buffer, m_allocation );
|
||||
}
|
||||
|
||||
vk::DeviceSize BufferHandle::largestBlock() const
|
||||
VkDeviceMemory VulkanBuffer::address() const
|
||||
{
|
||||
return m_alloc_info.deviceMemory;
|
||||
}
|
||||
|
||||
VkDeviceSize VulkanBuffer::size() const
|
||||
{
|
||||
return m_alloc_info.size;
|
||||
}
|
||||
|
||||
vk::DeviceSize VulkanBuffer::largestBlock() const
|
||||
{
|
||||
vk::DeviceSize largest { 0 };
|
||||
|
||||
@@ -151,7 +160,7 @@ namespace fgl::engine::memory
|
||||
return largest;
|
||||
}
|
||||
|
||||
vk::DeviceSize BufferHandle::used() const
|
||||
vk::DeviceSize VulkanBuffer::used() const
|
||||
{
|
||||
vk::DeviceSize total_size { 0 };
|
||||
|
||||
@@ -164,19 +173,19 @@ namespace fgl::engine::memory
|
||||
return total_size;
|
||||
}
|
||||
|
||||
vk::DeviceMemory BufferHandle::getMemory() const
|
||||
vk::DeviceMemory VulkanBuffer::getMemory() const
|
||||
{
|
||||
assert( m_alloc_info.deviceMemory != VK_NULL_HANDLE );
|
||||
|
||||
return m_alloc_info.deviceMemory;
|
||||
}
|
||||
|
||||
std::string BufferHandle::sizeName() const
|
||||
std::string VulkanBuffer::sizeName() const
|
||||
{
|
||||
return std::format( "{}: {}", m_debug_name, literals::size_literals::toString( size() ) );
|
||||
}
|
||||
|
||||
std::shared_ptr< BufferSuballocationHandle > BufferHandle::
|
||||
std::shared_ptr< BufferSuballocationHandle > VulkanBuffer::
|
||||
allocate( vk::DeviceSize desired_memory_size, const vk::DeviceSize t_alignment )
|
||||
{
|
||||
ZoneScoped;
|
||||
@@ -258,7 +267,7 @@ namespace fgl::engine::memory
|
||||
return suballocation_handle;
|
||||
}
|
||||
|
||||
bool BufferHandle::canAllocate( const vk::DeviceSize memory_size, const vk::DeviceSize alignment )
|
||||
bool VulkanBuffer::canAllocate( const vk::DeviceSize memory_size, const vk::DeviceSize alignment )
|
||||
{
|
||||
// TODO: This check can be optimized by itterating through and virtually combining blocks that would be combined.
|
||||
// If the combined block is large enough then we should consider it being capable of allocation.
|
||||
@@ -273,7 +282,7 @@ namespace fgl::engine::memory
|
||||
return true;
|
||||
}
|
||||
|
||||
void BufferHandle::free( BufferSuballocationHandle& info )
|
||||
void VulkanBuffer::free( BufferSuballocationHandle& info )
|
||||
{
|
||||
ZoneScoped;
|
||||
|
||||
@@ -312,7 +321,7 @@ namespace fgl::engine::memory
|
||||
#endif
|
||||
}
|
||||
|
||||
void BufferHandle::mergeFreeBlocks()
|
||||
void VulkanBuffer::mergeFreeBlocks()
|
||||
{
|
||||
ZoneScoped;
|
||||
//Can't combine blocks if there is only 1
|
||||
@@ -356,7 +365,7 @@ namespace fgl::engine::memory
|
||||
}
|
||||
}
|
||||
|
||||
void BufferHandle::setDebugName( const std::string& str )
|
||||
void VulkanBuffer::setDebugName( const std::string& str )
|
||||
{
|
||||
m_debug_name = str;
|
||||
std::string sized_name { std::format( "{}: {}", m_debug_name, literals::size_literals::toString( size() ) ) };
|
||||
@@ -369,14 +378,14 @@ namespace fgl::engine::memory
|
||||
Device::getInstance().setDebugUtilsObjectName( info );
|
||||
}
|
||||
|
||||
void* BufferHandle::map( const BufferSuballocationHandle& handle ) const
|
||||
void* VulkanBuffer::map( const BufferSuballocationHandle& handle ) const
|
||||
{
|
||||
if ( m_alloc_info.pMappedData == nullptr ) return nullptr;
|
||||
|
||||
return static_cast< std::byte* >( m_alloc_info.pMappedData ) + handle.offset();
|
||||
}
|
||||
|
||||
vk::DeviceSize BufferHandle::alignment() const
|
||||
vk::DeviceSize VulkanBuffer::alignment() const
|
||||
{
|
||||
vk::DeviceSize size { 1 };
|
||||
|
||||
@@ -398,7 +407,7 @@ namespace fgl::engine::memory
|
||||
return size;
|
||||
}
|
||||
|
||||
decltype( BufferHandle::m_free_blocks )::iterator BufferHandle::
|
||||
decltype( VulkanBuffer::m_free_blocks )::iterator VulkanBuffer::
|
||||
findAvailableBlock( vk::DeviceSize memory_size, const vk::DeviceSize t_alignment )
|
||||
{
|
||||
//Find a free space.
|
||||
@@ -416,28 +425,28 @@ namespace fgl::engine::memory
|
||||
} );
|
||||
}
|
||||
|
||||
Buffer& Buffer::operator=( const std::shared_ptr< BufferHandle >& other )
|
||||
Buffer& Buffer::operator=( const std::shared_ptr< VulkanBuffer >& other )
|
||||
{
|
||||
std::shared_ptr< BufferHandle >::operator=( other );
|
||||
std::shared_ptr< VulkanBuffer >::operator=( other );
|
||||
return *this;
|
||||
}
|
||||
|
||||
Buffer::
|
||||
Buffer( vk::DeviceSize memory_size, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags memory_properties ) :
|
||||
std::shared_ptr< BufferHandle >( std::make_shared< BufferHandle >( memory_size, usage, memory_properties ) )
|
||||
std::shared_ptr< VulkanBuffer >( std::make_shared< VulkanBuffer >( memory_size, usage, memory_properties ) )
|
||||
{}
|
||||
|
||||
Buffer::Buffer( const std::shared_ptr< BufferHandle >& buffer ) : std::shared_ptr< BufferHandle >( buffer )
|
||||
Buffer::Buffer( const std::shared_ptr< VulkanBuffer >& buffer ) : std::shared_ptr< VulkanBuffer >( buffer )
|
||||
{}
|
||||
|
||||
BufferSuballocation Buffer::allocate( const vk::DeviceSize desired_size, const std::uint32_t alignment ) const
|
||||
{
|
||||
return std::shared_ptr< BufferHandle >::operator->()->allocate( desired_size, alignment );
|
||||
return std::shared_ptr< VulkanBuffer >::operator->()->allocate( desired_size, alignment );
|
||||
}
|
||||
|
||||
vk::DeviceSize Buffer::size() const
|
||||
{
|
||||
return std::shared_ptr< BufferHandle >::operator->()->size();
|
||||
return std::shared_ptr< VulkanBuffer >::operator->()->size();
|
||||
}
|
||||
|
||||
} // namespace fgl::engine::memory
|
||||
@@ -8,19 +8,13 @@
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <stacktrace>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include "engine/debug/Track.hpp"
|
||||
#include "math/literals/size.hpp"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#include <vma/vma_impl.hpp>
|
||||
#pragma GCC diagnostic pop
|
||||
#include "memory/vma_impl.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
@@ -47,9 +41,7 @@ namespace fgl::engine::memory
|
||||
//TODO: Dynamic/onDemand resizing of Buffer for suballocations
|
||||
//TODO: Defragmentation
|
||||
|
||||
//TODO: Ensure this class can't be directly accessed from within Buffer unless we are trying
|
||||
// to access it in a debug manner (IE the drawStats menu)
|
||||
class BufferHandle : public std::enable_shared_from_this< BufferHandle >
|
||||
class VulkanBuffer : public std::enable_shared_from_this< VulkanBuffer >
|
||||
{
|
||||
vk::Buffer m_buffer { VK_NULL_HANDLE };
|
||||
VmaAllocation m_allocation {};
|
||||
@@ -84,24 +76,24 @@ namespace fgl::engine::memory
|
||||
vk::DeviceSize memory_size, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags property_flags );
|
||||
static void deallocBuffer( const vk::Buffer&, const VmaAllocation& );
|
||||
|
||||
BufferHandle() = delete;
|
||||
BufferHandle( const BufferHandle& other ) = delete;
|
||||
BufferHandle& operator=( const BufferHandle& other ) = delete;
|
||||
BufferHandle( BufferHandle&& other ) = delete;
|
||||
BufferHandle& operator=( BufferHandle&& other ) = delete;
|
||||
VulkanBuffer() = delete;
|
||||
VulkanBuffer( const VulkanBuffer& other ) = delete;
|
||||
VulkanBuffer& operator=( const VulkanBuffer& other ) = delete;
|
||||
VulkanBuffer( VulkanBuffer&& other ) = delete;
|
||||
VulkanBuffer& operator=( VulkanBuffer&& other ) = delete;
|
||||
|
||||
void swap( BufferHandle& other ) noexcept;
|
||||
void swap( VulkanBuffer& other ) noexcept;
|
||||
|
||||
public:
|
||||
|
||||
BufferHandle(
|
||||
VulkanBuffer(
|
||||
vk::DeviceSize memory_size, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags memory_properties );
|
||||
|
||||
~BufferHandle();
|
||||
~VulkanBuffer();
|
||||
|
||||
auto address() const { return m_alloc_info.deviceMemory; }
|
||||
VkDeviceMemory address() const;
|
||||
|
||||
auto size() const { return m_alloc_info.size; }
|
||||
VkDeviceSize size() const;
|
||||
|
||||
vk::DeviceSize largestBlock() const;
|
||||
|
||||
@@ -167,23 +159,24 @@ namespace fgl::engine::memory
|
||||
findAvailableBlock( vk::DeviceSize memory_size, vk::DeviceSize t_alignment );
|
||||
};
|
||||
|
||||
class Buffer final : public std::shared_ptr< BufferHandle >
|
||||
class Buffer final : public std::shared_ptr< VulkanBuffer >
|
||||
{
|
||||
public:
|
||||
|
||||
[[nodiscard]] Buffer(
|
||||
vk::DeviceSize memory_size, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags memory_properties );
|
||||
|
||||
[[nodiscard]] explicit Buffer( const std::shared_ptr< BufferHandle >& buffer );
|
||||
[[nodiscard]] explicit Buffer( const std::shared_ptr< VulkanBuffer >& buffer );
|
||||
|
||||
BufferSuballocation allocate( const vk::DeviceSize desired_size, const std::uint32_t alignment = 1 ) const;
|
||||
BufferSuballocation allocate( vk::DeviceSize desired_size, std::uint32_t alignment = 1 ) const;
|
||||
|
||||
[[nodiscard]] vk::DeviceSize size() const;
|
||||
|
||||
Buffer& operator=( const std::shared_ptr< BufferHandle >& other );
|
||||
Buffer& operator=( const std::shared_ptr< VulkanBuffer >& other );
|
||||
|
||||
~Buffer() = default;
|
||||
};
|
||||
|
||||
std::vector< std::weak_ptr< Buffer > > getActiveBuffers();
|
||||
|
||||
} // namespace fgl::engine::memory
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
#include "BufferVector.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "engine/assets/transfer/TransferManager.hpp"
|
||||
#include "engine/memory/buffers/BufferHandle.hpp"
|
||||
#include "engine/memory/buffers/VulkanBuffer.hpp"
|
||||
|
||||
namespace fgl::engine::memory
|
||||
{
|
||||
|
||||
6
src/engine/memory/vma_impl.cpp
Normal file
6
src/engine/memory/vma_impl.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
//
|
||||
// Created by kj16609 on 11/22/25.
|
||||
//
|
||||
|
||||
#define VMA_IMPLEMENTATION
|
||||
#include <vk_mem_alloc.h>
|
||||
6
src/engine/memory/vma_impl.hpp
Normal file
6
src/engine/memory/vma_impl.hpp
Normal file
@@ -0,0 +1,6 @@
|
||||
//
|
||||
// Created by kj16609 on 11/22/25.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include <vk_mem_alloc.h>
|
||||
@@ -3,6 +3,7 @@
|
||||
//
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
|
||||
#include "CommandBuffer.hpp"
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace fgl::engine
|
||||
// render_attachments.input_color.setName( "Input Color" );
|
||||
}
|
||||
|
||||
std::pair< vk::Result, PresentIndex > PresentSwapChain::acquireNextImage()
|
||||
vk::ResultValue< uint32_t > PresentSwapChain::acquireNextImage() const
|
||||
{
|
||||
ZoneScoped;
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace fgl::engine
|
||||
|
||||
[[nodiscard]] float extentAspectRatio() const;
|
||||
|
||||
[[nodiscard]] std::pair< vk::Result, PresentIndex > acquireNextImage();
|
||||
[[nodiscard]] vk::ResultValue< uint32_t > acquireNextImage() const;
|
||||
[[nodiscard]] vk::Result submitCommandBuffers( const CommandBuffer& buffers, PresentIndex present_index );
|
||||
|
||||
void transitionImages( const CommandBuffer& command_buffer, StageID stage_id, FrameIndex frame_index ) const;
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#include "Device.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <meta>
|
||||
#include <set>
|
||||
|
||||
#include "engine/descriptors/DescriptorPool.hpp"
|
||||
|
||||
// std headers
|
||||
#include <tracy/Tracy.hpp>
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
|
||||
#include "debug/Track.hpp"
|
||||
#include "engine/debug/logging/logging.hpp"
|
||||
|
||||
@@ -138,18 +139,6 @@ namespace fgl::engine
|
||||
std::cout << "\t" << desired_ext << ": " << found << std::endl;
|
||||
if ( !found ) throw std::runtime_error( "Failed to find required extension" );
|
||||
}
|
||||
|
||||
// might not really be necessary anymore because device specific validation layers
|
||||
// have been deprecated
|
||||
if ( true )
|
||||
{
|
||||
m_create_info.enabledLayerCount = static_cast< uint32_t >( m_validation_layers.size() );
|
||||
m_create_info.ppEnabledLayerNames = m_validation_layers.data();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_create_info.enabledLayerCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Device::DeviceCreateInfo::DeviceCreateInfo( PhysicalDevice& physical_device ) :
|
||||
|
||||
@@ -10,13 +10,9 @@
|
||||
#include "engine/rendering/Instance.hpp"
|
||||
#include "engine/rendering/Surface.hpp"
|
||||
#include "extensions.hpp"
|
||||
#include "memory/vma_impl.hpp"
|
||||
#include "rendering/CommandBufferPool.hpp"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#include <vma/vma_impl.hpp>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace fgl::engine
|
||||
submitInfo( std::move( attachment_info ) );
|
||||
}
|
||||
|
||||
void RenderGraph::flush( const CommandBuffer& command_buffer )
|
||||
void RenderGraph::flush( CommandBuffer& command_buffer )
|
||||
{
|
||||
while ( !m_queue.empty() )
|
||||
{
|
||||
|
||||
@@ -71,8 +71,6 @@ namespace fgl::engine
|
||||
|
||||
public:
|
||||
|
||||
friend class RenderGraph;
|
||||
|
||||
void push();
|
||||
void pop();
|
||||
|
||||
@@ -84,7 +82,7 @@ namespace fgl::engine
|
||||
|
||||
void registerBuffer( const std::string& str, const memory::BufferSuballocation& value );
|
||||
void addBufferDependency( std::string buffer_name );
|
||||
void flush( const CommandBuffer& command_buffer );
|
||||
void flush( CommandBuffer& command_buffer );
|
||||
};
|
||||
|
||||
} // namespace fgl::engine
|
||||
@@ -79,12 +79,14 @@ namespace fgl::engine
|
||||
auto& command_buffer { info.command_buffer.render_cb };
|
||||
TracyVkZone( info.tracy_ctx, **command_buffer, "Render textured entities" );
|
||||
|
||||
/*
|
||||
info.graph.addAttachmentOutput( "G_DEPTH", vk::ImageLayout::eDepthAttachmentOptimal );
|
||||
info.graph.addAttachmentOutput( "G_COLOR", vk::ImageLayout::eAttachmentOptimal );
|
||||
info.graph.addAttachmentOutput( "G_NORMAL", vk::ImageLayout::eAttachmentOptimal );
|
||||
info.graph.addAttachmentOutput( "G_POSITION", vk::ImageLayout::eAttachmentOptimal );
|
||||
info.graph.addAttachmentOutput( "G_EMISSIVE", vk::ImageLayout::eAttachmentOptimal );
|
||||
info.graph.addAttachmentOutput( "G_METALLIC", vk::ImageLayout::eAttachmentOptimal );
|
||||
*/
|
||||
|
||||
// info.graph.addBufferDependency( "VERTEX_BUFFER" );
|
||||
// info.graph.addBufferDependency( "INDEX_BUFFER" );
|
||||
@@ -95,7 +97,7 @@ namespace fgl::engine
|
||||
|
||||
// compute shader
|
||||
|
||||
info.graph.flush( command_buffer );
|
||||
// info.graph.flush( command_buffer );
|
||||
|
||||
m_textured_pipeline->bind( command_buffer );
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace fgl::engine
|
||||
|
||||
namespace memory
|
||||
{
|
||||
class BufferHandle;
|
||||
class VulkanBuffer;
|
||||
}
|
||||
|
||||
struct FrameInfo;
|
||||
|
||||
37
src/renderer/CMakeLists.txt
Normal file
37
src/renderer/CMakeLists.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
file(GLOB_RECURSE CPP_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/**.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/**.hpp"
|
||||
)
|
||||
|
||||
AddFGLLibrary(FGLRenderer SHARED ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_compile_definitions(FGLRenderer PUBLIC
|
||||
VULKAN_HPP_NO_CONSTRUCTORS # Disabled constructors
|
||||
VULKAN_HPP_NO_SETTERS # Disable setters for structs
|
||||
VULKAN_HPP_NO_STD_MODULE # No import std
|
||||
VULKAN_HPP_NO_TO_STRING # use reflection instead
|
||||
VULKAN_HPP_NO_WIN32_PROTOTYPES
|
||||
VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST
|
||||
)
|
||||
|
||||
include(dependencies/spdlog)
|
||||
|
||||
target_link_libraries(FGLRenderer PUBLIC Vulkan::Vulkan FGLLoader spdlog slang glm)
|
||||
target_include_directories(FGLRenderer SYSTEM PUBLIC ${GLM_INCLUDE_DIRS})
|
||||
target_link_libraries(FGLRenderer PUBLIC glfw Tracy::TracyClient libFGL)
|
||||
target_include_directories(FGLRenderer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_UPPER_BUILD_TYPE)
|
||||
|
||||
#GLM settings
|
||||
# GLM_FORCE_NO_CTOR_INIT
|
||||
target_compile_definitions(FGLRenderer PUBLIC GLM_FORCE_RADIANS GLM_FORCE_DEPTH_ZERO_TO_ONE)
|
||||
|
||||
if (DEFINED FGL_ENABLE_CALIBRATED_PROFILING AND FGL_ENABLE_CALIBRATED_PROFILING)
|
||||
target_compile_definitions(FGLRenderer PUBLIC ENABLE_CALIBRATED_PROFILING=1)
|
||||
else ()
|
||||
target_compile_definitions(FGLRenderer PUBLIC ENABLE_CALIBRATED_PROFILING=0)
|
||||
endif ()
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests)
|
||||
9
src/renderer/src/FGLRenderSurface.cpp
Normal file
9
src/renderer/src/FGLRenderSurface.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// Created by kj16609 on 12/7/25.
|
||||
//
|
||||
#include "FGLRenderSurface.hpp"
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
|
||||
}
|
||||
20
src/renderer/src/FGLRenderSurface.hpp
Normal file
20
src/renderer/src/FGLRenderSurface.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Created by kj16609 on 12/7/25.
|
||||
//
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <variant>
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
class GLFWRenderSurface;
|
||||
|
||||
using RenderSurfaceBase = std::unique_ptr< std::variant< GLFWRenderSurface > >;
|
||||
|
||||
class FGLRenderSurface
|
||||
{
|
||||
public:
|
||||
|
||||
FGLRenderSurface( int start_width, int start_height, bool fullscreen = false );
|
||||
};
|
||||
} // namespace fgl::renderer
|
||||
18
src/renderer/src/FGLRenderer.cpp
Normal file
18
src/renderer/src/FGLRenderer.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Created by kj16609 on 12/4/25.
|
||||
//
|
||||
|
||||
#include "FGLRenderer.hpp"
|
||||
|
||||
#include "FGLRenderSurface.hpp"
|
||||
#include "vulkan/Vulkan.hpp"
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
|
||||
FGLRenderer FGLRenderer::createVkRenderer()
|
||||
{}
|
||||
|
||||
FGLRenderer::~FGLRenderer() = default;
|
||||
|
||||
} // namespace fgl::renderer
|
||||
32
src/renderer/src/FGLRenderer.hpp
Normal file
32
src/renderer/src/FGLRenderer.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by kj16609 on 12/4/25.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <variant>
|
||||
|
||||
#include "fgl/defines.hpp"
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
class Vulkan;
|
||||
|
||||
using RendererBase = std::unique_ptr< Vulkan >;
|
||||
|
||||
class FGLRenderer
|
||||
{
|
||||
RendererBase m_base;
|
||||
|
||||
public:
|
||||
|
||||
FGLRenderer() = delete;
|
||||
FGL_DELETE_MOVE( FGLRenderer );
|
||||
FGL_DELETE_COPY( FGLRenderer );
|
||||
|
||||
static FGLRenderer createVkRenderer();
|
||||
|
||||
~FGLRenderer();
|
||||
};
|
||||
|
||||
} // namespace fgl::renderer
|
||||
16
src/renderer/src/surfaces/Surface.hpp
Normal file
16
src/renderer/src/surfaces/Surface.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Created by kj16609 on 12/7/25.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace vk::raii
|
||||
{
|
||||
class SurfaceKHR;
|
||||
}
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
using Surface = std::unique_ptr< vk::raii::SurfaceKHR >;
|
||||
}
|
||||
52
src/renderer/src/surfaces/glfw/GLFWRenderSurface.cpp
Normal file
52
src/renderer/src/surfaces/glfw/GLFWRenderSurface.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// Created by kj16609 on 12/7/25.
|
||||
//
|
||||
#include "GLFWRenderSurface.hpp"
|
||||
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
#include "GLFW/glfw3.h"
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
|
||||
void resizeCallback( GLFWwindow* window_ptr, int width, int height )
|
||||
{
|
||||
auto* window { static_cast< GLFWRenderSurface* >( glfwGetWindowUserPointer( window_ptr ) ) };
|
||||
if ( window )
|
||||
{
|
||||
window->m_resized = true;
|
||||
window->m_width = width;
|
||||
window->m_height = height;
|
||||
}
|
||||
}
|
||||
|
||||
GLFWRenderSurface::GLFWRenderSurface( const int width, const int height, const std::string_view window_name ) :
|
||||
m_window( nullptr ),
|
||||
m_width( width ),
|
||||
m_height( height )
|
||||
{
|
||||
glfwInit();
|
||||
glfwWindowHint( GLFW_CLIENT_API, GLFW_NO_API );
|
||||
glfwWindowHint( GLFW_RESIZABLE, GLFW_TRUE );
|
||||
|
||||
m_window = glfwCreateWindow( width, height, window_name.data(), nullptr, nullptr );
|
||||
|
||||
glfwSetWindowUserPointer( m_window, this );
|
||||
glfwSetFramebufferSizeCallback( m_window, resizeCallback );
|
||||
}
|
||||
|
||||
bool GLFWRenderSurface::shouldClose() const
|
||||
{
|
||||
return glfwWindowShouldClose( m_window );
|
||||
}
|
||||
|
||||
Surface GLFWRenderSurface::createVkWindowSurface( vk::raii::Instance& instance ) const
|
||||
{
|
||||
VkSurfaceKHR target_surface { VK_NULL_HANDLE };
|
||||
glfwCreateWindowSurface( *instance, m_window, nullptr, &target_surface );
|
||||
|
||||
return std::make_unique< vk::raii::SurfaceKHR >( instance, target_surface );
|
||||
}
|
||||
|
||||
} // namespace fgl::renderer
|
||||
41
src/renderer/src/surfaces/glfw/GLFWRenderSurface.hpp
Normal file
41
src/renderer/src/surfaces/glfw/GLFWRenderSurface.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// Created by kj16609 on 12/7/25.
|
||||
//
|
||||
#pragma once
|
||||
#include <string_view>
|
||||
|
||||
#include "surfaces/Surface.hpp"
|
||||
|
||||
namespace vk::raii
|
||||
{
|
||||
class Instance;
|
||||
}
|
||||
struct GLFWwindow;
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
|
||||
class GLFWRenderSurface
|
||||
{
|
||||
GLFWwindow* m_window;
|
||||
bool m_resized { false };
|
||||
int m_width;
|
||||
int m_height;
|
||||
|
||||
friend void resizeCallback( GLFWwindow* window_ptr, int width, int height );
|
||||
|
||||
public:
|
||||
|
||||
GLFWRenderSurface( int width, int height, std::string_view window_name );
|
||||
|
||||
// FGL_DELETE_ALL_RO5( GLFWRenderSurface );
|
||||
|
||||
//! Returns true if the window has been resized since the last check
|
||||
bool hasResized() const;
|
||||
|
||||
bool shouldClose() const;
|
||||
|
||||
Surface createVkWindowSurface( vk::raii::Instance& instance ) const;
|
||||
};
|
||||
|
||||
} // namespace fgl::renderer
|
||||
85
src/renderer/src/vulkan/Vulkan.cpp
Normal file
85
src/renderer/src/vulkan/Vulkan.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// Created by kj16609 on 12/4/25.
|
||||
//
|
||||
|
||||
#include "vulkan/Vulkan.hpp"
|
||||
|
||||
#include "VulkanDevice.hpp"
|
||||
#include "VulkanPhysicalDevice.hpp"
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
|
||||
inline static PFN_vkCreateDebugUtilsMessengerEXT pfnVkCreateDebugUtilsMessengerEXT { nullptr };
|
||||
inline static PFN_vkDestroyDebugUtilsMessengerEXT pfnVkDestroyDebugUtilsMessengerEXT { nullptr };
|
||||
inline static PFN_vkSetDebugUtilsObjectNameEXT pfnVkSetDebugUtilsObjectNameEXT { nullptr };
|
||||
|
||||
// Callback function for vulkan messaging.
|
||||
static VKAPI_ATTR vk::Bool32 VKAPI_CALL debugCallback(
|
||||
const vk::DebugUtilsMessageSeverityFlagBitsEXT message_severity,
|
||||
[[maybe_unused]] vk::DebugUtilsMessageTypeFlagsEXT message_type,
|
||||
const vk::DebugUtilsMessengerCallbackDataEXT* p_callback_data,
|
||||
[[maybe_unused]] void* p_user_data )
|
||||
{
|
||||
switch ( message_severity )
|
||||
{
|
||||
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eVerbose:
|
||||
break;
|
||||
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eInfo:
|
||||
break;
|
||||
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning:
|
||||
break;
|
||||
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eError:
|
||||
break;
|
||||
default:
|
||||
{
|
||||
throw std::runtime_error { "Unknown severity from debug callback" };
|
||||
}
|
||||
}
|
||||
|
||||
return VK_FALSE;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugUtilsMessengerEXT(
|
||||
VkInstance instance,
|
||||
const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkDebugUtilsMessengerEXT* pMessenger )
|
||||
{
|
||||
assert( pfnVkCreateDebugUtilsMessengerEXT );
|
||||
return pfnVkCreateDebugUtilsMessengerEXT( instance, pCreateInfo, pAllocator, pMessenger );
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkDestroyDebugUtilsMessengerEXT(
|
||||
VkInstance instance, VkDebugUtilsMessengerEXT messenger, VkAllocationCallbacks const * pAllocator )
|
||||
{
|
||||
assert( pfnVkDestroyDebugUtilsMessengerEXT );
|
||||
return pfnVkDestroyDebugUtilsMessengerEXT( instance, messenger, pAllocator );
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vkSetDebugUtilsObjectNameEXT( VkDevice device, const VkDebugUtilsObjectNameInfoEXT* nameInfo )
|
||||
{
|
||||
assert( pfnVkSetDebugUtilsObjectNameEXT );
|
||||
return pfnVkSetDebugUtilsObjectNameEXT( device, nameInfo );
|
||||
}
|
||||
|
||||
inline static vk::ApplicationInfo s_app_info {
|
||||
.pApplicationName = "FGL App",
|
||||
.applicationVersion = VK_MAKE_VERSION( 1, 0, 0 ),
|
||||
.pEngineName = "FGL Engine",
|
||||
.engineVersion = VK_MAKE_VERSION( 1, 0, 0 ),
|
||||
.apiVersion = VK_API_VERSION_1_4,
|
||||
};
|
||||
|
||||
inline static vk::InstanceCreateInfo s_create_info {
|
||||
.pApplicationInfo = &s_app_info
|
||||
};
|
||||
|
||||
Vulkan::Vulkan( const std::string_view app_name ) : m_ctx(), , m_instance( m_ctx, s_create_info )
|
||||
{}
|
||||
|
||||
Vulkan::~Vulkan()
|
||||
{}
|
||||
|
||||
} // namespace fgl::renderer
|
||||
33
src/renderer/src/vulkan/Vulkan.hpp
Normal file
33
src/renderer/src/vulkan/Vulkan.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// Created by kj16609 on 12/4/25.
|
||||
//
|
||||
#pragma once
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "fgl/defines.hpp"
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
class VulkanDevice;
|
||||
class VulkanPhysicalDevice;
|
||||
|
||||
class Vulkan
|
||||
{
|
||||
vk::raii::Context m_ctx;
|
||||
vk::raii::Instance m_instance;
|
||||
|
||||
std::unique_ptr< VulkanDevice > m_device;
|
||||
std::unique_ptr< VulkanPhysicalDevice > m_phy_device;
|
||||
|
||||
public:
|
||||
|
||||
FGL_DELETE_MOVE( Vulkan );
|
||||
FGL_DELETE_COPY( Vulkan );
|
||||
|
||||
Vulkan();
|
||||
~Vulkan();
|
||||
};
|
||||
|
||||
} // namespace fgl::renderer
|
||||
4
src/renderer/src/vulkan/VulkanAllocator.cpp
Normal file
4
src/renderer/src/vulkan/VulkanAllocator.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
//
|
||||
// Created by kj16609 on 12/9/25.
|
||||
//
|
||||
#include "VulkanAllocator.hpp"
|
||||
20
src/renderer/src/vulkan/VulkanAllocator.hpp
Normal file
20
src/renderer/src/vulkan/VulkanAllocator.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Created by kj16609 on 12/9/25.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "fgl/size.hpp"
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
using namespace fgl::size::literals;
|
||||
|
||||
class VulkanAllocator
|
||||
{
|
||||
static constexpr auto minimim_block_size { 64_MiB };
|
||||
|
||||
public:
|
||||
|
||||
VulkanAllocator();
|
||||
};
|
||||
} // namespace fgl::renderer
|
||||
11
src/renderer/src/vulkan/VulkanDevice.cpp
Normal file
11
src/renderer/src/vulkan/VulkanDevice.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// Created by kj16609 on 12/7/25.
|
||||
//
|
||||
#include "VulkanDevice.hpp"
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
20
src/renderer/src/vulkan/VulkanDevice.hpp
Normal file
20
src/renderer/src/vulkan/VulkanDevice.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Created by kj16609 on 12/7/25.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
|
||||
class VulkanDevice
|
||||
{
|
||||
vk::raii::Device m_device;
|
||||
|
||||
public:
|
||||
|
||||
VulkanDevice();
|
||||
};
|
||||
|
||||
} // namespace fgl::renderer
|
||||
9
src/renderer/src/vulkan/VulkanPhysicalDevice.cpp
Normal file
9
src/renderer/src/vulkan/VulkanPhysicalDevice.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// Created by kj16609 on 12/7/25.
|
||||
//
|
||||
#include "VulkanPhysicalDevice.hpp"
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
|
||||
}
|
||||
20
src/renderer/src/vulkan/VulkanPhysicalDevice.hpp
Normal file
20
src/renderer/src/vulkan/VulkanPhysicalDevice.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Created by kj16609 on 12/7/25.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
namespace fgl::renderer
|
||||
{
|
||||
|
||||
class VulkanPhysicalDevice
|
||||
{
|
||||
vk::raii::PhysicalDevice m_device;
|
||||
|
||||
public:
|
||||
|
||||
VulkanPhysicalDevice();
|
||||
};
|
||||
|
||||
} // namespace fgl::renderer
|
||||
2
src/renderer/tests/CMakeLists.txt
Normal file
2
src/renderer/tests/CMakeLists.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
AddFGLExecutable(FGLRenderer_TESTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(FGLRenderer_TESTS PUBLIC FGLRenderer)
|
||||
14
src/renderer/tests/main.cpp
Normal file
14
src/renderer/tests/main.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Created by kj16609 on 12/4/25.
|
||||
//
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include "FGLRenderer.hpp"
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
fgl::renderer::FGLRenderer renderer { fgl::renderer::FGLRenderer::createVkRenderer() };
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
|
||||
|
||||
add_library(VMA STATIC ${CMAKE_CURRENT_SOURCE_DIR}/vma_impl.cpp)
|
||||
target_link_libraries(VMA PUBLIC Vulkan::Vulkan GPUOpen::VulkanMemoryAllocator)
|
||||
@@ -1,6 +0,0 @@
|
||||
//
|
||||
// Created by kj16609 on 12/2/23.
|
||||
//
|
||||
|
||||
#define VMA_IMPLEMENTATION
|
||||
#include "vma_impl.hpp"
|
||||
@@ -1,24 +0,0 @@
|
||||
//
|
||||
// Created by kj16609 on 12/2/23.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#pragma GCC diagnostic ignored "-Wswitch-enum"
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#pragma GCC diagnostic ignored "-Wredundant-tags"
|
||||
#pragma GCC diagnostic ignored "-Wduplicated-branches"
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
|
||||
#define VMA_STATIC_VULKAN_FUNCTIONS 0
|
||||
#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1
|
||||
#include "vk_mem_alloc.h"
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
Reference in New Issue
Block a user