Fixing a boatload of warnings

This commit is contained in:
Stefan Högler
2021-04-01 16:40:14 +02:00
parent f042480540
commit d5f0fe644f
84 changed files with 496 additions and 407 deletions
+2 -4
View File
@@ -11,11 +11,9 @@
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe",
"intelliSenseMode": "msvc-x64",
"intelliSenseMode": "clang-x64",
"configurationProvider": "ms-vscode.cmake-tools",
"cppStandard": "c++17",
"cppStandard": "c++20",
"browse": {
"path": [
"${VULKAN_SDK}/**"
+3 -1
View File
@@ -104,7 +104,9 @@
"hash_map": "cpp",
"hash_set": "cpp",
"scoped_allocator": "cpp",
"stack": "cpp"
"stack": "cpp",
"coroutine": "cpp",
"*.tcc": "cpp"
},
"cmake.skipConfigureIfCachePresent": false,
"cmake.configureArgs": [
+22 -20
View File
@@ -16,10 +16,11 @@ set(GLFW_ROOT ${EXTERNAL_ROOT}/glfw)
set(JSON_ROOT ${EXTERNAL_ROOT}/json)
set(STB_ROOT ${EXTERNAL_ROOT}/stb)
set(SPIRV_ROOT ${EXTERNAL_ROOT}/SPIRV-Cross)
set(Boost_DEBUG ON)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_LIB_PREFIX lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
@@ -43,13 +44,13 @@ endif()
find_package(Vulkan REQUIRED)
find_package(Boost REQUIRED COMPONENTS serialization)
find_package(Threads REQUIRED)
find_package(assimp REQUIRED)
find_package(Assimp REQUIRED)
find_package(JSON REQUIRED)
find_package(GLFW REQUIRED)
#find_package(SPIRV REQUIRED)
find_package(GLM REQUIRED)
find_package(STB REQUIRED)
find_package(SLang REQUIRED)
find_package(SLANG REQUIRED)
include_directories(${GLM_INCLUDE_DIRS})
include_directories(${STB_INCLUDE_DIRS})
@@ -80,22 +81,23 @@ target_link_libraries(SeeleEngine ${ASSIMP_LIBRARIES})
target_link_libraries(SeeleEngine ${JSON_LIBRARY})
#target_link_libraries(SeeleEngine ${SPIRV_LIBRARIES})
#target_precompile_headers(SeeleEngine
# PRIVATE
# <assert.h>
# <memory>
# <atomic>
# <cstring>
# <iostream>
# <string>
# <thread>
# <functional>
# <filesystem>
# <fstream>
# <mutex>
# <condition_variable>
# <boost/serialization/serialization.hpp>
# <boost/crc.hpp>)
target_precompile_headers(SeeleEngine
PRIVATE
<assert.h>
<atomic>
<condition_variable>
<coroutine>
<cstring>
<filesystem>
<functional>
<fstream>
<iostream>
<memory>
<mutex>
<string>
<thread>
<boost/serialization/serialization.hpp>
<boost/crc.hpp>)
add_subdirectory(src/)
@@ -103,7 +105,7 @@ if(MSVC)
set(_CRT_SECURE_NO_WARNINGS)
# target_compile_options(SeeleEngine PRIVATE /DEBUG:FASTLINK /Zi)
else()
target_compile_options(SeeleEngine PRIVATE -Wall -Wextra -pedantic)
target_compile_options(SeeleEngine PRIVATE -Wall -Wextra -Wno-delete-incomplete -pedantic -fcoroutines)
endif()
add_executable(Seele_unit_tests "")
+4 -3
View File
@@ -48,12 +48,13 @@ else()
/usr/local/include
/sw/include
/opt/local/include
${ASSIMP_ROOT}/include
DOC "The directory where assimp/scene.h resides")
# Find library files
find_library(
ASSIMP_LIBRARY
NAMES assimp
NAMES libassimp${CMAKE_DEBUG_POSTFIX}.so
PATHS
/usr/lib64
/usr/lib
@@ -61,12 +62,12 @@ else()
/usr/local/lib
/sw/lib
/opt/local/lib
${ASSIMP_ROOT}/lib
${ASSIMP_ROOT}/bin
DOC "The Assimp library")
endif()
# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(assimp DEFAULT_MSG ASSIMP_INCLUDE_DIR ASSIMP_LIBRARY ASSIMP_BINARY)
find_package_handle_standard_args(assimp DEFAULT_MSG ASSIMP_INCLUDE_DIR ASSIMP_LIBRARY)
# Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS
if (ASSIMP_FOUND)
+18 -17
View File
@@ -60,7 +60,7 @@ else()
# Find include files
find_path(
GLFW_INCLUDE_DIR
NAMES GLFW/glfw.h
NAMES GLFW/glfw3.h
PATHS
/usr/include
/usr/local/include
@@ -70,22 +70,23 @@ else()
# Find library files
# Try to use static libraries
find_library(
GLFW_LIBRARY
NAMES glfw3
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
${GLFW_ROOT}/lib
DOC "The GLFW library")
#find_library(
# GLFW_LIBRARY
# NAMES glfw3
# PATHS
# /usr/lib64
# /usr/lib
# /usr/local/lib64
# /usr/local/lib
# /sw/lib
# /opt/local/lib
# ${GLFW_ROOT}/lib
# DOC "The GLFW library")
set(GLFW_LIBRARY "")
find_file(
GLFW_BINARY
NAMES glfw3.so
NAMES libglfw${CMAKE_DEBUG_POSTFIX}.so
PATHS
/usr/lib64
/usr/lib
@@ -93,12 +94,12 @@ else()
/usr/local/lib
/sw/lib
/opt/local/lib
${GLFW_ROOT}/lib
${GLFW_ROOT}/src
)
endif()
# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(GLFW DEFAULT_MSG GLFW_INCLUDE_DIR GLFW_LIBRARY GLFW_BINARY)
find_package_handle_standard_args(GLFW DEFAULT_MSG GLFW_INCLUDE_DIR GLFW_BINARY)
# Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS
if (GLFW_FOUND)
+2 -1
View File
@@ -32,12 +32,13 @@ else()
# Find include files
find_path(
GLM_INCLUDE_DIR
NAMES GLM/glfw.h
NAMES glm/glm.hpp
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
${GLM_ROOT}
DOC "The directory where GLM/glm.h resides")
endif()
+10 -7
View File
@@ -49,6 +49,7 @@ if (WIN32)
PATHS
${SLANG_BINARY_PATH})
else()
set(SLANG_BINARY_PATH ${SLANG_ROOT}/bin/linux-${CMAKE_PLATFORM}/release/)
# Find include files
find_path(
SLANG_INCLUDE_DIR
@@ -58,13 +59,15 @@ else()
/usr/local/include
/sw/include
/opt/local/include
${SLANG_ROOT}
DOC "The directory where GL/glfw.h resides")
# Find library files
# Try to use static libraries
set(SLANG_LIBRARY "")
find_library(
SLANG_LIBRARY
NAMES slang.a
SLANG_BINARY
NAMES libslang.so
PATHS
/usr/lib64
/usr/lib
@@ -72,12 +75,12 @@ else()
/usr/local/lib
/sw/lib
/opt/local/lib
${SLANG_ROOT}/lib
${SLANG_BINARY_PATH}
DOC "The SLANG library")
find_file(
SLANG_BINARY
NAMES slang.so
SLANG_GLSLANG
NAMES libslang-glslang.so
PATHS
/usr/lib64
/usr/lib
@@ -85,12 +88,12 @@ else()
/usr/local/lib
/sw/lib
/opt/local/lib
${SLANG_ROOT}/lib
${SLANG_BINARY_PATH}
)
endif()
# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(SLANG DEFAULT_MSG SLANG_INCLUDE_DIR SLANG_LIBRARY SLANG_BINARY SLANG_GLSLANG)
find_package_handle_standard_args(SLANG DEFAULT_MSG SLANG_INCLUDE_DIR SLANG_BINARY SLANG_GLSLANG)
# Define SLANG_LIBRARIES and SLANG_INCLUDE_DIRS
if (SLANG_FOUND)
+1
View File
@@ -38,6 +38,7 @@ else()
/usr/local/include
/sw/include
/opt/local/include
${STB_ROOT}
DOC "The directory where STB/stb.h resides")
endif()
+2 -1
View File
@@ -14,6 +14,7 @@ set(BUILD_SHARED_LIBS ON CACHE INTERNAL "")
add_subdirectory(${ASSIMP_ROOT} ${ASSIMP_ROOT})
target_compile_definitions(assimp PRIVATE _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING)
target_compile_options(assimp PRIVATE -Wno-error)
#-------------BOOST----------------
list(APPEND DEPENDENCIES boost)
@@ -31,7 +32,7 @@ ExternalProject_Add(boost
INSTALL_COMMAND "")
list (APPEND EXTRA_CMAKE_ARGS
-DBoost_NO_SYSTEM_PATHS=ON)
-DBoost_NO_SYSTEM_PATHS=OFF)
#--------------------JSON------------------
list(APPEND DEPENDENCIES nlohmann_json)
Regular → Executable
View File
-1
View File
@@ -1 +0,0 @@
add_subdirectory(x64/)
+3 -5
View File
@@ -1,7 +1,5 @@
#pragma once
#include "MinimalEngine.h"
#include <filesystem>
#include <fstream>
namespace Seele
{
@@ -43,15 +41,15 @@ protected:
std::ifstream& getReadStream();
std::ofstream& getWriteStream();
private:
Status status;
// Path relative to the project root
std::filesystem::path fullPath;
std::filesystem::path parentDir;
std::filesystem::path name;
std::filesystem::path parentDir;
std::filesystem::path extension;
Status status;
uint32 byteSize;
std::ifstream inStream;
std::ofstream outStream;
};
DEFINE_REF(Asset);
DEFINE_REF(Asset)
} // namespace Seele
+1
View File
@@ -7,6 +7,7 @@
#include "Material/Material.h"
#include "Graphics/Graphics.h"
#include "Window/WindowManager.h"
#include "MeshAsset.h"
#include <iostream>
using namespace Seele;
+11 -11
View File
@@ -5,13 +5,13 @@
namespace Seele
{
DECLARE_REF(TextureLoader);
DECLARE_REF(MeshLoader);
DECLARE_REF(MaterialLoader);
DECLARE_REF(TextureAsset);
DECLARE_REF(MeshAsset);
DECLARE_REF(MaterialAsset);
DECLARE_NAME_REF(Gfx, Graphics);
DECLARE_REF(TextureLoader)
DECLARE_REF(MeshLoader)
DECLARE_REF(MaterialLoader)
DECLARE_REF(TextureAsset)
DECLARE_REF(MeshAsset)
DECLARE_REF(MaterialAsset)
DECLARE_NAME_REF(Gfx, Graphics)
class AssetRegistry
{
public:
@@ -26,8 +26,8 @@ public:
static PTextureAsset findTexture(const std::string& filePath);
static PMaterialAsset findMaterial(const std::string& filePath);
static std::ofstream createWriteStream(const std::string& relativePath, std::ios_base::openmode openmode = 0);
static std::ifstream createReadStream(const std::string& relativePath, std::ios_base::openmode openmode = 0);
static std::ofstream createWriteStream(const std::string& relativePath, std::ios_base::openmode openmode = std::ios::out);
static std::ifstream createReadStream(const std::string& relativePath, std::ios_base::openmode openmode = std::ios::in);
private:
static AssetRegistry& get();
@@ -42,8 +42,8 @@ private:
void registerTexture(PTextureAsset texture);
void registerMaterial(PMaterialAsset material);
std::ofstream internalCreateWriteStream(const std::string& relativePath, std::ios_base::openmode openmode = 0);
std::ifstream internalCreateReadStream(const std::string& relaitvePath, std::ios_base::openmode openmode = 0);
std::ofstream internalCreateWriteStream(const std::string& relativePath, std::ios_base::openmode openmode = std::ios::out);
std::ifstream internalCreateReadStream(const std::string& relaitvePath, std::ios_base::openmode openmode = std::ios::in);
std::filesystem::path rootFolder;
Map<std::string, PTextureAsset> textures;
+2 -2
View File
@@ -8,7 +8,7 @@
namespace Seele
{
DECLARE_REF(Material)
DECLARE_NAME_REF(Gfx, Graphics);
DECLARE_NAME_REF(Gfx, Graphics)
class MaterialLoader
{
public:
@@ -21,5 +21,5 @@ private:
List<std::future<void>> futures;
PMaterial placeholderMaterial;
};
DEFINE_REF(MaterialLoader);
DEFINE_REF(MaterialLoader)
} // namespace Seele
+3 -3
View File
@@ -3,8 +3,8 @@
namespace Seele
{
DECLARE_REF(Mesh);
DECLARE_REF(MaterialAsset);
DECLARE_REF(Mesh)
DECLARE_REF(MaterialAsset)
class MeshAsset : public Asset
{
public:
@@ -20,5 +20,5 @@ private:
Array<PMesh> meshes;
Array<PMaterialAsset> referencedMaterials;
};
DEFINE_REF(MeshAsset);
DEFINE_REF(MeshAsset)
} // namespace Seele
+2 -2
View File
@@ -197,7 +197,7 @@ void MeshLoader::convertAssimpARGB(unsigned char* dst, aiTexel* src, uint32 numP
dst[i * 4 + 3] = src[i].a;
}
}
void MeshLoader::loadTextures(const aiScene* scene, Gfx::PGraphics graphics, const std::filesystem::path& meshDirectory)
void MeshLoader::loadTextures(const aiScene* scene, const std::filesystem::path& meshDirectory)
{
for (uint32 i = 0; i < scene->mNumTextures; ++i)
{
@@ -237,7 +237,7 @@ void MeshLoader::import(const std::filesystem::path &path)
const aiScene *scene = importer.ApplyPostProcessing(aiProcess_CalcTangentSpace);
Array<PMaterialAsset> globalMaterials(scene->mNumMaterials);
loadTextures(scene, graphics, path.parent_path());
loadTextures(scene, path.parent_path());
loadMaterials(scene, globalMaterials, graphics);
Array<PMesh> globalMeshes(scene->mNumMeshes);
+6 -6
View File
@@ -9,10 +9,10 @@ struct aiScene;
struct aiTexel;
namespace Seele
{
DECLARE_REF(Mesh);
DECLARE_REF(MeshAsset);
DECLARE_REF(MaterialAsset);
DECLARE_NAME_REF(Gfx, Graphics);
DECLARE_REF(Mesh)
DECLARE_REF(MeshAsset)
DECLARE_REF(MaterialAsset)
DECLARE_NAME_REF(Gfx, Graphics)
class MeshLoader
{
public:
@@ -21,7 +21,7 @@ public:
void importAsset(const std::filesystem::path& filePath);
private:
void loadMaterials(const aiScene* scene, Array<PMaterialAsset>& globalMaterials, Gfx::PGraphics graphics);
void loadTextures(const aiScene* scene, Gfx::PGraphics graphics, const std::filesystem::path& meshPath);
void loadTextures(const aiScene* scene, const std::filesystem::path& meshPath);
void loadGlobalMeshes(const aiScene* scene, Array<PMesh>& globalMeshes, const Array<PMaterialAsset>& materials, Gfx::PGraphics graphics);
void convertAssimpARGB(unsigned char* dst, aiTexel* src, uint32 numPixels);
@@ -29,5 +29,5 @@ private:
List<std::future<void>> futures;
Gfx::PGraphics graphics;
};
DEFINE_REF(MeshLoader);
DEFINE_REF(MeshLoader)
} // namespace Seele
+2 -2
View File
@@ -2,7 +2,7 @@
namespace Seele
{
DECLARE_NAME_REF(Gfx, Texture);
DECLARE_NAME_REF(Gfx, Texture)
class TextureAsset : public Asset
{
public:
@@ -25,5 +25,5 @@ private:
Gfx::PTexture texture;
friend class TextureLoader;
};
DEFINE_REF(TextureAsset);
DEFINE_REF(TextureAsset)
} // namespace Seele
+4 -4
View File
@@ -7,9 +7,9 @@
namespace Seele
{
DECLARE_REF(TextureAsset);
DECLARE_NAME_REF(Gfx, Graphics);
DECLARE_NAME_REF(Gfx, Texture2D);
DECLARE_REF(TextureAsset)
DECLARE_NAME_REF(Gfx, Graphics)
DECLARE_NAME_REF(Gfx, Texture2D)
class TextureLoader
{
public:
@@ -24,5 +24,5 @@ private:
Gfx::PTexture2D placeholderTexture;
PTextureAsset placeholderAsset;
};
DEFINE_REF(TextureLoader);
DEFINE_REF(TextureLoader)
} // namespace Seele
+1 -2
View File
@@ -5,9 +5,8 @@ target_sources(SeeleEngine
main.cpp)
add_subdirectory(Asset/)
add_subdirectory(Arch/)
add_subdirectory(Containers/)
add_subdirectory(Fibers/)
#add_subdirectory(Fibers/)
add_subdirectory(Graphics/)
add_subdirectory(Material/)
add_subdirectory(Math/)
+42 -26
View File
@@ -17,8 +17,8 @@ namespace Seele
{
public:
Array()
: allocated(DEFAULT_ALLOC_SIZE)
, arraySize(0)
: arraySize(0)
, allocated(DEFAULT_ALLOC_SIZE)
{
_data = new T[DEFAULT_ALLOC_SIZE];
assert(_data != nullptr);
@@ -26,7 +26,8 @@ namespace Seele
refreshIterators();
}
Array(size_t size, T value = T())
: allocated(size), arraySize(size)
: arraySize(size)
, allocated(size)
{
_data = new T[size];
assert(_data != nullptr);
@@ -38,7 +39,8 @@ namespace Seele
refreshIterators();
}
Array(std::initializer_list<T> init)
: allocated(init.size()), arraySize(init.size())
: arraySize(init.size())
, allocated(init.size())
{
_data = new T[init.size()];
auto it = init.begin();
@@ -50,7 +52,8 @@ namespace Seele
refreshIterators();
}
Array(const Array &other)
: allocated(other.allocated), arraySize(other.arraySize)
: arraySize(other.arraySize)
, allocated(other.allocated)
{
_data = new T[other.allocated];
assert(_data != nullptr);
@@ -58,7 +61,8 @@ namespace Seele
std::copy(other.begin(), other.end(), beginIt);
}
Array(Array &&other) noexcept
: allocated(std::move(other.allocated)), arraySize(std::move(other.arraySize))
: arraySize(std::move(other.arraySize))
, allocated(std::move(other.allocated))
{
_data = other._data;
other._data = nullptr;
@@ -110,20 +114,16 @@ namespace Seele
class IteratorBase
{
public:
typedef std::forward_iterator_tag iterator_category;
typedef X value_type;
typedef std::ptrdiff_t difference_type;
typedef X &reference;
typedef X *pointer;
using iterator_category = std::random_access_iterator_tag;
using value_type = X;
using difference_type = std::ptrdiff_t;
using reference = X&;
using pointer = X*;
IteratorBase(X *x = nullptr)
: p(x)
{
}
IteratorBase(const IteratorBase &i)
: p(i.p)
{
}
reference operator*() const
{
return *p;
@@ -263,7 +263,7 @@ namespace Seele
T &addUnique(const T &item = T())
{
Iterator it;
if((it = find(item)) != endIt)
if((it = std::move(find(item))) != endIt)
{
return *it;
}
@@ -297,7 +297,10 @@ namespace Seele
{
if (keepOrder)
{
std::memcpy(&_data[index], &_data[index + 1], sizeof(T) * (arraySize - index));
for(uint32 i = index; i < arraySize-1; ++i)
{
_data[i] = std::move(_data[i+1]);
}
}
else
{
@@ -324,7 +327,10 @@ namespace Seele
T *newData = new T[newSize];
assert(newData != nullptr);
allocated = newSize;
std::memcpy(newData, _data, sizeof(T) * arraySize);
for(uint32 i = 0; i < arraySize; ++i)
{
newData[i] = std::move(_data[i]);
}
arraySize = newSize;
delete _data;
_data = newData;
@@ -410,8 +416,9 @@ namespace Seele
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & version;
ar & arraySize;
ar & allocated;
resize(arraySize);
for(size_t i = 0; i < arraySize; ++i)
ar & _data[i];
refreshIterators();
@@ -431,7 +438,7 @@ namespace Seele
class IteratorBase
{
public:
using iterator_category = std::forward_iterator_tag;
using iterator_category = std::random_access_iterator_tag;
using value_type = X;
using difference_type = std::ptrdiff_t;
using reference = X&;
@@ -441,10 +448,6 @@ namespace Seele
: p(x)
{
}
IteratorBase(const IteratorBase &i)
: p(i.p)
{
}
reference operator*() const
{
return *p;
@@ -472,6 +475,18 @@ namespace Seele
++*this;
return tmp;
}
IteratorBase &operator--()
{
p--;
return *this;
}
IteratorBase operator--(int)
{
IteratorBase tmp(*this);
--*this;
return tmp;
}
private:
X *p;
@@ -522,12 +537,12 @@ namespace Seele
}
constexpr reference operator[](size_type index) noexcept
{
assert(index >= 0 && index < N);
assert(index < N);
return _data[index];
}
constexpr const_reference operator[](size_type index) const noexcept
{
assert(index >= 0 && index < N);
assert(index < N);
return _data[index];
}
iterator begin()
@@ -554,6 +569,7 @@ namespace Seele
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & version;
ar & N;
ar & _data;
}
+1 -1
View File
@@ -28,9 +28,9 @@ struct Map
private:
struct Node
{
Pair<K, V> pair;
Node *leftChild;
Node *rightChild;
Pair<K, V> pair;
Node()
: leftChild(nullptr), rightChild(nullptr), pair()
{
+6 -6
View File
@@ -1,6 +1,6 @@
target_sources(SeeleEngine
PRIVATE
Fibers.h
Fibers.cpp
JobQueue.h
JobQueue.cpp)
#target_sources(SeeleEngine
# PRIVATE
# Fibers.h
# Fibers.cpp
# JobQueue.h
# JobQueue.cpp)
+2 -4
View File
@@ -1,8 +1,6 @@
#pragma once
#include "MinimalEngine.h"
#include "JobQueue.h"
#include <atomic>
#include <functional>
namespace Seele
{
@@ -67,14 +65,14 @@ public:
private:
std::atomic_uint64_t count;
};
DEFINE_REF(Counter);
DEFINE_REF(Counter)
struct AwaitCounter
{
PCounter counter;
uint64 target;
JobPriority priority = JobPriority::MEDIUM;
bool await_ready() { return counter->greaterEqual(target); }
void await_suspend(std::coroutine_handle<> h) {
void await_suspend(std::coroutine_handle<>) {
}
void await_resume() {}
};
+1 -2
View File
@@ -1,13 +1,12 @@
#pragma once
#include "MinimalEngine.h"
#include "Containers/List.h"
#include <coroutine>
namespace Seele
{
namespace Fibers
{
class FiberJob;
DECLARE_REF(Counter);
DECLARE_REF(Counter)
enum class JobPriority : size_t
{
HIGH = 0,
+1 -1
View File
@@ -61,6 +61,6 @@ protected:
PShaderCompiler shaderCompiler;
friend class Window;
};
DEFINE_REF(Graphics);
DEFINE_REF(Graphics)
} // namespace Gfx
} // namespace Seele
+23 -13
View File
@@ -6,10 +6,9 @@ namespace Seele
struct GraphicsInitializer
{
const char *windowLayoutFile;
const char *applicationName;
const char *engineName;
void *windowHandle;
const char *windowLayoutFile;
/**
* layers defines the enabled Vulkan layers used in the instance,
* if ENABLE_VALIDATION is defined, standard validation is already enabled
@@ -18,12 +17,23 @@ struct GraphicsInitializer
Array<const char *> layers;
Array<const char *> instanceExtensions;
Array<const char *> deviceExtensions;
void *windowHandle;
GraphicsInitializer()
: applicationName("SeeleEngine"), engineName("SeeleEngine"), layers{"VK_LAYER_KHRONOS_validation"}, instanceExtensions{}, deviceExtensions{"VK_KHR_swapchain"}, windowHandle(nullptr)
: applicationName("SeeleEngine")
, engineName("SeeleEngine")
, layers{"VK_LAYER_KHRONOS_validation"}
, instanceExtensions{}
, deviceExtensions{"VK_KHR_swapchain"}
, windowHandle(nullptr)
{
}
GraphicsInitializer(const GraphicsInitializer &other)
: applicationName(other.applicationName), engineName(other.engineName), layers(other.layers), instanceExtensions(other.instanceExtensions), deviceExtensions(other.deviceExtensions)
: applicationName(other.applicationName)
, engineName(other.engineName)
, layers(other.layers)
, instanceExtensions(other.instanceExtensions)
, deviceExtensions(other.deviceExtensions)
{
}
};
@@ -191,14 +201,14 @@ struct ColorBlendState
float blendConstants[4];
};
} // namespace Gfx
DECLARE_NAME_REF(Gfx, VertexDeclaration);
DECLARE_NAME_REF(Gfx, VertexShader);
DECLARE_NAME_REF(Gfx, ControlShader);
DECLARE_NAME_REF(Gfx, EvaluationShader);
DECLARE_NAME_REF(Gfx, GeometryShader);
DECLARE_NAME_REF(Gfx, FragmentShader);
DECLARE_NAME_REF(Gfx, PipelineLayout);
DECLARE_NAME_REF(Gfx, RenderPass);
DECLARE_NAME_REF(Gfx, VertexDeclaration)
DECLARE_NAME_REF(Gfx, VertexShader)
DECLARE_NAME_REF(Gfx, ControlShader)
DECLARE_NAME_REF(Gfx, EvaluationShader)
DECLARE_NAME_REF(Gfx, GeometryShader)
DECLARE_NAME_REF(Gfx, FragmentShader)
DECLARE_NAME_REF(Gfx, PipelineLayout)
DECLARE_NAME_REF(Gfx, RenderPass)
struct GraphicsPipelineCreateInfo
{
Gfx::PVertexDeclaration vertexDeclaration;
@@ -216,7 +226,7 @@ struct GraphicsPipelineCreateInfo
Gfx::ColorBlendState colorBlend;
GraphicsPipelineCreateInfo()
{
std::memset(this, 0, sizeof(*this));
std::memset((void*)this, 0, sizeof(*this));
topology = Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
rasterizationState.cullMode = Gfx::SE_CULL_MODE_BACK_BIT;
rasterizationState.polygonMode = Gfx::SE_POLYGON_MODE_FILL;
+40 -12
View File
@@ -43,7 +43,7 @@ ShaderCollection& ShaderMap::createShaders(
RenderPassType renderPass,
PMaterial material,
VertexInputType* vertexInput,
bool bPositionOnly)
bool /*bPositionOnly*/)
{
ShaderCollection& collection = shaders.add();
//collection.vertexDeclaration = bPositionOnly ? vertexInput->getPositionDeclaration() : vertexInput->getDeclaration();
@@ -139,8 +139,8 @@ void PipelineLayout::addPushConstants(const SePushConstantRange &pushConstant)
}
QueueOwnedResource::QueueOwnedResource(QueueFamilyMapping mapping, QueueType startQueueType)
: mapping(mapping)
, currentOwner(startQueueType)
: currentOwner(startQueueType)
, mapping(mapping)
{
}
@@ -224,7 +224,9 @@ IndexBuffer::~IndexBuffer()
VertexStream::VertexStream()
{}
VertexStream::VertexStream(uint32 stride, uint32 offset, uint8 instanced)
: stride(stride), instanced(instanced), offset(offset)
: stride(stride)
, offset(offset)
, instanced(instanced)
{
}
VertexStream::~VertexStream()
@@ -294,31 +296,53 @@ RenderCommand::~RenderCommand()
}
RenderTargetLayout::RenderTargetLayout()
: inputAttachments(), colorAttachments(), depthAttachment()
: inputAttachments()
, colorAttachments()
, depthAttachment()
{
}
RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment depthAttachment)
: inputAttachments(), colorAttachments(), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY())
: inputAttachments()
, colorAttachments()
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getSizeX())
, height(depthAttachment->getTexture()->getSizeY())
{
}
RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment colorAttachment, PRenderTargetAttachment depthAttachment)
: inputAttachments(), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY())
: inputAttachments()
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getSizeX())
, height(depthAttachment->getTexture()->getSizeY())
{
colorAttachments.add(colorAttachment);
}
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachmet)
: inputAttachments(), colorAttachments(colorAttachments), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY())
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachment)
: inputAttachments()
, colorAttachments(colorAttachments)
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getSizeX())
, height(depthAttachment->getTexture()->getSizeY())
{
}
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> inputAttachments, Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachment)
: inputAttachments(inputAttachments), colorAttachments(colorAttachments), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY())
: inputAttachments(inputAttachments)
, colorAttachments(colorAttachments)
, depthAttachment(depthAttachment)
, width(depthAttachment->getTexture()->getSizeX())
, height(depthAttachment->getTexture()->getSizeY())
{
}
Window::Window(const WindowCreateInfo &createInfo)
: sizeX(createInfo.width), sizeY(createInfo.height), bFullscreen(createInfo.bFullscreen), title(createInfo.title), pixelFormat(createInfo.pixelFormat), samples(createInfo.numSamples)
: sizeX(createInfo.width)
, sizeY(createInfo.height)
, bFullscreen(createInfo.bFullscreen)
, title(createInfo.title)
, pixelFormat(createInfo.pixelFormat)
, samples(createInfo.numSamples)
{
}
@@ -327,7 +351,11 @@ Window::~Window()
}
Viewport::Viewport(PWindow owner, const ViewportCreateInfo &viewportInfo)
: sizeX(viewportInfo.sizeX), sizeY(viewportInfo.sizeY), offsetX(viewportInfo.offsetX), offsetY(viewportInfo.offsetY), owner(owner)
: sizeX(viewportInfo.sizeX)
, sizeY(viewportInfo.sizeY)
, offsetX(viewportInfo.offsetX)
, offsetY(viewportInfo.offsetY)
, owner(owner)
{
}
+48 -41
View File
@@ -20,7 +20,7 @@ class VertexInputType;
DECLARE_REF(Material)
namespace Gfx
{
DECLARE_REF(Graphics);
DECLARE_REF(Graphics)
class SamplerState
{
@@ -29,11 +29,11 @@ public:
{
}
};
DEFINE_REF(SamplerState);
DEFINE_REF(SamplerState)
class Shader
{};
DEFINE_REF(Shader);
DEFINE_REF(Shader)
class VertexShader
{
@@ -41,7 +41,7 @@ public:
VertexShader() {}
virtual ~VertexShader() {}
};
DEFINE_REF(VertexShader);
DEFINE_REF(VertexShader)
class ControlShader
{
public:
@@ -52,28 +52,28 @@ public:
protected:
uint32 numPatchPoints;
};
DEFINE_REF(ControlShader);
DEFINE_REF(ControlShader)
class EvaluationShader
{
public:
EvaluationShader() {}
virtual ~EvaluationShader() {}
};
DEFINE_REF(EvaluationShader);
DEFINE_REF(EvaluationShader)
class GeometryShader
{
public:
GeometryShader() {}
virtual ~GeometryShader() {}
};
DEFINE_REF(GeometryShader);
DEFINE_REF(GeometryShader)
class FragmentShader
{
public:
FragmentShader() {}
virtual ~FragmentShader() {}
};
DEFINE_REF(FragmentShader);
DEFINE_REF(FragmentShader)
//Uniquely identifies a permutation of shaders
//using the type parameters used to generate it
@@ -138,7 +138,7 @@ public:
private:
Array<ShaderCollection> shaders;
};
DEFINE_REF(ShaderMap);
DEFINE_REF(ShaderMap)
class ComputeShader
{
@@ -146,7 +146,7 @@ public:
ComputeShader() {}
virtual ~ComputeShader() {}
};
DEFINE_REF(ComputeShader);
DEFINE_REF(ComputeShader)
class DescriptorBinding
{
@@ -171,9 +171,9 @@ public:
uint32_t descriptorCount;
SeShaderStageFlags shaderStages;
};
DEFINE_REF(DescriptorBinding);
DEFINE_REF(DescriptorBinding)
DECLARE_REF(DescriptorSet);
DECLARE_REF(DescriptorSet)
class DescriptorAllocator
{
public:
@@ -182,10 +182,10 @@ public:
virtual void allocateDescriptorSet(PDescriptorSet &descriptorSet) = 0;
virtual void reset() = 0;
};
DEFINE_REF(DescriptorAllocator);
DECLARE_REF(UniformBuffer);
DECLARE_REF(StructuredBuffer);
DECLARE_REF(Texture);
DEFINE_REF(DescriptorAllocator)
DECLARE_REF(UniformBuffer)
DECLARE_REF(StructuredBuffer)
DECLARE_REF(Texture)
class DescriptorSet
{
public:
@@ -199,7 +199,7 @@ public:
virtual uint32 getSetIndex() const = 0;
};
DEFINE_REF(DescriptorSet);
DEFINE_REF(DescriptorSet)
class DescriptorLayout
{
@@ -209,10 +209,17 @@ public:
{
}
virtual ~DescriptorLayout() {}
void operator=(const DescriptorLayout &other)
DescriptorLayout& operator=(const DescriptorLayout &other)
{
descriptorBindings.resize(other.descriptorBindings.size());
std::memcpy(descriptorBindings.data(), other.descriptorBindings.data(), sizeof(DescriptorLayout) * descriptorBindings.size());
if(this != &other)
{
descriptorBindings.resize(other.descriptorBindings.size());
for(uint32 i = 0; i < descriptorBindings.size(); ++i)
{
descriptorBindings[i] = other.descriptorBindings[i];
}
}
return *this;
}
virtual void create() = 0;
virtual void addDescriptorBinding(uint32 binding, SeDescriptorType type, uint32 arrayCount = 1);
@@ -228,7 +235,7 @@ protected:
friend class PipelineLayout;
friend class DescriptorAllocator;
};
DEFINE_REF(DescriptorLayout);
DEFINE_REF(DescriptorLayout)
class PipelineLayout
{
public:
@@ -244,7 +251,7 @@ protected:
Array<PDescriptorLayout> descriptorSetLayouts;
Array<SePushConstantRange> pushConstants;
};
DEFINE_REF(PipelineLayout);
DEFINE_REF(PipelineLayout)
struct QueueFamilyMapping
{
@@ -290,7 +297,7 @@ protected:
Gfx::QueueType currentOwner;
QueueFamilyMapping mapping;
};
DEFINE_REF(QueueOwnedResource);
DEFINE_REF(QueueOwnedResource)
// IMPORTANT!!
// WHEN DERIVING FROM ANY Gfx:: BASE CLASSES WITH MULTIPLE INHERITANCE
@@ -337,7 +344,7 @@ protected:
// Inherited via QueueOwnedResource
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
};
DEFINE_REF(UniformBuffer);
DEFINE_REF(UniformBuffer)
class VertexBuffer : public Buffer
{
@@ -360,7 +367,7 @@ protected:
uint32 numVertices;
uint32 vertexSize;
};
DEFINE_REF(VertexBuffer);
DEFINE_REF(VertexBuffer)
class IndexBuffer : public Buffer
{
@@ -382,7 +389,7 @@ protected:
Gfx::SeIndexType indexType;
uint32 numIndices;
};
DEFINE_REF(IndexBuffer);
DEFINE_REF(IndexBuffer)
class StructuredBuffer : public Buffer
{
@@ -393,7 +400,7 @@ protected:
// Inherited via QueueOwnedResource
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
};
DEFINE_REF(StructuredBuffer);
DEFINE_REF(StructuredBuffer)
class VertexStream
{
@@ -410,7 +417,7 @@ public:
Array<VertexElement> vertexDescription;
uint8 instanced;
};
DEFINE_REF(VertexStream);
DEFINE_REF(VertexStream)
class VertexDeclaration
{
public:
@@ -420,7 +427,7 @@ public:
static PVertexDeclaration createDeclaration(PGraphics graphics, const Array<VertexElement>& elementList);
private:
};
DEFINE_REF(VertexDeclaration);
DEFINE_REF(VertexDeclaration)
class GraphicsPipeline
{
public:
@@ -429,10 +436,10 @@ public:
const GraphicsPipelineCreateInfo& getCreateInfo() const {return createInfo;}
PPipelineLayout getPipelineLayout() const { return layout; }
protected:
PPipelineLayout layout;
GraphicsPipelineCreateInfo createInfo;
PPipelineLayout layout;
};
DEFINE_REF(GraphicsPipeline);
DEFINE_REF(GraphicsPipeline)
// IMPORTANT!!
// WHEN DERIVING FROM ANY Gfx:: BASE CLASSES WITH MULTIPLE INHERITANCE
@@ -455,7 +462,7 @@ protected:
// Inherited via QueueOwnedResource
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
};
DEFINE_REF(Texture);
DEFINE_REF(Texture)
class Texture2D : public Texture
{
public:
@@ -471,9 +478,9 @@ protected:
//Inherited via QueueOwnedResource
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
};
DEFINE_REF(Texture2D);
DEFINE_REF(Texture2D)
DECLARE_REF(Viewport);
DECLARE_REF(Viewport)
class RenderCommand
{
public:
@@ -488,7 +495,7 @@ public:
virtual void bindIndexBuffer(Gfx::PIndexBuffer indexBuffer) = 0;
virtual void draw(const MeshBatchElement& data) = 0;
};
DEFINE_REF(RenderCommand);
DEFINE_REF(RenderCommand)
class Window
{
@@ -521,7 +528,7 @@ protected:
SeFormat pixelFormat;
uint32 samples;
};
DEFINE_REF(Window);
DEFINE_REF(Window)
class Viewport
{
@@ -542,7 +549,7 @@ protected:
uint32 offsetY;
PWindow owner;
};
DEFINE_REF(Viewport);
DEFINE_REF(Viewport)
class RenderTargetAttachment
{
@@ -583,7 +590,7 @@ protected:
SeAttachmentLoadOp stencilLoadOp;
SeAttachmentStoreOp stencilStoreOp;
};
DEFINE_REF(RenderTargetAttachment);
DEFINE_REF(RenderTargetAttachment)
class SwapchainAttachment : public RenderTargetAttachment
{
@@ -617,7 +624,7 @@ public:
private:
PWindow owner;
};
DEFINE_REF(SwapchainAttachment);
DEFINE_REF(SwapchainAttachment)
class RenderTargetLayout
{
@@ -633,7 +640,7 @@ public:
uint32 width;
uint32 height;
};
DEFINE_REF(RenderTargetLayout);
DEFINE_REF(RenderTargetLayout)
class RenderPass
{
@@ -645,6 +652,6 @@ public:
protected:
PRenderTargetLayout layout;
};
DEFINE_REF(RenderPass);
DEFINE_REF(RenderPass)
} // namespace Gfx
} // namespace Seele
+2 -2
View File
@@ -3,8 +3,8 @@
using namespace Seele;
Mesh::Mesh(PVertexShaderInput vertexInput, Gfx::PIndexBuffer indexBuffer)
: vertexInput(vertexInput)
, indexBuffer(indexBuffer)
: indexBuffer(indexBuffer)
, vertexInput(vertexInput)
{
}
+4 -6
View File
@@ -42,7 +42,7 @@ struct MeshDescription
//TODO declaration
}
};*/
DECLARE_REF(MaterialAsset);
DECLARE_REF(MaterialAsset)
class Mesh
{
public:
@@ -55,11 +55,9 @@ public:
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
void serialize(Archive&, const unsigned int)
{
//ar & referencedMaterial->getFullPath();
//TODO:
}
}
};
DEFINE_REF(Mesh);
DEFINE_REF(Mesh)
} // namespace Seele
+8 -8
View File
@@ -2,11 +2,11 @@
namespace Seele
{
DECLARE_REF(MaterialAsset);
DECLARE_REF(VertexShaderInput);
DECLARE_NAME_REF(Gfx, VertexBuffer);
DECLARE_NAME_REF(Gfx, IndexBuffer);
DECLARE_NAME_REF(Gfx, UniformBuffer);
DECLARE_REF(MaterialAsset)
DECLARE_REF(VertexShaderInput)
DECLARE_NAME_REF(Gfx, VertexBuffer)
DECLARE_NAME_REF(Gfx, IndexBuffer)
DECLARE_NAME_REF(Gfx, UniformBuffer)
struct MeshBatchElement
{
public:
@@ -32,13 +32,13 @@ public:
MeshBatchElement()
: uniformBuffer(nullptr)
, indexBuffer(nullptr)
, indirectArgsBuffer(nullptr)
, firstIndex(0)
, numPrimitives(0)
, numInstances(1)
, baseVertexIndex(0)
, minVertexIndex(0)
, maxVertexIndex(0)
, indirectArgsBuffer(nullptr)
{}
};
struct MeshBatch
@@ -81,13 +81,13 @@ struct MeshBatch
, isBackfaceCullingDisabled(false)
, isCastingShadow(true)
, useWireframe(false)
, topology(Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST)
, vertexInput(nullptr)
, material(nullptr)
, topology(Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST)
{
}
};
DECLARE_REF(PrimitiveComponent);
DECLARE_REF(PrimitiveComponent)
struct StaticMeshBatch : public MeshBatch
{
uint32 index;
+2 -2
View File
@@ -26,10 +26,10 @@ void BasePassMeshProcessor::addMeshBatch(
Gfx::PPipelineLayout pipelineLayout,
Gfx::PDescriptorLayout primitiveLayout,
Array<Gfx::PDescriptorSet>& descriptorSets,
int32 staticMeshId)
int32 /*staticMeshId*/)
{
const PMaterialAsset material = batch.material;
const Gfx::MaterialShadingModel shadingModel = material->getShadingModel();
//const Gfx::MaterialShadingModel shadingModel = material->getShadingModel();
const PVertexShaderInput vertexInput = batch.vertexInput;
+10 -10
View File
@@ -24,13 +24,13 @@ private:
Array<Gfx::PRenderCommand> renderCommands;
Array<Gfx::PRenderCommand> cachedCommandBuffers;
Array<Gfx::PDescriptorSet> cachedPrimitiveSets;
uint32 cachedPrimitiveIndex;
Gfx::PViewport target;
uint8 translucentBasePass;
uint32 cachedPrimitiveIndex;
};
DEFINE_REF(BasePassMeshProcessor);
DECLARE_REF(CameraActor);
DECLARE_REF(CameraComponent);
DEFINE_REF(BasePassMeshProcessor)
DECLARE_REF(CameraActor)
DECLARE_REF(CameraComponent)
class BasePass
{
public:
@@ -54,8 +54,12 @@ private:
Gfx::PRenderPass renderPass;
Gfx::PTexture2D depthBuffer;
const PScene scene;
UPBasePassMeshProcessor processor;
const PScene scene;
Gfx::PGraphics graphics;
Gfx::PViewport viewport;
Array<Gfx::PDescriptorSet> descriptorSets;
PCameraComponent source;
Gfx::PPipelineLayout basePassLayout;
// Set 0: Light environment
Gfx::PDescriptorLayout lightLayout;
@@ -68,10 +72,6 @@ private:
// Set 3: primitive scene data
Gfx::PDescriptorLayout primitiveLayout;
Gfx::PUniformBuffer primitiveUniformBuffer;
Array<Gfx::PDescriptorSet> descriptorSets;
Gfx::PGraphics graphics;
PCameraComponent source;
Gfx::PViewport viewport;
};
DEFINE_REF(BasePass);
DEFINE_REF(BasePass)
} // namespace Seele
+3 -3
View File
@@ -3,8 +3,8 @@
namespace Seele
{
DECLARE_REF(Material);
DECLARE_NAME_REF(Gfx, Graphics);
DECLARE_REF(Material)
DECLARE_NAME_REF(Gfx, Graphics)
namespace Gfx
{
class ShaderCompiler
@@ -17,6 +17,6 @@ private:
Array<PMaterial> pendingCompiles;
PGraphics graphics;
};
DEFINE_REF(ShaderCompiler);
DEFINE_REF(ShaderCompiler)
} // namespace Gfx
} // namespace Seele
@@ -66,4 +66,4 @@ void StaticMeshVertexInput::setData(StaticMeshDataType&& data)
this->data = std::move(data);
}
IMPLEMENT_VERTEX_INPUT_TYPE(StaticMeshVertexInput, "StaticMeshVertexInput");
IMPLEMENT_VERTEX_INPUT_TYPE(StaticMeshVertexInput, "StaticMeshVertexInput")
+2 -2
View File
@@ -16,7 +16,7 @@ struct StaticMeshDataType
};
class StaticMeshVertexInput : public VertexShaderInput
{
DECLARE_VERTEX_INPUT_TYPE(StaticMeshVertexInput);
DECLARE_VERTEX_INPUT_TYPE(StaticMeshVertexInput)
public:
StaticMeshVertexInput(std::string name);
virtual ~StaticMeshVertexInput();
@@ -25,5 +25,5 @@ public:
private:
StaticMeshDataType data;
};
DEFINE_REF(StaticMeshVertexInput);
DEFINE_REF(StaticMeshVertexInput)
}
+3 -3
View File
@@ -111,13 +111,13 @@ private:
VertexInputType* inputClass::getType() const { return &staticType; }
struct MeshDescription;
DECLARE_REF(VertexShaderInput);
DECLARE_REF(VertexShaderInput)
class VertexShaderInput
{
public:
VertexShaderInput(std::string name);
virtual ~VertexShaderInput();
virtual void init(Gfx::PGraphics graphics) {};
virtual void init(Gfx::PGraphics) {}
void getStreams(VertexInputStreamArray& outVertexStreams) const;
void getPositionOnlyStream(VertexInputStreamArray& outVertexStreams) const;
virtual bool supportsTesselation() { return false; }
@@ -158,5 +158,5 @@ protected:
Gfx::PVertexDeclaration positionDeclaration;
std::string name;
};
DEFINE_REF(VertexShaderInput);
DEFINE_REF(VertexShaderInput)
} // namespace Seele
+13 -3
View File
@@ -5,7 +5,11 @@
using namespace Seele::Vulkan;
SubAllocation::SubAllocation(Allocation *owner, VkDeviceSize allocatedOffset, VkDeviceSize size, VkDeviceSize alignedOffset, VkDeviceSize allocatedSize)
: owner(owner), size(size), allocatedOffset(allocatedOffset), alignedOffset(alignedOffset), allocatedSize(allocatedSize)
: owner(owner)
, size(size)
, allocatedOffset(allocatedOffset)
, alignedOffset(alignedOffset)
, allocatedSize(allocatedSize)
{
}
@@ -41,7 +45,13 @@ void SubAllocation::invalidateMemory()
Allocation::Allocation(PGraphics graphics, Allocator *allocator, VkDeviceSize size, uint8 memoryTypeIndex,
VkMemoryPropertyFlags properties, VkMemoryDedicatedAllocateInfo *dedicatedInfo)
: device(graphics->getDevice()), allocator(allocator), bytesAllocated(0), bytesUsed(0), readable(properties & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT), properties(properties), memoryTypeIndex(memoryTypeIndex)
: device(graphics->getDevice())
, allocator(allocator)
, bytesAllocated(0)
, bytesUsed(0)
, readable(properties & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
, properties(properties)
, memoryTypeIndex(memoryTypeIndex)
{
VkMemoryAllocateInfo allocInfo =
init::MemoryAllocateInfo();
@@ -224,7 +234,7 @@ PSubAllocation Allocator::allocate(const VkMemoryRequirements2 &memRequirements2
}
// no suitable allocations found, allocate new block
PAllocation newAllocation = new Allocation(graphics, this, (requirements.size > MemoryBlockSize) ? requirements.size : MemoryBlockSize, memoryTypeIndex, properties, nullptr);
PAllocation newAllocation = new Allocation(graphics, this, (requirements.size > MemoryBlockSize) ? requirements.size : (VkDeviceSize)MemoryBlockSize, memoryTypeIndex, properties, nullptr);
heaps[heapIndex].allocations.add(newAllocation);
return newAllocation->getSuballocation(requirements.size, requirements.alignment);
}
+11 -11
View File
@@ -9,7 +9,7 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(Graphics);
DECLARE_REF(Graphics)
class Allocation;
class Allocator;
class SubAllocation
@@ -33,14 +33,14 @@ public:
private:
Allocation *owner;
VkDeviceSize allocatedOffset;
VkDeviceSize size;
VkDeviceSize allocatedOffset;
VkDeviceSize alignedOffset;
VkDeviceSize allocatedSize;
friend class Allocation;
friend class Allocator;
};
DEFINE_REF(SubAllocation);
DEFINE_REF(SubAllocation)
class Allocation
{
public:
@@ -94,24 +94,24 @@ public:
}
private:
Allocator *allocator;
VkDevice device;
VkDeviceMemory allocatedMemory;
Allocator *allocator;
VkDeviceSize bytesAllocated;
VkDeviceSize bytesUsed;
VkMemoryPropertyFlags properties;
VkDeviceMemory allocatedMemory;
Map<VkDeviceSize, SubAllocation *> activeAllocations;
Map<VkDeviceSize, PSubAllocation> freeRanges;
std::mutex lock;
void *mappedPointer;
uint8 memoryTypeIndex;
uint8 isDedicated : 1;
uint8 canMap : 1;
uint8 isMapped : 1;
uint8 readable : 1;
VkMemoryPropertyFlags properties;
uint8 memoryTypeIndex;
friend class Allocator;
};
DEFINE_REF(Allocation);
DEFINE_REF(Allocation)
class Allocator
{
@@ -159,7 +159,7 @@ private:
PGraphics graphics;
VkPhysicalDeviceMemoryProperties memProperties;
};
DEFINE_REF(Allocator);
DEFINE_REF(Allocator)
class StagingBuffer
{
@@ -207,7 +207,7 @@ private:
uint8 bReadable;
friend class StagingManager;
};
DEFINE_REF(StagingBuffer);
DEFINE_REF(StagingBuffer)
class StagingManager
{
@@ -225,6 +225,6 @@ private:
Array<StagingBuffer *> activeBuffers;
std::mutex lock;
};
DEFINE_REF(StagingManager);
DEFINE_REF(StagingManager)
} // namespace Vulkan
} // namespace Seele
+12 -9
View File
@@ -17,7 +17,10 @@ struct PendingBuffer
static Map<ShaderBuffer *, PendingBuffer> pendingBuffers;
ShaderBuffer::ShaderBuffer(PGraphics graphics, uint32 size, VkBufferUsageFlags usage, Gfx::QueueType queueType)
: graphics(graphics), currentBuffer(0), size(size), currentOwner(queueType)
: graphics(graphics)
, currentBuffer(0)
, size(size)
, currentOwner(queueType)
{
if (usage & VK_BUFFER_USAGE_INDEX_BUFFER_BIT ||
usage & VK_BUFFER_USAGE_VERTEX_BUFFER_BIT ||
@@ -242,8 +245,8 @@ void ShaderBuffer::unlock()
}
UniformBuffer::UniformBuffer(PGraphics graphics, const UniformBufferCreateInfo &createInfo)
: Vulkan::ShaderBuffer(graphics, createInfo.resourceData.size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, createInfo.resourceData.owner)
, Gfx::UniformBuffer(graphics->getFamilyMapping(), createInfo.resourceData)
: Gfx::UniformBuffer(graphics->getFamilyMapping(), createInfo.resourceData)
, Vulkan::ShaderBuffer(graphics, createInfo.resourceData.size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, createInfo.resourceData.owner)
, dedicatedStagingBuffer(nullptr)
{
if(createInfo.bDynamic)
@@ -313,8 +316,8 @@ VkAccessFlags UniformBuffer::getDestAccessMask()
}
StructuredBuffer::StructuredBuffer(PGraphics graphics, const BulkResourceData &resourceData)
: Vulkan::ShaderBuffer(graphics, resourceData.size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, resourceData.owner)
, Gfx::StructuredBuffer(graphics->getFamilyMapping(), resourceData.owner)
: Gfx::StructuredBuffer(graphics->getFamilyMapping(), resourceData.owner)
, Vulkan::ShaderBuffer(graphics, resourceData.size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, resourceData.owner)
{
if (resourceData.data != nullptr)
{
@@ -349,8 +352,8 @@ VkAccessFlags StructuredBuffer::getDestAccessMask()
}
VertexBuffer::VertexBuffer(PGraphics graphics, const VertexBufferCreateInfo &resourceData)
: Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, resourceData.resourceData.owner)
, Gfx::VertexBuffer(graphics->getFamilyMapping(), resourceData.numVertices, resourceData.vertexSize, resourceData.resourceData.owner)
: Gfx::VertexBuffer(graphics->getFamilyMapping(), resourceData.numVertices, resourceData.vertexSize, resourceData.resourceData.owner)
, Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, resourceData.resourceData.owner)
{
if (resourceData.resourceData.data != nullptr)
{
@@ -385,8 +388,8 @@ VkAccessFlags VertexBuffer::getDestAccessMask()
}
IndexBuffer::IndexBuffer(PGraphics graphics, const IndexBufferCreateInfo &resourceData)
: Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, resourceData.resourceData.owner)
, Gfx::IndexBuffer(graphics->getFamilyMapping(), resourceData.resourceData.size, resourceData.indexType, resourceData.resourceData.owner)
: Gfx::IndexBuffer(graphics->getFamilyMapping(), resourceData.resourceData.size, resourceData.indexType, resourceData.resourceData.owner)
, Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, resourceData.resourceData.owner)
{
if (resourceData.resourceData.data != nullptr)
{
@@ -23,7 +23,11 @@ CmdBufferBase::~CmdBufferBase()
}
CmdBuffer::CmdBuffer(PGraphics graphics, VkCommandPool cmdPool, PCommandBufferManager manager)
: CmdBufferBase(graphics, cmdPool), renderPass(nullptr), framebuffer(nullptr), subpassIndex(0), manager(manager)
: CmdBufferBase(graphics, cmdPool)
, manager(manager)
, renderPass(nullptr)
, framebuffer(nullptr)
, subpassIndex(0)
{
VkCommandBufferAllocateInfo allocInfo =
init::CommandBufferAllocateInfo(cmdPool,
@@ -7,8 +7,8 @@ namespace Seele
struct VertexInputStream;
namespace Vulkan
{
DECLARE_REF(RenderPass);
DECLARE_REF(Framebuffer);
DECLARE_REF(RenderPass)
DECLARE_REF(Framebuffer)
class CmdBufferBase
{
public:
@@ -27,10 +27,10 @@ protected:
VkCommandBuffer handle;
VkCommandPool owner;
};
DEFINE_REF(CmdBufferBase);
DEFINE_REF(CmdBufferBase)
DECLARE_REF(SecondaryCmdBuffer);
DECLARE_REF(CommandBufferManager);
DECLARE_REF(SecondaryCmdBuffer)
DECLARE_REF(CommandBufferManager)
class CmdBuffer : public CmdBufferBase
{
public:
@@ -68,10 +68,10 @@ private:
friend class CommandBufferManager;
friend class Queue;
};
DEFINE_REF(CmdBuffer);
DEFINE_REF(CmdBuffer)
DECLARE_REF(GraphicsPipeline);
DECLARE_REF(DescriptorSet);
DECLARE_REF(GraphicsPipeline)
DECLARE_REF(DescriptorSet)
class SecondaryCmdBuffer : public Gfx::RenderCommand, public CmdBufferBase
{
public:
@@ -94,7 +94,7 @@ private:
Array<PDescriptorSet> boundDescriptors;
friend class CmdBuffer;
};
DEFINE_REF(SecondaryCmdBuffer);
DEFINE_REF(SecondaryCmdBuffer)
class CommandBufferManager
{
@@ -119,6 +119,6 @@ private:
std::mutex allocatedBufferLock;
Array<PCmdBuffer> allocatedBuffers;
};
DEFINE_REF(CommandBufferManager);
DEFINE_REF(CommandBufferManager)
} // namespace Vulkan
} // namespace Seele
@@ -218,7 +218,9 @@ void DescriptorSet::writeChanges()
}
DescriptorAllocator::DescriptorAllocator(PGraphics graphics, DescriptorLayout &layout)
: layout(layout), graphics(graphics), currentCachedIndex(0)
: graphics(graphics)
, layout(layout)
, currentCachedIndex(0)
{
std::memset(&cachedHandles, 0, sizeof(cachedHandles));
@@ -5,7 +5,7 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(Graphics);
DECLARE_REF(Graphics)
class DescriptorLayout : public Gfx::DescriptorLayout
{
public:
@@ -24,12 +24,14 @@ private:
VkDescriptorSetLayout layoutHandle;
friend class DescriptorAllocator;
};
DEFINE_REF(DescriptorLayout);
DEFINE_REF(DescriptorLayout)
class PipelineLayout : public Gfx::PipelineLayout
{
public:
PipelineLayout(PGraphics graphics)
: graphics(graphics), layoutHash(0), layoutHandle(VK_NULL_HANDLE)
: graphics(graphics)
, layoutHash(0)
, layoutHandle(VK_NULL_HANDLE)
{
}
virtual ~PipelineLayout();
@@ -46,11 +48,11 @@ public:
private:
Array<VkDescriptorSetLayout> vulkanDescriptorLayouts;
PGraphics graphics;
uint32 layoutHash;
VkPipelineLayout layoutHandle;
PGraphics graphics;
};
DEFINE_REF(PipelineLayout);
DEFINE_REF(PipelineLayout)
class DescriptorAllocator : public Gfx::DescriptorAllocator
{
@@ -71,13 +73,13 @@ public:
private:
PGraphics graphics;
DescriptorLayout &layout;
uint32 currentCachedIndex;
const static int maxSets = 512;
VkDescriptorSet cachedHandles[maxSets];
uint32 currentCachedIndex;
VkDescriptorPool poolHandle;
DescriptorLayout &layout;
};
DEFINE_REF(DescriptorAllocator);
DEFINE_REF(DescriptorAllocator)
class DescriptorSet : public Gfx::DescriptorSet
{
@@ -119,12 +121,12 @@ private:
// would not work anyways, so casts should be safe
Array<void*> cachedData[Gfx::numFramesBuffered];
VkDescriptorSet setHandle[Gfx::numFramesBuffered];
PGraphics graphics;
PDescriptorAllocator owner;
PCmdBuffer currentlyBound;
PGraphics graphics;
friend class DescriptorAllocator;
};
DEFINE_REF(DescriptorSet);
DEFINE_REF(DescriptorSet)
} // namespace Vulkan
} // namespace Seele
@@ -5,7 +5,7 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(RenderPass);
DECLARE_REF(RenderPass)
struct FramebufferDescription
{
VkImageView inputAttachments[16];
@@ -35,6 +35,6 @@ private:
Gfx::PRenderTargetLayout layout;
PRenderPass renderPass;
};
DEFINE_REF(Framebuffer);
DEFINE_REF(Framebuffer)
} // namespace Vulkan
} // namespace Seele
@@ -10,12 +10,15 @@
#include "VulkanDescriptorSets.h"
#include "VulkanShader.h"
#include "Graphics/GraphicsResources.h"
#include <glfw/glfw3.h>
#include <GLFW/glfw3.h>
using namespace Seele::Vulkan;
Graphics::Graphics()
: callback(VK_NULL_HANDLE), handle(VK_NULL_HANDLE), instance(VK_NULL_HANDLE), physicalDevice(VK_NULL_HANDLE)
: instance(VK_NULL_HANDLE)
, handle(VK_NULL_HANDLE)
, physicalDevice(VK_NULL_HANDLE)
, callback(VK_NULL_HANDLE)
{
}
@@ -161,7 +164,7 @@ Gfx::PGraphicsPipeline Graphics::createGraphicsPipeline(const GraphicsPipelineCr
return pipeline;
}
Gfx::PSamplerState Graphics::createSamplerState(const SamplerCreateInfo& createInfo)
Gfx::PSamplerState Graphics::createSamplerState(const SamplerCreateInfo&)
{
PSamplerState sampler = new SamplerState(); // TODO: proper sampler creation
VkSamplerCreateInfo vkInfo =
+9 -9
View File
@@ -6,13 +6,13 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(Allocator);
DECLARE_REF(StagingManager);
DECLARE_REF(CommandBufferManager);
DECLARE_REF(Queue);
DECLARE_REF(Framebuffer);
DECLARE_REF(RenderCommand);
DECLARE_REF(PipelineCache);
DECLARE_REF(Allocator)
DECLARE_REF(StagingManager)
DECLARE_REF(CommandBufferManager)
DECLARE_REF(Queue)
DECLARE_REF(Framebuffer)
DECLARE_REF(RenderCommand)
DECLARE_REF(PipelineCache)
class Graphics : public Gfx::Graphics
{
public:
@@ -72,9 +72,9 @@ protected:
void pickPhysicalDevice();
void createDevice(GraphicsInitializer initInfo);
VkInstance instance;
VkDevice handle;
VkPhysicalDevice physicalDevice;
VkInstance instance;
PQueue graphicsQueue;
PQueue computeQueue;
@@ -96,6 +96,6 @@ protected:
friend class Window;
};
DEFINE_REF(Graphics);
DEFINE_REF(Graphics)
} // namespace Vulkan
} // namespace Seele
@@ -72,7 +72,8 @@ Semaphore::~Semaphore()
}
Fence::Fence(PGraphics graphics)
: graphics(graphics), signaled(false)
: graphics(graphics)
, signaled(false)
{
VkFenceCreateInfo info =
init::FenceCreateInfo(0);
@@ -8,11 +8,11 @@ namespace Seele
namespace Vulkan
{
DECLARE_REF(DescriptorAllocator);
DECLARE_REF(CommandBufferManager);
DECLARE_REF(CmdBuffer);
DECLARE_REF(Graphics);
DECLARE_REF(SubAllocation);
DECLARE_REF(DescriptorAllocator)
DECLARE_REF(CommandBufferManager)
DECLARE_REF(CmdBuffer)
DECLARE_REF(Graphics)
DECLARE_REF(SubAllocation)
class Semaphore
{
public:
@@ -27,7 +27,7 @@ private:
VkSemaphore handle;
PGraphics graphics;
};
DEFINE_REF(Semaphore);
DEFINE_REF(Semaphore)
class Fence
{
@@ -47,11 +47,11 @@ public:
}
private:
PGraphics graphics;
bool signaled;
VkFence fence;
PGraphics graphics;
};
DEFINE_REF(Fence);
DEFINE_REF(Fence)
class VertexDeclaration : public Gfx::VertexDeclaration
{
@@ -62,7 +62,7 @@ public:
virtual ~VertexDeclaration();
private:
};
DEFINE_REF(VertexDeclaration);
DEFINE_REF(VertexDeclaration)
class QueueOwnedResourceDeletion
{
@@ -112,12 +112,12 @@ protected:
VkBuffer buffer;
PSubAllocation allocation;
};
BufferAllocation buffers[Gfx::numFramesBuffered];
uint32 numBuffers;
PGraphics graphics;
uint32 currentBuffer;
uint32 size;
PGraphics graphics;
Gfx::QueueType currentOwner;
BufferAllocation buffers[Gfx::numFramesBuffered];
uint32 numBuffers;
void executeOwnershipBarrier(Gfx::QueueType newOwner);
virtual void requestOwnershipTransfer(Gfx::QueueType newOwner) = 0;
@@ -125,9 +125,9 @@ protected:
virtual VkAccessFlags getSourceAccessMask() = 0;
virtual VkAccessFlags getDestAccessMask() = 0;
};
DEFINE_REF(ShaderBuffer);
DEFINE_REF(ShaderBuffer)
DECLARE_REF(StagingBuffer);
DECLARE_REF(StagingBuffer)
class UniformBuffer : public Gfx::UniformBuffer, public ShaderBuffer
{
public:
@@ -147,7 +147,7 @@ protected:
private:
PStagingBuffer dedicatedStagingBuffer;
};
DEFINE_REF(UniformBuffer);
DEFINE_REF(UniformBuffer)
class StructuredBuffer : public Gfx::StructuredBuffer, public ShaderBuffer
{
@@ -163,7 +163,7 @@ protected:
// Inherited via QueueOwnedResource
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
};
DEFINE_REF(StructuredBuffer);
DEFINE_REF(StructuredBuffer)
class VertexBuffer : public Gfx::VertexBuffer, public ShaderBuffer
{
@@ -179,7 +179,7 @@ protected:
// Inherited via QueueOwnedResource
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
};
DEFINE_REF(VertexBuffer);
DEFINE_REF(VertexBuffer)
class IndexBuffer : public Gfx::IndexBuffer, public ShaderBuffer
{
@@ -195,7 +195,7 @@ protected:
// Inherited via QueueOwnedResource
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
};
DEFINE_REF(IndexBuffer);
DEFINE_REF(IndexBuffer)
class TextureHandle
{
@@ -303,14 +303,14 @@ protected:
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
};
DEFINE_REF(Texture2D);
DEFINE_REF(Texture2D)
class SamplerState : public Gfx::SamplerState
{
public:
VkSampler sampler;
};
DEFINE_REF(SamplerState);
DEFINE_REF(SamplerState)
class Window : public Gfx::Window
{
@@ -347,10 +347,11 @@ protected:
PSemaphore imageAcquiredSemaphore;
PGraphics graphics;
VkFormat pixelFormat;
VkSampleCountFlags numSamples;
VkPresentModeKHR presentMode;
VkInstance instance;
VkSwapchainKHR swapchain;
VkSampleCountFlags numSamples;
VkFormat pixelFormat;
VkPresentModeKHR presentMode;
VkSurfaceKHR surface;
VkSurfaceFormatKHR surfaceFormat;
void *windowHandle;
@@ -358,9 +359,8 @@ protected:
int32 acquiredImageIndex;
int32 preAcquiredImageIndex;
int32 semaphoreIndex;
VkInstance instance;
};
DEFINE_REF(Window);
DEFINE_REF(Window)
class Viewport : public Gfx::Viewport
{
@@ -375,6 +375,6 @@ private:
PGraphics graphics;
friend class Graphics;
};
DECLARE_REF(Viewport);
DECLARE_REF(Viewport)
} // namespace Vulkan
} // namespace Seele
+4 -4
View File
@@ -5,8 +5,8 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(PipelineLayout);
DECLARE_REF(Graphics);
DECLARE_REF(PipelineLayout)
DECLARE_REF(Graphics)
class GraphicsPipeline : public Gfx::GraphicsPipeline
{
public:
@@ -15,9 +15,9 @@ public:
void bind(VkCommandBuffer handle);
VkPipelineLayout getLayout() const;
private:
VkPipeline pipeline;
PGraphics graphics;
VkPipeline pipeline;
};
DEFINE_REF(GraphicsPipeline);
DEFINE_REF(GraphicsPipeline)
} // namespace Vulkan
} // namespace Seele
@@ -17,6 +17,6 @@ private:
std::string cacheFile;
Map<uint32, VkPipeline> createdPipelines;
};
DEFINE_REF(PipelineCache);
DEFINE_REF(PipelineCache)
} // namespace Vulkan
} // namespace Seele
+3 -1
View File
@@ -9,7 +9,9 @@ using namespace Seele;
using namespace Seele::Vulkan;
Queue::Queue(PGraphics graphics, Gfx::QueueType queueType, uint32 familyIndex, uint32 queueIndex)
: familyIndex(familyIndex), graphics(graphics), queueType(queueType)
: graphics(graphics)
, familyIndex(familyIndex)
, queueType(queueType)
{
vkGetDeviceQueue(graphics->getDevice(), familyIndex, queueIndex, &queue);
}
+2 -2
View File
@@ -5,8 +5,8 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(CmdBuffer);
DECLARE_REF(Graphics);
DECLARE_REF(CmdBuffer)
DECLARE_REF(Graphics)
class Queue
{
public:
@@ -38,6 +38,6 @@ private:
VkRect2D renderArea;
VkSubpassContents subpassContents;
};
DEFINE_REF(RenderPass);
DEFINE_REF(RenderPass)
} // namespace Vulkan
} // namespace Seele
+1 -2
View File
@@ -2,8 +2,7 @@
#include "VulkanGraphics.h"
#include "VulkanDescriptorSets.h"
#include "slang.h"
#include "spirv_cross/spirv_reflect.hpp"
#include <fstream>
//#include "spirv_cross/spirv_reflect.hpp"
using namespace slang;
using namespace Seele;
+10 -10
View File
@@ -6,8 +6,8 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(Graphics);
DECLARE_REF(DescriptorLayout);
DECLARE_REF(Graphics)
DECLARE_REF(DescriptorLayout)
class Shader
{
public:
@@ -31,12 +31,12 @@ private:
PGraphics graphics;
Map<uint32, PDescriptorLayout> descriptorSets;
VkShaderModule module;
VkShaderStageFlags stage;
ShaderType type;
VkShaderStageFlags stage;
std::string entryPointName;
uint32 hash;
};
DEFINE_REF(Shader);
DEFINE_REF(Shader)
template <typename Base, ShaderType shaderType, VkShaderStageFlags stageFlags>
class ShaderBase : public Base, public Shader
@@ -57,12 +57,12 @@ typedef ShaderBase<Gfx::GeometryShader, ShaderType::GEOMETRY, VK_SHADER_STAGE_GE
typedef ShaderBase<Gfx::FragmentShader, ShaderType::FRAGMENT, VK_SHADER_STAGE_FRAGMENT_BIT> FragmentShader;
typedef ShaderBase<Gfx::ComputeShader, ShaderType::COMPUTE, VK_SHADER_STAGE_COMPUTE_BIT> ComputeShader;
DEFINE_REF(VertexShader);
DEFINE_REF(ControlShader);
DEFINE_REF(EvaluationShader);
DEFINE_REF(GeometryShader);
DEFINE_REF(FragmentShader);
DEFINE_REF(ComputeShader);
DEFINE_REF(VertexShader)
DEFINE_REF(ControlShader)
DEFINE_REF(EvaluationShader)
DEFINE_REF(GeometryShader)
DEFINE_REF(FragmentShader)
DEFINE_REF(ComputeShader)
} // namespace Vulkan
}
+5 -5
View File
@@ -36,13 +36,13 @@ TextureHandle::TextureHandle(PGraphics graphics, VkImageViewType viewType,
, sizeX(createInfo.width)
, sizeY(createInfo.height)
, sizeZ(createInfo.depth)
, mipLevels(createInfo.mipLevels)
, format(createInfo.format)
, samples(createInfo.samples)
, usage(createInfo.usage)
, arrayCount(createInfo.bArray ? createInfo.arrayLayers : 1)
, aspect(getAspectFromFormat(createInfo.format))
, mipLevels(createInfo.mipLevels)
, samples(createInfo.samples)
, format(createInfo.format)
, usage(createInfo.usage)
, image(existingImage)
, aspect(getAspectFromFormat(createInfo.format))
, layout(VK_IMAGE_LAYOUT_UNDEFINED)
{
if (existingImage == VK_NULL_HANDLE)
@@ -3,12 +3,12 @@
#include "VulkanInitializer.h"
#include "VulkanGraphicsEnums.h"
#include "VulkanCommandBuffer.h"
#include <glfw/glfw3.h>
#include <GLFW/glfw3.h>
using namespace Seele;
using namespace Seele::Vulkan;
void glfwKeyCallback(GLFWwindow* handle, int key, int scancode, int action, int modifier)
void glfwKeyCallback(GLFWwindow* handle, int key, int action, int, int modifier)
{
Window* window = (Window*)glfwGetWindowUserPointer(handle);
window->keyCallback((KeyCode)key, (InputAction)action, (KeyModifier)modifier);
@@ -39,7 +39,12 @@ void glfwFileCallback(GLFWwindow* handle, int count, const char** paths)
}
Window::Window(PGraphics graphics, const WindowCreateInfo &createInfo)
: Gfx::Window(createInfo), graphics(graphics), instance(graphics->getInstance()), swapchain(VK_NULL_HANDLE), numSamples(createInfo.numSamples), pixelFormat(cast(createInfo.pixelFormat))
: Gfx::Window(createInfo)
, graphics(graphics)
, instance(graphics->getInstance())
, swapchain(VK_NULL_HANDLE)
, numSamples(createInfo.numSamples)
, pixelFormat(cast(createInfo.pixelFormat))
{
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
GLFWwindow *handle = glfwCreateWindow(createInfo.width, createInfo.height, createInfo.title, createInfo.bFullscreen ? glfwGetPrimaryMonitor() : nullptr, nullptr);
@@ -207,6 +212,7 @@ void Window::present()
{
presentResult = vkQueuePresentKHR(graphics->getGraphicsCommands()->getQueue()->getHandle(), &info);
}
Gfx::currentFrameIndex = (Gfx::currentFrameIndex + 1)%Gfx::numFramesBuffered;
}
void Window::createSwapchain()
+1 -1
View File
@@ -129,4 +129,4 @@ void BlinnPhong::generateMaterialCode(std::ofstream& codeStream, json codeJson)
codeStream << "}" << std::endl;
}
IMPLEMENT_BRDF(BlinnPhong);
IMPLEMENT_BRDF(BlinnPhong)
+1 -1
View File
@@ -29,7 +29,7 @@ protected:
class BlinnPhong : public BRDF
{
DECLARE_BRDF(BlinnPhong);
DECLARE_BRDF(BlinnPhong)
public:
virtual void generateMaterialCode(std::ofstream& codeStream, nlohmann::json codeJson);
protected:
+1 -1
View File
@@ -31,5 +31,5 @@ private:
friend class MaterialLoader;
friend class MaterialInstance;
};
DEFINE_REF(Material);
DEFINE_REF(Material)
} // namespace Seele
+3 -3
View File
@@ -5,8 +5,8 @@
namespace Seele
{
DECLARE_REF(VertexShaderInput);
DECLARE_REF(Material);
DECLARE_REF(VertexShaderInput)
DECLARE_REF(Material)
class MaterialAsset : public Asset
{
public:
@@ -34,5 +34,5 @@ protected:
uint8* uniformData;
int32 uniformBinding;
};
DEFINE_REF(MaterialAsset);
DEFINE_REF(MaterialAsset)
} // namespace Seele
+3 -3
View File
@@ -3,8 +3,8 @@
namespace Seele
{
DECLARE_NAME_REF(Gfx, DescriptorSet);
DECLARE_REF(Material);
DECLARE_NAME_REF(Gfx, DescriptorSet)
DECLARE_REF(Material)
class MaterialInstance : public MaterialAsset
{
public:
@@ -18,5 +18,5 @@ public:
private:
Material* baseMaterial;
};
DEFINE_REF(MaterialInstance);
DEFINE_REF(MaterialInstance)
} // namespace Seele
+4 -4
View File
@@ -24,7 +24,7 @@ FloatParameter::~FloatParameter()
{
}
void FloatParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst)
void FloatParameter::updateDescriptorSet(Gfx::PDescriptorSet, uint8* dst)
{
std::memcpy(dst + byteOffset, &data, sizeof(float));
}
@@ -38,7 +38,7 @@ VectorParameter::~VectorParameter()
{
}
void VectorParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst)
void VectorParameter::updateDescriptorSet(Gfx::PDescriptorSet, uint8* dst)
{
std::memcpy(dst + byteOffset, &data, sizeof(Vector));
}
@@ -52,7 +52,7 @@ TextureParameter::~TextureParameter()
{
}
void TextureParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst)
void TextureParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8*)
{
descriptorSet->updateTexture(binding, data->getTexture());
}
@@ -67,7 +67,7 @@ SamplerParameter::~SamplerParameter()
}
void SamplerParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst)
void SamplerParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8*)
{
descriptorSet->updateSampler(binding, data);
}
+8 -8
View File
@@ -14,7 +14,7 @@ struct ExpressionOutput
struct ShaderExpression
{
};
DECLARE_NAME_REF(Gfx, DescriptorSet);
DECLARE_NAME_REF(Gfx, DescriptorSet)
struct ShaderParameter : public ShaderExpression
{
std::string name;
@@ -25,7 +25,7 @@ struct ShaderParameter : public ShaderExpression
// update a descriptorset, in case of a uniform buffer, copy the data to the dst + byteOffset
virtual void updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) = 0;
};
DEFINE_REF(ShaderParameter);
DEFINE_REF(ShaderParameter)
struct FloatParameter : public ShaderParameter
{
float data;
@@ -33,7 +33,7 @@ struct FloatParameter : public ShaderParameter
virtual ~FloatParameter();
virtual void updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) override;
};
DEFINE_REF(FloatParameter);
DEFINE_REF(FloatParameter)
struct VectorParameter : public ShaderParameter
{
Vector data;
@@ -41,8 +41,8 @@ struct VectorParameter : public ShaderParameter
virtual ~VectorParameter();
virtual void updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) override;
};
DEFINE_REF(VectorParameter);
DECLARE_REF(TextureAsset);
DEFINE_REF(VectorParameter)
DECLARE_REF(TextureAsset)
struct TextureParameter : public ShaderParameter
{
PTextureAsset data;
@@ -50,8 +50,8 @@ struct TextureParameter : public ShaderParameter
virtual ~TextureParameter();
virtual void updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) override;
};
DEFINE_REF(TextureParameter);
DECLARE_NAME_REF(Gfx, SamplerState);
DEFINE_REF(TextureParameter)
DECLARE_NAME_REF(Gfx, SamplerState)
struct SamplerParameter : public ShaderParameter
{
Gfx::PSamplerState data;
@@ -59,6 +59,6 @@ struct SamplerParameter : public ShaderParameter
virtual ~SamplerParameter();
virtual void updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) override;
};
DEFINE_REF(SamplerParameter);
DEFINE_REF(SamplerParameter)
} // namespace Seele
-2
View File
@@ -3,9 +3,7 @@
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#pragma warning(disable : 4201)
#include <glm/gtc/quaternion.hpp>
#pragma warning(default : 4201)
namespace Seele
{
typedef glm::vec2 Vector2;
+2 -6
View File
@@ -52,10 +52,7 @@ public:
std::scoped_lock lock(registeredObjectsLock);
registeredObjects.erase(handle);
}
// we cant always have the definition of every class
#pragma warning(disable : 4150)
delete handle;
#pragma warning(default : 4150)
}
RefObject &operator=(const RefObject &rhs)
{
@@ -105,7 +102,6 @@ public:
{
return handle;
}
private:
T *handle;
std::atomic_uint64_t refCount;
@@ -161,7 +157,7 @@ public:
RefPtr(const RefPtr<F> &other)
{
F *f = other.getObject()->getHandle();
T* t = static_cast<T *>(f);
assert(static_cast<T *>(f));
object = (RefObject<T> *)other.getObject();
object->addRef();
}
@@ -267,7 +263,7 @@ private:
RefObject<T> *object;
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
void serialize(Archive& ar, const unsigned int)
{
ar & *object->getHandle();
}
+4 -4
View File
@@ -4,9 +4,9 @@
namespace Seele
{
DECLARE_REF(Actor);
DECLARE_REF(Component);
DECLARE_REF(Scene);
DECLARE_REF(Actor)
DECLARE_REF(Component)
DECLARE_REF(Scene)
class Actor
{
public:
@@ -48,5 +48,5 @@ protected:
Array<PActor> children;
PComponent rootComponent;
};
DEFINE_REF(Actor);
DEFINE_REF(Actor)
} // namespace Seele
+1 -1
View File
@@ -17,5 +17,5 @@ private:
PCameraComponent cameraComponent;
PComponent sceneComponent; // This will be the root, camera will be the child
};
DEFINE_REF(CameraActor);
DEFINE_REF(CameraActor)
} // namespace Seele
@@ -56,5 +56,5 @@ private:
Matrix4 viewMatrix;
Matrix4 projectionMatrix;
};
DEFINE_REF(CameraComponent);
DEFINE_REF(CameraComponent)
} // namespace Seele
+3 -3
View File
@@ -4,9 +4,9 @@
namespace Seele
{
DECLARE_REF(Actor);
DECLARE_REF(Scene);
DECLARE_REF(Component);
DECLARE_REF(Actor)
DECLARE_REF(Scene)
DECLARE_REF(Component)
class Component
{
public:
@@ -7,7 +7,7 @@
namespace Seele
{
DECLARE_REF(MeshAsset);
DECLARE_REF(MeshAsset)
class PrimitiveComponent : public Component
{
public:
@@ -23,5 +23,5 @@ private:
Gfx::PUniformBuffer uniformBuffer;
friend class Scene;
};
DEFINE_REF(PrimitiveComponent);
DEFINE_REF(PrimitiveComponent)
} // namespace Seele
+1 -1
View File
@@ -8,7 +8,7 @@
namespace Seele
{
DECLARE_REF(Material);
DECLARE_REF(Material)
struct DirectionalLight
{
+1 -1
View File
@@ -18,5 +18,5 @@ protected:
Gfx::PGraphics graphics;
Gfx::PViewport target;
};
DEFINE_REF(RenderPath);
DEFINE_REF(RenderPath)
} // namespace Seele
+2 -2
View File
@@ -4,8 +4,8 @@
namespace Seele
{
DECLARE_REF(Scene);
DECLARE_REF(CameraActor);
DECLARE_REF(Scene)
DECLARE_REF(CameraActor)
class SceneRenderPath : public RenderPath
{
public:
+4 -4
View File
@@ -26,7 +26,7 @@ void SceneView::beginFrame()
scene->tick(0);//TODO: update in separate thread
}
void SceneView::keyCallback(KeyCode code, InputAction action, KeyModifier modifier)
void SceneView::keyCallback(KeyCode code, InputAction action, KeyModifier)
{
if(action != InputAction::RELEASE)
{
@@ -56,7 +56,7 @@ void SceneView::mouseMoveCallback(double xPos, double yPos)
}
}
void SceneView::mouseButtonCallback(MouseButton button, InputAction action, KeyModifier modifier)
void SceneView::mouseButtonCallback(MouseButton button, InputAction action, KeyModifier)
{
if(button == MouseButton::MOUSE_BUTTON_1 && action != InputAction::RELEASE)
{
@@ -68,12 +68,12 @@ void SceneView::mouseButtonCallback(MouseButton button, InputAction action, KeyM
}
}
void SceneView::scrollCallback(double xOffset, double yOffset)
void SceneView::scrollCallback(double, double yOffset)
{
activeCamera->getCameraComponent()->mouseScroll(yOffset);
}
void SceneView::fileCallback(int count, const char** paths)
void SceneView::fileCallback(int, const char**)
{
}
+3 -3
View File
@@ -2,8 +2,8 @@
#include "View.h"
namespace Seele
{
DECLARE_REF(Scene);
DECLARE_REF(CameraActor);
DECLARE_REF(Scene)
DECLARE_REF(CameraActor)
class SceneView : public View
{
public:
@@ -20,5 +20,5 @@ private:
virtual void scrollCallback(double xOffset, double yOffset) override;
virtual void fileCallback(int count, const char** paths) override;
};
DEFINE_REF(SceneView);
DEFINE_REF(SceneView)
} // namespace Seele
+1 -1
View File
@@ -2,7 +2,7 @@
#include "RenderPath.h"
namespace Seele
{
DECLARE_REF(Window);
DECLARE_REF(Window)
// A view is a part of the window, which can be anything from a viewport to an editor
class View
{
+1 -1
View File
@@ -22,5 +22,5 @@ private:
PView focusedView;
Gfx::PWindow gfxHandle;
};
DEFINE_REF(Window);
DEFINE_REF(Window)
} // namespace Seele
+1 -1
View File
@@ -28,5 +28,5 @@ private:
Array<PWindow> windows;
static Gfx::PGraphics graphics;
};
DEFINE_REF(WindowManager);
DEFINE_REF(WindowManager)
} // namespace Seele
+1 -1
View File
@@ -5,6 +5,6 @@ target_sources(Seele_unit_tests
EngineTest.cpp)
target_include_directories(Seele_unit_tests PUBLIC ./)
add_subdirectory(Containers/)
add_subdirectory(Fibers/)
#add_subdirectory(Fibers/)
add_subdirectory(Graphics/)
add_subdirectory(Math/)
+2 -2
View File
@@ -13,11 +13,11 @@ namespace Seele
}
void setup()
{
Fibers::JobQueue::initJobQueues();
//Fibers::JobQueue::initJobQueues();
}
void teardown()
{
Fibers::JobQueue::cleanupJobQueues();
//Fibers::JobQueue::cleanupJobQueues();
}
};
};