Replacing std::format with fmt::format
This commit is contained in:
+2
-1
@@ -343,4 +343,5 @@ ASALocalRun/
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
healthchecksdb
|
||||
.DS_Store
|
||||
|
||||
Vendored
+16
-2
@@ -12,10 +12,24 @@
|
||||
],
|
||||
"windowsSdkVersion": "10.0.20348.0",
|
||||
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "windows-msvc-x64",
|
||||
"configurationProvider": "ms-vscode.cmake-tools"
|
||||
},
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/src/**"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"_UNICODE"
|
||||
],
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "clang-arm64",
|
||||
"configurationProvider": "ms-vscode.cmake-tools"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
|
||||
Vendored
+13
-1
@@ -124,7 +124,19 @@
|
||||
"ranges": "cpp",
|
||||
"source_location": "cpp",
|
||||
"syncstream": "cpp",
|
||||
"stdfloat": "cpp"
|
||||
"stdfloat": "cpp",
|
||||
"__bit_reference": "cpp",
|
||||
"__config": "cpp",
|
||||
"__debug": "cpp",
|
||||
"__errc": "cpp",
|
||||
"__hash_table": "cpp",
|
||||
"__locale": "cpp",
|
||||
"__mutex_base": "cpp",
|
||||
"__node_handle": "cpp",
|
||||
"__split_buffer": "cpp",
|
||||
"__threading_support": "cpp",
|
||||
"__tree": "cpp",
|
||||
"__verbose_abort": "cpp"
|
||||
},
|
||||
"cmake.skipConfigureIfCachePresent": false,
|
||||
"cmake.configureArgs": [
|
||||
|
||||
+5
-17
@@ -12,6 +12,8 @@ set(CMAKE_INSTALL_MESSAGE LAZY)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
set(VCPKG_INSTALL_OPTIONS "--allow-unsupported")
|
||||
|
||||
set(ENGINE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/src/Engine)
|
||||
set(EXTERNAL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/external)
|
||||
|
||||
@@ -45,6 +47,7 @@ find_package(glfw3 CONFIG REQUIRED)
|
||||
find_package(glm CONFIG REQUIRED)
|
||||
find_package(Ktx CONFIG REQUIRED)
|
||||
find_package(nlohmann_json CONFIG REQUIRED)
|
||||
find_package(fmt CONFIG REQUIRED)
|
||||
|
||||
if(UNIX)
|
||||
find_package(Threads REQUIRED)
|
||||
@@ -67,7 +70,8 @@ target_link_libraries(Engine PUBLIC assimp::assimp)
|
||||
target_link_libraries(Engine PUBLIC KTX::ktx)
|
||||
target_link_libraries(Engine PUBLIC nlohmann_json::nlohmann_json)
|
||||
target_link_libraries(Engine PUBLIC crcpp)
|
||||
target_link_libraries(Engine PUBLIC shader-slang)
|
||||
target_link_libraries(Engine PUBLIC slang)
|
||||
target_link_libraries(Engine PUBLIC fmt::fmt)
|
||||
if(UNIX)
|
||||
target_link_libraries(Engine PUBLIC Threads::Threads)
|
||||
target_link_libraries(Engine PUBLIC dl)
|
||||
@@ -82,22 +86,6 @@ target_compile_definitions(Editor PRIVATE EDITOR=1)
|
||||
add_executable(AssetViewer "")
|
||||
target_link_libraries(AssetViewer PRIVATE Engine)
|
||||
target_include_directories(AssetViewer PRIVATE src/AssetViewer)
|
||||
|
||||
target_precompile_headers(Engine
|
||||
PUBLIC
|
||||
<assert.h>
|
||||
<atomic>
|
||||
<condition_variable>
|
||||
<coroutine>
|
||||
<cstring>
|
||||
<filesystem>
|
||||
<functional>
|
||||
<fstream>
|
||||
<iostream>
|
||||
<memory>
|
||||
<mutex>
|
||||
<string>
|
||||
<thread>)
|
||||
|
||||
if(MSVC)
|
||||
set(_CRT_SECURE_NO_WARNINGS)
|
||||
|
||||
@@ -81,8 +81,8 @@ if(WIN32)
|
||||
install(FILES
|
||||
${SLANG_ROOT}/lib/slang.lib
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
else()
|
||||
|
||||
elseif(APPLE)
|
||||
|
||||
endif()
|
||||
target_include_directories(shader-slang INTERFACE
|
||||
$<BUILD_INTERFACE:${SLANG_ROOT}/include/>
|
||||
|
||||
Vendored
+1
-1
Submodule external/vcpkg updated: 50bffcc62d...53bef8994c
@@ -5,6 +5,8 @@
|
||||
#include "Asset/MaterialAsset.h"
|
||||
#include "Asset/MaterialInstanceAsset.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
@@ -16,7 +18,7 @@ int main(int, char**)
|
||||
//{
|
||||
// return -1;
|
||||
//}
|
||||
std::filesystem::path path = "C:\\Users\\Dynamitos\\TrackClear\\Assets\\Dirt.asset";
|
||||
std::filesystem::path path = std::filesystem::path("C:\\Users\\Dynamitos\\TrackClear\\Assets\\Dirt.asset");
|
||||
std::ifstream stream = std::ifstream(path, std::ios::binary);
|
||||
|
||||
ArchiveBuffer buffer;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "Graphics/Texture.h"
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
#include "Material/ShaderExpression.h"
|
||||
#include "Asset/TextureAsset.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <format>
|
||||
#include <fmt/core.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace Seele;
|
||||
using json = nlohmann::json;
|
||||
@@ -131,14 +133,14 @@ void MaterialLoader::import(MaterialImportArgs args, PMaterialAsset asset)
|
||||
{
|
||||
std::string str = obj.get<std::string>();
|
||||
OConstantExpression c = new ConstantExpression(str, ExpressionType::UNKNOWN);
|
||||
std::string name = std::format("const_{0}", auxKey++);
|
||||
std::string name = fmt::format("const_{0}", auxKey++);
|
||||
c->key = name;
|
||||
expressions.add(std::move(c));
|
||||
return name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::format("{0}", obj.get<uint32>());
|
||||
return fmt::format("{0}", obj.get<uint32>());
|
||||
}
|
||||
};
|
||||
MaterialNode mat;
|
||||
@@ -150,7 +152,7 @@ void MaterialLoader::import(MaterialImportArgs args, PMaterialAsset asset)
|
||||
if (exp.compare("Const") == 0)
|
||||
{
|
||||
OConstantExpression p = new ConstantExpression();
|
||||
std::string name = std::format("{0}", key++);
|
||||
std::string name = fmt::format("{0}", key++);
|
||||
p->key = name;
|
||||
p->expr = obj["value"];
|
||||
expressions.add(std::move(p));
|
||||
@@ -158,7 +160,7 @@ void MaterialLoader::import(MaterialImportArgs args, PMaterialAsset asset)
|
||||
if(exp.compare("Add") == 0)
|
||||
{
|
||||
OAddExpression p = new AddExpression();
|
||||
std::string name = std::format("{0}", key++);
|
||||
std::string name = fmt::format("{0}", key++);
|
||||
p->key = name;
|
||||
p->inputs["lhs"].source = referenceExpression(obj["lhs"]);
|
||||
p->inputs["rhs"].source = referenceExpression(obj["rhs"]);
|
||||
@@ -167,7 +169,7 @@ void MaterialLoader::import(MaterialImportArgs args, PMaterialAsset asset)
|
||||
if(exp.compare("Sub") == 0)
|
||||
{
|
||||
OSubExpression p = new SubExpression();
|
||||
std::string name = std::format("{0}", key++);
|
||||
std::string name = fmt::format("{0}", key++);
|
||||
p->key = name;
|
||||
p->inputs["lhs"].source = referenceExpression(obj["lhs"]);
|
||||
p->inputs["rhs"].source = referenceExpression(obj["rhs"]);
|
||||
@@ -176,7 +178,7 @@ void MaterialLoader::import(MaterialImportArgs args, PMaterialAsset asset)
|
||||
if(exp.compare("Mul") == 0)
|
||||
{
|
||||
OMulExpression p = new MulExpression();
|
||||
std::string name = std::format("{0}", key++);
|
||||
std::string name = fmt::format("{0}", key++);
|
||||
p->key = name;
|
||||
p->inputs["lhs"].source = referenceExpression(obj["lhs"]);
|
||||
p->inputs["rhs"].source = referenceExpression(obj["rhs"]);
|
||||
@@ -185,7 +187,7 @@ void MaterialLoader::import(MaterialImportArgs args, PMaterialAsset asset)
|
||||
if(exp.compare("Swizzle") == 0)
|
||||
{
|
||||
OSwizzleExpression p = new SwizzleExpression();
|
||||
std::string name = std::format("{0}", key++);
|
||||
std::string name = fmt::format("{0}", key++);
|
||||
p->key = name;
|
||||
p->inputs["target"].source = referenceExpression(obj["target"]);
|
||||
int32 i = 0;
|
||||
@@ -198,7 +200,7 @@ void MaterialLoader::import(MaterialImportArgs args, PMaterialAsset asset)
|
||||
if(exp.compare("Sample") == 0)
|
||||
{
|
||||
OSampleExpression p = new SampleExpression();
|
||||
std::string name = std::format("{0}", key++);
|
||||
std::string name = fmt::format("{0}", key++);
|
||||
p->key = name;
|
||||
p->inputs["texture"].source = referenceExpression(obj["texture"]);
|
||||
p->inputs["sampler"].source = referenceExpression(obj["sampler"]);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "Asset/AssetImporter.h"
|
||||
#include "Asset/MaterialAsset.h"
|
||||
#include <set>
|
||||
#include <format>
|
||||
#include <fmt/core.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <nlohmann/json.hpp>
|
||||
@@ -48,7 +48,7 @@ void MeshLoader::loadMaterials(const aiScene* scene, const std::string& baseName
|
||||
{
|
||||
aiMaterial* material = scene->mMaterials[i];
|
||||
json matCode;
|
||||
std::string materialName = std::format("{0}{1}{2}", baseName, material->GetName().C_Str(), i);
|
||||
std::string materialName = fmt::format("{0}{1}{2}", baseName, material->GetName().C_Str(), i);
|
||||
materialName.erase(std::remove(materialName.begin(), materialName.end(), '.'), materialName.end()); // dots break adding the .asset extension later
|
||||
matCode["name"] = materialName;
|
||||
matCode["profile"] = "CelShading";
|
||||
@@ -196,7 +196,7 @@ void MeshLoader::loadMaterials(const aiScene* scene, const std::string& baseName
|
||||
});
|
||||
PMaterialAsset baseMat = AssetRegistry::findMaterial(matCode["name"].get<std::string>());
|
||||
globalMaterials[i] = baseMat->instantiate(InstantiationParameter{
|
||||
.name = std::format("{0}_Inst_0", baseMat->getName()),
|
||||
.name = fmt::format("{0}_Inst_0", baseMat->getName()),
|
||||
.folderPath = baseMat->getFolderPath(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <stb_image_write.h>
|
||||
#pragma GCC diagnostic pop
|
||||
#include "ktx.h"
|
||||
#include <fstream>
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "ViewportControl.h"
|
||||
#include "Component/Camera.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::Editor;
|
||||
|
||||
+4
-4
@@ -12,7 +12,7 @@
|
||||
#include "Asset/FontLoader.h"
|
||||
#include "Asset/AssetImporter.h"
|
||||
#include "Graphics/StaticMeshVertexData.h"
|
||||
#include <format>
|
||||
#include <fmt/core.h>
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::Editor;
|
||||
@@ -254,9 +254,9 @@ int main()
|
||||
if (false)
|
||||
{
|
||||
std::filesystem::create_directories(outputPath);
|
||||
std::system(std::format("cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGAME_TITLE=\"{}\" -DGAME_DESTINATION=\"{}\" -DGAME_BINARY=\"{}\" -P ./cmake/ExportProject.cmake", gameName, outputPath.generic_string(), binaryPath.generic_string()).c_str());
|
||||
std::system(std::format("cmake -S {} -B {}", cmakePath.generic_string(), cmakePath.generic_string()).c_str());
|
||||
std::system(std::format("cmake --build {}", cmakePath.generic_string()).c_str());
|
||||
std::system(fmt::format("cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGAME_TITLE=\"{}\" -DGAME_DESTINATION=\"{}\" -DGAME_BINARY=\"{}\" -P ./cmake/ExportProject.cmake", gameName, outputPath.generic_string(), binaryPath.generic_string()).c_str());
|
||||
std::system(fmt::format("cmake -S {} -B {}", cmakePath.generic_string(), cmakePath.generic_string()).c_str());
|
||||
std::system(fmt::format("cmake --build {}", cmakePath.generic_string()).c_str());
|
||||
std::filesystem::copy(sourcePath / "Assets", outputPath / "Assets", std::filesystem::copy_options::recursive);
|
||||
std::filesystem::copy("shaders", outputPath / "shaders", std::filesystem::copy_options::recursive);
|
||||
std::filesystem::copy("textures", outputPath / "textures", std::filesystem::copy_options::recursive);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Asset.h"
|
||||
#include "Containers/Map.h"
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ void FontAsset::save(ArchiveBuffer& buffer) const
|
||||
{
|
||||
// technically, downloading cant be const, because we have to allocate temporary buffers and change layouts
|
||||
// but practically the texture stays the same
|
||||
usedTextures[x]->download(0, depth, face, textureData);
|
||||
const_cast<Gfx::Texture2D*>(*(usedTextures[x]))->download(0, depth, face, textureData);
|
||||
ktxTexture_SetImageFromMemory(ktxTexture(kTexture), 0, depth, face, textureData.data(), textureData.size());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ using namespace Seele::Math;
|
||||
|
||||
Camera::Camera()
|
||||
: viewMatrix(Matrix4())
|
||||
, bNeedsViewBuild(false)
|
||||
, cameraPos(Vector())
|
||||
, bNeedsViewBuild(false)
|
||||
{
|
||||
yaw = -3.1415f/2;
|
||||
pitch = 0;
|
||||
|
||||
@@ -11,7 +11,7 @@ struct Dependencies<>
|
||||
{
|
||||
int x;
|
||||
template<typename... Right>
|
||||
Dependencies<Right...> operator|(const Dependencies<Right...>& other)
|
||||
Dependencies<Right...> operator|(const Dependencies<Right...>&)
|
||||
{
|
||||
return Dependencies<Right...>();
|
||||
}
|
||||
@@ -20,7 +20,7 @@ template<typename This, typename... Rest>
|
||||
struct Dependencies<This, Rest...> : public Dependencies<Rest...>
|
||||
{
|
||||
template<typename... Right>
|
||||
Dependencies<This, Rest..., Right...> operator|(const Dependencies<Right...>& other)
|
||||
Dependencies<This, Rest..., Right...> operator|(const Dependencies<Right...>&)
|
||||
{
|
||||
return Dependencies<This, Rest..., Right...>();
|
||||
}
|
||||
@@ -38,8 +38,8 @@ concept has_dependencies = requires(Comp) { Comp::dependencies; };
|
||||
|
||||
#define REQUIRE_COMPONENT(x) \
|
||||
private: \
|
||||
x& get##x() { return getComponent<##x>(); } \
|
||||
const x& get##x() const { return getComponent<##x>(); } \
|
||||
x& get##x() { return getComponent<x>(); } \
|
||||
const x& get##x() const { return getComponent<x>(); } \
|
||||
public: \
|
||||
constexpr static Dependencies<x> dependencies = {};
|
||||
|
||||
|
||||
@@ -38,14 +38,14 @@ public:
|
||||
{
|
||||
return p;
|
||||
}
|
||||
constexpr bool operator!=(const IteratorBase &other) const
|
||||
{
|
||||
return p != other.p;
|
||||
}
|
||||
constexpr bool operator==(const IteratorBase &other) const
|
||||
{
|
||||
return p == other.p;
|
||||
}
|
||||
constexpr std::strong_ordering operator<=>(const IteratorBase &other) const
|
||||
{
|
||||
return p <=> other.p;
|
||||
}
|
||||
constexpr IteratorBase operator+(size_t other) const
|
||||
{
|
||||
IteratorBase tmp(*this);
|
||||
@@ -61,10 +61,6 @@ public:
|
||||
p+=other;
|
||||
return *this;
|
||||
}
|
||||
constexpr bool operator<(const IteratorBase& other) const
|
||||
{
|
||||
return p < other.p;
|
||||
}
|
||||
constexpr IteratorBase operator-(difference_type diff) const
|
||||
{
|
||||
return IteratorBase(p - diff);
|
||||
@@ -537,7 +533,7 @@ public:
|
||||
assert(index < arraySize);
|
||||
return _data[index];
|
||||
}
|
||||
constexpr const reference operator[](size_type index) const
|
||||
constexpr const_reference operator[](size_type index) const
|
||||
{
|
||||
assert(index < arraySize);
|
||||
return _data[index];
|
||||
@@ -674,7 +670,7 @@ constexpr bool operator==(const Array<Type, Alloc> &lhs, const Array<Type, Alloc
|
||||
template<class Type, class Alloc>
|
||||
constexpr auto operator<=>(const Array<Type, Alloc>& lhs, const Array<Type, Alloc>& rhs)
|
||||
{
|
||||
return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
|
||||
return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
|
||||
}
|
||||
|
||||
template <typename T, size_t N>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <memory_resource>
|
||||
#include <assert.h>
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
@@ -9,6 +10,16 @@ class List
|
||||
private:
|
||||
struct Node
|
||||
{
|
||||
Node(Node* prev, Node* next, const T& data)
|
||||
: prev(prev)
|
||||
, next(next)
|
||||
, data(std::move(data))
|
||||
{}
|
||||
Node(Node* prev, Node* next, T&& data)
|
||||
: prev(prev)
|
||||
, next(next)
|
||||
, data(std::move(data))
|
||||
{}
|
||||
Node *prev;
|
||||
Node *next;
|
||||
T data;
|
||||
@@ -57,39 +68,43 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
reference operator*() const
|
||||
constexpr reference operator*() const
|
||||
{
|
||||
return node->data;
|
||||
}
|
||||
pointer operator->() const
|
||||
constexpr pointer operator->() const
|
||||
{
|
||||
return &node->data;
|
||||
}
|
||||
inline bool operator!=(const IteratorBase &other)
|
||||
constexpr bool operator!=(const IteratorBase &other)
|
||||
{
|
||||
return node != other.node;
|
||||
}
|
||||
inline bool operator==(const IteratorBase &other)
|
||||
constexpr bool operator==(const IteratorBase &other)
|
||||
{
|
||||
return node == other.node;
|
||||
}
|
||||
IteratorBase &operator--()
|
||||
constexpr std::strong_ordering operator<=>(const IteratorBase& other)
|
||||
{
|
||||
return node <=> other.node;
|
||||
}
|
||||
constexpr IteratorBase &operator--()
|
||||
{
|
||||
node = node->prev;
|
||||
return *this;
|
||||
}
|
||||
IteratorBase operator--(int)
|
||||
constexpr IteratorBase operator--(int)
|
||||
{
|
||||
IteratorBase tmp(*this);
|
||||
--*this;
|
||||
return tmp;
|
||||
}
|
||||
IteratorBase &operator++()
|
||||
constexpr IteratorBase &operator++()
|
||||
{
|
||||
node = node->next;
|
||||
return *this;
|
||||
}
|
||||
IteratorBase operator++(int)
|
||||
constexpr IteratorBase operator++(int)
|
||||
{
|
||||
IteratorBase tmp(*this);
|
||||
++*this;
|
||||
@@ -187,7 +202,7 @@ public:
|
||||
, beginIt(std::move(other.beginIt))
|
||||
, endIt(std::move(other.endIt))
|
||||
, _size(std::move(other._size))
|
||||
, allocator(allocator)
|
||||
, allocator(alloc)
|
||||
{
|
||||
other._size = 0;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,16 @@ struct Tree
|
||||
protected:
|
||||
struct Node
|
||||
{
|
||||
Node(Node* left, Node* right, const NodeData& nodeData)
|
||||
: leftChild(left)
|
||||
, rightChild(right)
|
||||
, data(nodeData)
|
||||
{}
|
||||
Node(Node* left, Node* right, NodeData&& nodeData)
|
||||
: leftChild(left)
|
||||
, rightChild(right)
|
||||
, data(std::move(nodeData))
|
||||
{}
|
||||
Node* leftChild;
|
||||
Node* rightChild;
|
||||
NodeData data;
|
||||
@@ -71,12 +81,16 @@ public:
|
||||
}
|
||||
constexpr bool operator!=(const IteratorBase& other)
|
||||
{
|
||||
return node != other.node;
|
||||
return node == other.node;
|
||||
}
|
||||
constexpr bool operator==(const IteratorBase& other)
|
||||
{
|
||||
return node == other.node;
|
||||
}
|
||||
constexpr std::strong_ordering operator<=>(const IteratorBase& other)
|
||||
{
|
||||
return node == other.node;
|
||||
}
|
||||
constexpr IteratorBase& operator++()
|
||||
{
|
||||
node = node->rightChild;
|
||||
@@ -433,8 +447,8 @@ private:
|
||||
_size++;
|
||||
return Pair<Node*, bool>(newNode, true);
|
||||
}
|
||||
template<class KeyType>
|
||||
Node* _remove(Node* r, KeyType&& key)
|
||||
template<class K>
|
||||
Node* _remove(Node* r, K&& key)
|
||||
{
|
||||
markIteratorsDirty();
|
||||
Node* temp;
|
||||
@@ -463,8 +477,8 @@ private:
|
||||
_size--;
|
||||
return r;
|
||||
}
|
||||
template<class KeyType>
|
||||
Node* _splay(Node* r, KeyType&& key)
|
||||
template<class K>
|
||||
Node* _splay(Node* r, K&& key)
|
||||
{
|
||||
markIteratorsDirty();
|
||||
if (r == nullptr || equal(r->data, key))
|
||||
@@ -516,8 +530,8 @@ private:
|
||||
return (r->rightChild == nullptr) ? r : rotateLeft(r);
|
||||
}
|
||||
}
|
||||
template<typename KeyType>
|
||||
bool equal(const NodeData& a, KeyType&& b) const
|
||||
template<typename K>
|
||||
bool equal(const NodeData& a, K&& b) const
|
||||
{
|
||||
return !comp(keyFun(a), b) && !comp(b, keyFun(a));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "DebugPass.h"
|
||||
#include "Graphics/Graphics.h"
|
||||
#include "Graphics/RenderTarget.h"
|
||||
#include "Graphics/Pipeline.h"
|
||||
#include "Graphics/Shader.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
@@ -74,10 +76,6 @@ void DebugPass::publishOutputs()
|
||||
descriptorLayout = graphics->createDescriptorLayout("DebugDescLayout");
|
||||
descriptorLayout->addDescriptorBinding(0, Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
|
||||
descriptorLayout->create();
|
||||
|
||||
pipelineLayout = graphics->createPipelineLayout();
|
||||
pipelineLayout->addDescriptorLayout(0, descriptorLayout);
|
||||
pipelineLayout->create();
|
||||
}
|
||||
|
||||
void DebugPass::createRenderPass()
|
||||
@@ -92,43 +90,29 @@ void DebugPass::createRenderPass()
|
||||
};
|
||||
renderPass = graphics->createRenderPass(std::move(layout), viewport);
|
||||
|
||||
Gfx::OPipelineLayout pipelineLayout = graphics->createPipelineLayout();
|
||||
pipelineLayout->addDescriptorLayout(0, descriptorLayout);
|
||||
pipelineLayout->create();
|
||||
|
||||
ShaderCreateInfo createInfo;
|
||||
createInfo.name = "DebugVertex";
|
||||
createInfo.mainModule = "Debug";
|
||||
createInfo.entryPoint = "vertexMain";
|
||||
createInfo.defines["INDEX_VIEW_PARAMS"] = "0";
|
||||
Gfx::PVertexShader vertexShader = graphics->createVertexShader(createInfo);
|
||||
vertexShader = graphics->createVertexShader(createInfo);
|
||||
|
||||
createInfo.name = "DebugFragment";
|
||||
|
||||
createInfo.entryPoint = "fragmentMain";
|
||||
Gfx::PFragmentShader fragmentShader = graphics->createFragmentShader(createInfo);
|
||||
fragmentShader = graphics->createFragmentShader(createInfo);
|
||||
|
||||
Gfx::OVertexDeclaration vertexDecl = graphics->createVertexDeclaration({
|
||||
Gfx::VertexElement {
|
||||
.streamIndex = 0,
|
||||
.offset = offsetof(DebugVertex, position),
|
||||
.vertexFormat = Gfx::SE_FORMAT_R32G32B32_SFLOAT,
|
||||
.attributeIndex = 0,
|
||||
.stride = sizeof(DebugVertex),
|
||||
},
|
||||
Gfx::VertexElement {
|
||||
.streamIndex = 0,
|
||||
.offset = offsetof(DebugVertex, color),
|
||||
.vertexFormat = Gfx::SE_FORMAT_R32G32B32_SFLOAT,
|
||||
.attributeIndex = 1,
|
||||
.stride = sizeof(DebugVertex),
|
||||
}
|
||||
});
|
||||
|
||||
GraphicsPipelineCreateInfo gfxInfo;
|
||||
gfxInfo.vertexDeclaration = vertexDecl;
|
||||
Gfx::LegacyPipelineCreateInfo gfxInfo;
|
||||
gfxInfo.vertexShader = vertexShader;
|
||||
gfxInfo.fragmentShader = fragmentShader;
|
||||
gfxInfo.rasterizationState.polygonMode = Gfx::SE_POLYGON_MODE_LINE;
|
||||
gfxInfo.rasterizationState.lineWidth = 5.f;
|
||||
gfxInfo.topology = Gfx::SE_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
||||
gfxInfo.pipelineLayout = pipelineLayout;
|
||||
gfxInfo.pipelineLayout = std::move(pipelineLayout);
|
||||
gfxInfo.renderPass = renderPass;
|
||||
pipeline = graphics->createGraphicsPipeline(gfxInfo);
|
||||
pipeline = graphics->createGraphicsPipeline(std::move(gfxInfo));
|
||||
}
|
||||
|
||||
@@ -25,8 +25,9 @@ private:
|
||||
Gfx::OUniformBuffer viewParamsBuffer;
|
||||
Gfx::ODescriptorLayout descriptorLayout;
|
||||
Gfx::PDescriptorSet descriptorSet;
|
||||
Gfx::OPipelineLayout pipelineLayout;
|
||||
Gfx::OGraphicsPipeline pipeline;
|
||||
Gfx::OVertexShader vertexShader;
|
||||
Gfx::OFragmentShader fragmentShader;
|
||||
Gfx::PGraphicsPipeline pipeline;
|
||||
};
|
||||
DEFINE_REF(DebugPass)
|
||||
} // namespace Seele
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "RenderGraphResources.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ SkyboxRenderPass::~SkyboxRenderPass()
|
||||
void SkyboxRenderPass::beginFrame(const Component::Camera& cam)
|
||||
{
|
||||
RenderPass::beginFrame(cam);
|
||||
DataSource uniformUpdate;
|
||||
|
||||
skyboxDataLayout->reset();
|
||||
textureLayout->reset();
|
||||
|
||||
@@ -83,7 +83,7 @@ void UIPass::publishOutputs()
|
||||
colorBuffer = graphics->createTexture2D(colorBufferInfo);
|
||||
renderTarget =
|
||||
new Gfx::RenderTargetAttachment(colorBuffer, Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
|
||||
renderTarget->clear.color = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
renderTarget->clear.color = { {0.0f, 0.0f, 0.0f, 1.0f} };
|
||||
resources->registerRenderPassOutput("UIPASS_COLOR", renderTarget);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "Graphics/Initializer.h"
|
||||
#include "Graphics/RenderPass/DepthPrepass.h"
|
||||
#include "Graphics/RenderPass/BasePass.h"
|
||||
#include <format>
|
||||
#include <fmt/core.h>
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::Gfx;
|
||||
@@ -97,7 +97,7 @@ void ShaderCompiler::createShaders(ShaderPermutation permutation)
|
||||
ShaderCollection collection;
|
||||
|
||||
ShaderCreateInfo createInfo;
|
||||
createInfo.name = std::format("Material {0}", permutation.materialName);
|
||||
createInfo.name = fmt::format("Material {0}", permutation.materialName);
|
||||
if (std::strlen(permutation.materialName) > 0)
|
||||
{
|
||||
createInfo.additionalModules.add(permutation.materialName);
|
||||
|
||||
@@ -71,36 +71,36 @@ struct ShaderPermutation
|
||||
{
|
||||
std::memset(taskFile, 0, sizeof(taskFile));
|
||||
hasTaskShader = 1;
|
||||
strncpy_s(taskFile, sizeof(taskFile), name.data(), 32);
|
||||
strncpy(taskFile, name.data(), sizeof(taskFile));
|
||||
}
|
||||
void setVertexFile(std::string_view name)
|
||||
{
|
||||
std::memset(vertexMeshFile, 0, sizeof(vertexMeshFile));
|
||||
useMeshShading = 0;
|
||||
strncpy_s(vertexMeshFile, sizeof(vertexMeshFile), name.data(), 32);
|
||||
strncpy(vertexMeshFile, name.data(), sizeof(vertexMeshFile));
|
||||
}
|
||||
void setMeshFile(std::string_view name)
|
||||
{
|
||||
std::memset(vertexMeshFile, 0, sizeof(vertexMeshFile));
|
||||
useMeshShading = 1;
|
||||
strncpy_s(vertexMeshFile, sizeof(vertexMeshFile), name.data(), 32);
|
||||
strncpy(vertexMeshFile, name.data(), sizeof(vertexMeshFile));
|
||||
}
|
||||
void setFragmentFile(std::string_view name)
|
||||
{
|
||||
std::memset(fragmentFile, 0, sizeof(fragmentFile));
|
||||
hasFragment = 1;
|
||||
strncpy_s(fragmentFile, sizeof(fragmentFile), name.data(), 32);
|
||||
strncpy(fragmentFile, name.data(), sizeof(fragmentFile));
|
||||
}
|
||||
void setVertexData(std::string_view name)
|
||||
{
|
||||
std::memset(vertexDataName, 0, sizeof(vertexDataName));
|
||||
strncpy_s(vertexDataName, sizeof(vertexDataName), name.data(), 32);
|
||||
strncpy(vertexDataName, name.data(), sizeof(vertexDataName));
|
||||
}
|
||||
void setMaterial(std::string_view name)
|
||||
{
|
||||
std::memset(materialName, 0, sizeof(materialName));
|
||||
useMaterial = 1;
|
||||
strncpy_s(materialName, sizeof(materialName), name.data(), 32);
|
||||
strncpy(materialName, name.data(), sizeof(materialName));
|
||||
}
|
||||
};
|
||||
//Hashed ShaderPermutation for fast lookup
|
||||
|
||||
@@ -261,8 +261,8 @@ uint32 Allocator::findMemoryType(uint32 typeFilter, VkMemoryPropertyFlags proper
|
||||
|
||||
StagingBuffer::StagingBuffer(PGraphics graphics, OSubAllocation allocation, VkBuffer buffer, VkDeviceSize size, Gfx::QueueType owner)
|
||||
: owner(owner)
|
||||
, graphics(graphics)
|
||||
, allocation(std::move(allocation))
|
||||
, graphics(graphics)
|
||||
, buffer(buffer)
|
||||
, size(size)
|
||||
{
|
||||
|
||||
@@ -59,19 +59,19 @@ class UniformBuffer : public Gfx::UniformBuffer, public Buffer
|
||||
public:
|
||||
UniformBuffer(PGraphics graphics, const UniformBufferCreateInfo &sourceData);
|
||||
virtual ~UniformBuffer();
|
||||
virtual bool updateContents(const DataSource &sourceData);
|
||||
virtual bool updateContents(const DataSource &sourceData) override;
|
||||
|
||||
virtual void* map(bool writeOnly = true) override;
|
||||
virtual void unmap() override;
|
||||
protected:
|
||||
// Inherited via Vulkan::Buffer
|
||||
virtual VkAccessFlags getSourceAccessMask();
|
||||
virtual VkAccessFlags getDestAccessMask();
|
||||
virtual void requestOwnershipTransfer(Gfx::QueueType newOwner);
|
||||
virtual VkAccessFlags getSourceAccessMask() override;
|
||||
virtual VkAccessFlags getDestAccessMask() override;
|
||||
virtual void requestOwnershipTransfer(Gfx::QueueType newOwner) override;
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner) override;
|
||||
virtual void executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage,
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage);
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage) override;
|
||||
|
||||
private:
|
||||
OStagingBuffer dedicatedStagingBuffer;
|
||||
@@ -83,19 +83,19 @@ class ShaderBuffer : public Gfx::ShaderBuffer, public Buffer
|
||||
public:
|
||||
ShaderBuffer(PGraphics graphics, const ShaderBufferCreateInfo &sourceData);
|
||||
virtual ~ShaderBuffer();
|
||||
virtual bool updateContents(const DataSource &sourceData);
|
||||
virtual bool updateContents(const DataSource &sourceData) override;
|
||||
|
||||
virtual void* map(bool writeOnly = true) override;
|
||||
virtual void unmap() override;
|
||||
protected:
|
||||
// Inherited via Vulkan::Buffer
|
||||
virtual VkAccessFlags getSourceAccessMask();
|
||||
virtual VkAccessFlags getDestAccessMask();
|
||||
virtual void requestOwnershipTransfer(Gfx::QueueType newOwner);
|
||||
virtual VkAccessFlags getSourceAccessMask() override;
|
||||
virtual VkAccessFlags getDestAccessMask() override;
|
||||
virtual void requestOwnershipTransfer(Gfx::QueueType newOwner) override;
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner) override;
|
||||
virtual void executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage,
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage);
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage) override;
|
||||
private:
|
||||
OStagingBuffer dedicatedStagingBuffer;
|
||||
};
|
||||
@@ -111,13 +111,13 @@ public:
|
||||
virtual void download(Array<uint8>& buffer) override;
|
||||
protected:
|
||||
// Inherited via Vulkan::Buffer
|
||||
virtual VkAccessFlags getSourceAccessMask();
|
||||
virtual VkAccessFlags getDestAccessMask();
|
||||
virtual void requestOwnershipTransfer(Gfx::QueueType newOwner);
|
||||
virtual VkAccessFlags getSourceAccessMask() override;
|
||||
virtual VkAccessFlags getDestAccessMask() override;
|
||||
virtual void requestOwnershipTransfer(Gfx::QueueType newOwner) override;
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner) override;
|
||||
virtual void executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage,
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage);
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage) override;
|
||||
};
|
||||
DEFINE_REF(VertexBuffer)
|
||||
|
||||
@@ -130,13 +130,13 @@ public:
|
||||
virtual void download(Array<uint8>& buffer) override;
|
||||
protected:
|
||||
// Inherited via Vulkan::Buffer
|
||||
virtual VkAccessFlags getSourceAccessMask();
|
||||
virtual VkAccessFlags getDestAccessMask();
|
||||
virtual void requestOwnershipTransfer(Gfx::QueueType newOwner);
|
||||
virtual VkAccessFlags getSourceAccessMask() override;
|
||||
virtual VkAccessFlags getDestAccessMask() override;
|
||||
virtual void requestOwnershipTransfer(Gfx::QueueType newOwner) override;
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner) override;
|
||||
virtual void executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage,
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage);
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage) override;
|
||||
};
|
||||
DEFINE_REF(IndexBuffer)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "Queue.h"
|
||||
#include "Graphics/Command.h"
|
||||
#include "Buffer.h"
|
||||
#include <thread>
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
DescriptorPool(PGraphics graphics, DescriptorLayout &layout);
|
||||
virtual ~DescriptorPool();
|
||||
virtual Gfx::PDescriptorSet allocateDescriptorSet() override;
|
||||
virtual void reset();
|
||||
virtual void reset() override;
|
||||
|
||||
constexpr VkDescriptorPool getHandle() const
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "Graphics/Enums.h"
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#define VK_CHECK(f) \
|
||||
{ \
|
||||
|
||||
@@ -583,28 +583,28 @@ void Graphics::createDevice(GraphicsInitializer initializer)
|
||||
|
||||
cmdDrawMeshTasks = (PFN_vkCmdDrawMeshTasksEXT)vkGetDeviceProcAddr(handle, "vkCmdDrawMeshTasksEXT");
|
||||
|
||||
graphicsQueue = new Queue(this, Gfx::QueueType::GRAPHICS, graphicsQueueInfo.familyIndex, 0);
|
||||
graphicsQueue = new Queue(this, graphicsQueueInfo.familyIndex, 0);
|
||||
if (Gfx::useAsyncCompute && asyncComputeInfo.familyIndex != -1)
|
||||
{
|
||||
if (asyncComputeInfo.familyIndex == graphicsQueueInfo.familyIndex)
|
||||
{
|
||||
// Same family as graphics, but different queue
|
||||
computeQueue = new Queue(this, Gfx::QueueType::COMPUTE, asyncComputeInfo.familyIndex, 1);
|
||||
computeQueue = new Queue(this, asyncComputeInfo.familyIndex, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Different family
|
||||
computeQueue = new Queue(this, Gfx::QueueType::COMPUTE, asyncComputeInfo.familyIndex, 0);
|
||||
computeQueue = new Queue(this, asyncComputeInfo.familyIndex, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
computeQueue = new Queue(this, Gfx::QueueType::COMPUTE, computeQueueInfo.familyIndex, 0);
|
||||
computeQueue = new Queue(this, computeQueueInfo.familyIndex, 0);
|
||||
}
|
||||
transferQueue = new Queue(this, Gfx::QueueType::TRANSFER, transferQueueInfo.familyIndex, 0);
|
||||
transferQueue = new Queue(this, transferQueueInfo.familyIndex, 0);
|
||||
if (dedicatedTransferQueueInfo.familyIndex != -1)
|
||||
{
|
||||
dedicatedTransferQueue = new Queue(this, Gfx::QueueType::DEDICATED_TRANSFER, dedicatedTransferQueueInfo.familyIndex, 0);
|
||||
dedicatedTransferQueue = new Queue(this, dedicatedTransferQueueInfo.familyIndex, 0);
|
||||
}
|
||||
queueMapping.graphicsFamily = graphicsQueue->getFamilyIndex();
|
||||
queueMapping.computeFamily = computeQueue->getFamilyIndex();
|
||||
|
||||
@@ -36,7 +36,7 @@ PipelineCache::PipelineCache(PGraphics graphics, const std::string& cacheFilePat
|
||||
|
||||
PipelineCache::~PipelineCache()
|
||||
{
|
||||
VkDeviceSize cacheSize;
|
||||
size_t cacheSize;
|
||||
VK_CHECK(vkGetPipelineCacheData(graphics->getDevice(), cache, &cacheSize, nullptr));
|
||||
Array<uint8> cacheData(cacheSize);
|
||||
VK_CHECK(vkGetPipelineCacheData(graphics->getDevice(), cache, &cacheSize, cacheData.data()));
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
using namespace Seele;
|
||||
using namespace Seele::Vulkan;
|
||||
|
||||
Queue::Queue(PGraphics graphics, Gfx::QueueType queueType, uint32 familyIndex, uint32 queueIndex)
|
||||
Queue::Queue(PGraphics graphics, uint32 familyIndex, uint32 queueIndex)
|
||||
: graphics(graphics)
|
||||
, familyIndex(familyIndex)
|
||||
, queueType(queueType)
|
||||
{
|
||||
vkGetDeviceQueue(graphics->getDevice(), familyIndex, queueIndex, &queue);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ DECLARE_REF(Graphics)
|
||||
class Queue
|
||||
{
|
||||
public:
|
||||
Queue(PGraphics graphics, Gfx::QueueType queueType, uint32 familyIndex, uint32 queueIndex);
|
||||
Queue(PGraphics graphics, uint32 familyIndex, uint32 queueIndex);
|
||||
virtual ~Queue();
|
||||
void submitCommandBuffer(PCommand command, const Array<VkSemaphore>& signalSemaphore);
|
||||
constexpr uint32 getFamilyIndex() const
|
||||
@@ -27,7 +27,6 @@ private:
|
||||
PGraphics graphics;
|
||||
VkQueue queue;
|
||||
uint32 familyIndex;
|
||||
Gfx::QueueType queueType;
|
||||
};
|
||||
DEFINE_REF(Queue)
|
||||
} // namespace Vulkan
|
||||
|
||||
@@ -125,9 +125,9 @@ public:
|
||||
|
||||
protected:
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner) override;
|
||||
virtual void executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage,
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage);
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage) override;
|
||||
|
||||
};
|
||||
DEFINE_REF(Texture2D)
|
||||
@@ -166,9 +166,9 @@ public:
|
||||
|
||||
protected:
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner) override;
|
||||
virtual void executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage,
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage);
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage) override;
|
||||
|
||||
};
|
||||
DEFINE_REF(Texture3D)
|
||||
@@ -206,9 +206,9 @@ public:
|
||||
virtual void download(uint32 mipLevel, uint32 arrayLayer, uint32 face, Array<uint8>& buffer) override;
|
||||
protected:
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner) override;
|
||||
virtual void executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage,
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage);
|
||||
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage) override;
|
||||
};
|
||||
DEFINE_REF(TextureCube)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
virtual void setMouseButtonCallback(std::function<void(MouseButton, InputAction, KeyModifier)> callback) override;
|
||||
virtual void setScrollCallback(std::function<void(double, double)> callback) override;
|
||||
virtual void setFileCallback(std::function<void(int, const char**)> callback) override;
|
||||
virtual void setCloseCallback(std::function<void()> callback);
|
||||
virtual void setCloseCallback(std::function<void()> callback) override;
|
||||
virtual void setResizeCallback(std::function<void(uint32, uint32)> callback) override;
|
||||
|
||||
void keyPress(KeyCode code, InputAction action, KeyModifier modifier);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "MaterialInstance.h"
|
||||
#include "Graphics/Graphics.h"
|
||||
#include "Graphics/Shader.h"
|
||||
#include <fstream>
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Graphics/Graphics.h"
|
||||
#include "Graphics/Descriptor.h"
|
||||
#include <format>
|
||||
#include <fstream>
|
||||
#include <fmt/core.h>
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
@@ -281,9 +282,9 @@ ConstantExpression::~ConstantExpression()
|
||||
|
||||
std::string ConstantExpression::evaluate(Map<std::string, std::string>& varState) const
|
||||
{
|
||||
std::string varName = std::format("const_exp_{}", key);
|
||||
std::string varName = fmt::format("const_exp_{}", key);
|
||||
varState[key] = varName;
|
||||
return std::format("let {} = {};\n", varName, expr);
|
||||
return fmt::format("let {} = {};\n", varName, expr);
|
||||
}
|
||||
|
||||
void ConstantExpression::save(ArchiveBuffer& buffer) const
|
||||
@@ -310,9 +311,9 @@ AddExpression::~AddExpression()
|
||||
|
||||
std::string AddExpression::evaluate(Map<std::string, std::string>& varState) const
|
||||
{
|
||||
std::string varName = std::format("exp_{}", key);
|
||||
std::string varName = fmt::format("exp_{}", key);
|
||||
varState[key] = varName;
|
||||
return std::format("let {} = {} + {};\n", varName, varState[inputs.at("lhs").source], varState[inputs.at("rhs").source]);
|
||||
return fmt::format("let {} = {} + {};\n", varName, varState[inputs.at("lhs").source], varState[inputs.at("rhs").source]);
|
||||
}
|
||||
|
||||
void AddExpression::save(ArchiveBuffer& buffer) const
|
||||
@@ -327,9 +328,9 @@ void AddExpression::load(ArchiveBuffer& buffer)
|
||||
|
||||
std::string SubExpression::evaluate(Map<std::string, std::string>& varState) const
|
||||
{
|
||||
std::string varName = std::format("exp_{}", key);
|
||||
std::string varName = fmt::format("exp_{}", key);
|
||||
varState[key] = varName;
|
||||
return std::format("let {} = {} - {};\n", varName, varState[inputs.at("lhs").source], varState[inputs.at("rhs").source]);
|
||||
return fmt::format("let {} = {} - {};\n", varName, varState[inputs.at("lhs").source], varState[inputs.at("rhs").source]);
|
||||
}
|
||||
|
||||
void SubExpression::save(ArchiveBuffer& buffer) const
|
||||
@@ -344,9 +345,9 @@ void SubExpression::load(ArchiveBuffer& buffer)
|
||||
|
||||
std::string MulExpression::evaluate(Map<std::string, std::string>& varState) const
|
||||
{
|
||||
std::string varName = std::format("exp_{}", key);
|
||||
std::string varName = fmt::format("exp_{}", key);
|
||||
varState[key] = varName;
|
||||
return std::format("let {} = {} * {};\n", varName, varState[inputs.at("lhs").source], varState[inputs.at("rhs").source]);
|
||||
return fmt::format("let {} = {} * {};\n", varName, varState[inputs.at("lhs").source], varState[inputs.at("rhs").source]);
|
||||
}
|
||||
|
||||
void MulExpression::save(ArchiveBuffer& buffer) const
|
||||
@@ -361,7 +362,7 @@ void MulExpression::load(ArchiveBuffer& buffer)
|
||||
|
||||
std::string SwizzleExpression::evaluate(Map<std::string, std::string>& varState) const
|
||||
{
|
||||
std::string varName = std::format("exp_{}", key);
|
||||
std::string varName = fmt::format("exp_{}", key);
|
||||
std::string swizzle = "";
|
||||
for(uint32 i = 0; i < 4; ++i)
|
||||
{
|
||||
@@ -388,7 +389,7 @@ std::string SwizzleExpression::evaluate(Map<std::string, std::string>& varState)
|
||||
}
|
||||
}
|
||||
varState[key] = varName;
|
||||
return std::format("let {} = {}.{};\n", varName, varState[inputs.at("target").source], swizzle);
|
||||
return fmt::format("let {} = {}.{};\n", varName, varState[inputs.at("target").source], swizzle);
|
||||
}
|
||||
|
||||
void SwizzleExpression::save(ArchiveBuffer& buffer) const
|
||||
@@ -405,9 +406,9 @@ void SwizzleExpression::load(ArchiveBuffer& buffer)
|
||||
|
||||
std::string SampleExpression::evaluate(Map<std::string, std::string>& varState) const
|
||||
{
|
||||
std::string varName = std::format("exp_{}", key);
|
||||
std::string varName = fmt::format("exp_{}", key);
|
||||
varState[key] = varName;
|
||||
return std::format("let {} = {}.Sample({}, {});\n", varName, varState[inputs.at("texture").source], varState[inputs.at("sampler").source], varState[inputs.at("coords").source]);
|
||||
return fmt::format("let {} = {}.Sample({}, {});\n", varName, varState[inputs.at("texture").source], varState[inputs.at("sampler").source], varState[inputs.at("coords").source]);
|
||||
}
|
||||
|
||||
void SampleExpression::save(ArchiveBuffer& buffer) const
|
||||
|
||||
@@ -58,10 +58,10 @@ 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;
|
||||
virtual void generateDeclaration(std::ofstream& stream) const = 0;
|
||||
virtual uint64 getIdentifier() const = 0;
|
||||
virtual uint64 getIdentifier() const override = 0;
|
||||
virtual std::string evaluate(Map<std::string, std::string>& varState) const override;
|
||||
virtual void save(ArchiveBuffer& buffer) const;
|
||||
virtual void load(ArchiveBuffer& buffer);
|
||||
virtual void save(ArchiveBuffer& buffer) const override;
|
||||
virtual void load(ArchiveBuffer& buffer) override;
|
||||
};
|
||||
DEFINE_REF(ShaderParameter)
|
||||
struct FloatParameter : public ShaderParameter
|
||||
@@ -145,7 +145,7 @@ struct ConstantExpression : public ShaderExpression
|
||||
ConstantExpression();
|
||||
ConstantExpression(std::string expr, ExpressionType type);
|
||||
virtual ~ConstantExpression();
|
||||
virtual uint64 getIdentifier() const { return IDENTIFIER; }
|
||||
virtual uint64 getIdentifier() const override { return IDENTIFIER; }
|
||||
virtual std::string evaluate(Map<std::string, std::string>& varState) const override;
|
||||
virtual void save(ArchiveBuffer& buffer) const override;
|
||||
virtual void load(ArchiveBuffer& buffer) override;
|
||||
@@ -156,7 +156,7 @@ struct AddExpression : public ShaderExpression
|
||||
static constexpr uint64 IDENTIFIER = 0x12;
|
||||
AddExpression();
|
||||
virtual ~AddExpression();
|
||||
virtual uint64 getIdentifier() const { return IDENTIFIER; }
|
||||
virtual uint64 getIdentifier() const override { return IDENTIFIER; }
|
||||
virtual std::string evaluate(Map<std::string, std::string>& varState) const override;
|
||||
virtual void save(ArchiveBuffer& buffer) const override;
|
||||
virtual void load(ArchiveBuffer& buffer) override;
|
||||
@@ -167,7 +167,7 @@ struct SubExpression : public ShaderExpression
|
||||
static constexpr uint64 IDENTIFIER = 0x13;
|
||||
SubExpression() {}
|
||||
virtual ~SubExpression() {}
|
||||
virtual uint64 getIdentifier() const { return IDENTIFIER; }
|
||||
virtual uint64 getIdentifier() const override { return IDENTIFIER; }
|
||||
virtual std::string evaluate(Map<std::string, std::string>& varState) const override;
|
||||
virtual void save(ArchiveBuffer& buffer) const override;
|
||||
virtual void load(ArchiveBuffer& buffer) override;
|
||||
@@ -178,7 +178,7 @@ struct MulExpression : public ShaderExpression
|
||||
static constexpr uint64 IDENTIFIER = 0x14;
|
||||
MulExpression() {}
|
||||
virtual ~MulExpression() {}
|
||||
virtual uint64 getIdentifier() const { return IDENTIFIER; }
|
||||
virtual uint64 getIdentifier() const override { return IDENTIFIER; }
|
||||
virtual std::string evaluate(Map<std::string, std::string>& varState) const override;
|
||||
virtual void save(ArchiveBuffer& buffer) const override;
|
||||
virtual void load(ArchiveBuffer& buffer) override;
|
||||
@@ -190,7 +190,7 @@ struct SwizzleExpression : public ShaderExpression
|
||||
StaticArray<int32, 4> comp = {-1, -1, -1, -1};
|
||||
SwizzleExpression() {}
|
||||
virtual ~SwizzleExpression() {}
|
||||
virtual uint64 getIdentifier() const { return IDENTIFIER; }
|
||||
virtual uint64 getIdentifier() const override { return IDENTIFIER; }
|
||||
virtual std::string evaluate(Map<std::string, std::string>& varState) const override;
|
||||
virtual void save(ArchiveBuffer& buffer) const override;
|
||||
virtual void load(ArchiveBuffer& buffer) override;
|
||||
@@ -201,7 +201,7 @@ struct SampleExpression : public ShaderExpression
|
||||
static constexpr uint64 IDENTIFIER = 0x16;
|
||||
SampleExpression() {}
|
||||
virtual ~SampleExpression() {}
|
||||
virtual uint64 getIdentifier() const { return IDENTIFIER; }
|
||||
virtual uint64 getIdentifier() const override { return IDENTIFIER; }
|
||||
virtual std::string evaluate(Map<std::string, std::string>& varState) const override;
|
||||
virtual void save(ArchiveBuffer& buffer) const override;
|
||||
virtual void load(ArchiveBuffer& buffer) override;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "Vector.h"
|
||||
#include <regex>
|
||||
#include <format>
|
||||
#include <fmt/core.h>
|
||||
#include <sstream>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "Serialization/ArchiveBuffer.h"
|
||||
|
||||
@@ -8,7 +9,7 @@ using namespace Seele;
|
||||
|
||||
void to_json(nlohmann::json& j, const Vector& vec)
|
||||
{
|
||||
j = nlohmann::json{std::format("({}, {}, {})", vec.x, vec.y, vec.z)};
|
||||
j = nlohmann::json{fmt::format("({}, {}, {})", vec.x, vec.y, vec.z)};
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json& j, Vector& vec)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#pragma once
|
||||
#include "EngineTypes.h"
|
||||
#include <map>
|
||||
#include <assert.h>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
|
||||
#define DEFINE_REF(x) \
|
||||
typedef ::Seele::RefPtr<x> P##x; \
|
||||
|
||||
@@ -339,7 +339,16 @@ int32 BVH::splitNode(Array<AABBCenter> aabbs)
|
||||
{
|
||||
longestAxis = 2;
|
||||
}
|
||||
std::sort(aabbs.begin(), aabbs.end(), [longestAxis](AABBCenter lhs, AABBCenter rhs){ return lhs.center[longestAxis] < rhs.center[longestAxis];});
|
||||
struct
|
||||
{
|
||||
bool operator()(const AABBCenter& lhs, const AABBCenter& rhs)
|
||||
{
|
||||
return lhs.center[longestAxis] < rhs.center[longestAxis];
|
||||
}
|
||||
int32 longestAxis;
|
||||
} compare = {longestAxis};
|
||||
|
||||
std::sort(aabbs.begin(), aabbs.end(), compare);
|
||||
Array<AABBCenter> left((aabbs.size()+1)/2);
|
||||
Array<AABBCenter> right(aabbs.size()/2);
|
||||
std::copy(aabbs.begin(), aabbs.begin()+left.size(), left.begin());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "PhysicsSystem.h"
|
||||
#include <random>
|
||||
#include <iostream>
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::Component;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
if(WIN32)
|
||||
add_subdirectory(Windows/)
|
||||
elseif(APPLE)
|
||||
add_subdirectory(Mac/)
|
||||
else()
|
||||
add_subdirectory(Linux/)
|
||||
endif()
|
||||
@@ -18,7 +18,7 @@ Game* GameInterface::getGame()
|
||||
return game;
|
||||
}
|
||||
|
||||
void GameInterface::reload(AssetRegistry* registry)
|
||||
void GameInterface::reload()
|
||||
{
|
||||
if(lib != NULL)
|
||||
{
|
||||
@@ -28,5 +28,5 @@ void GameInterface::reload(AssetRegistry* registry)
|
||||
lib = dlopen(soPath.c_str(), RTLD_NOW);
|
||||
createInstance = (decltype(createInstance))dlsym(lib, "createInstance");
|
||||
destroyInstance = (decltype(destroyInstance))dlsym(lib, "destroyInstance");
|
||||
game = createInstance(registry);
|
||||
game = createInstance();
|
||||
}
|
||||
@@ -10,12 +10,12 @@ public:
|
||||
GameInterface(std::string soPath);
|
||||
~GameInterface();
|
||||
Game* getGame();
|
||||
void reload(AssetRegistry* registry);
|
||||
void reload();
|
||||
private:
|
||||
void* lib;
|
||||
std::string soPath;
|
||||
Game* game;
|
||||
Game* (*createInstance)(AssetRegistry*) = nullptr;
|
||||
Game* (*createInstance)() = nullptr;
|
||||
void (*destroyInstance)(Game*) = nullptr;
|
||||
};
|
||||
} // namespace Seele
|
||||
@@ -0,0 +1,10 @@
|
||||
target_sources(Engine
|
||||
PRIVATE
|
||||
GameInterface.h
|
||||
GameInterface.cpp)
|
||||
|
||||
|
||||
target_sources(Engine
|
||||
PUBLIC FILE_SET HEADERS
|
||||
FILES
|
||||
GameInterface.h)
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "GameInterface.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
GameInterface::GameInterface(std::string soPath)
|
||||
: lib(NULL)
|
||||
, soPath(soPath)
|
||||
{
|
||||
}
|
||||
|
||||
GameInterface::~GameInterface()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Game* GameInterface::getGame()
|
||||
{
|
||||
return game;
|
||||
}
|
||||
|
||||
void GameInterface::reload()
|
||||
{
|
||||
if(lib != NULL)
|
||||
{
|
||||
destroyInstance(game);
|
||||
dlclose(lib);
|
||||
}
|
||||
lib = dlopen(soPath.c_str(), RTLD_NOW);
|
||||
createInstance = (decltype(createInstance))dlsym(lib, "createInstance");
|
||||
destroyInstance = (decltype(destroyInstance))dlsym(lib, "destroyInstance");
|
||||
game = createInstance();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "Game.h"
|
||||
#include "dlfcn.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
class GameInterface
|
||||
{
|
||||
public:
|
||||
GameInterface(std::string soPath);
|
||||
~GameInterface();
|
||||
Game* getGame();
|
||||
void reload();
|
||||
private:
|
||||
void* lib;
|
||||
std::string soPath;
|
||||
Game* game;
|
||||
Game* (*createInstance)() = nullptr;
|
||||
void (*destroyInstance)(Game*) = nullptr;
|
||||
};
|
||||
} // namespace Seele
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "ArchiveBuffer.h"
|
||||
#include "Graphics/Graphics.h"
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
SystemBase::run(pool, delta);
|
||||
setupView((getDependencies<Components>() | ...), pool);
|
||||
}
|
||||
virtual void update() {}
|
||||
virtual void update() override {}
|
||||
virtual void update(Components&... components) = 0;
|
||||
};
|
||||
} // namespace System
|
||||
|
||||
@@ -6,8 +6,8 @@ using namespace Seele;
|
||||
|
||||
View::View(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &viewportInfo, std::string name)
|
||||
: graphics(graphics)
|
||||
, owner(window)
|
||||
, createInfo(viewportInfo)
|
||||
, owner(window)
|
||||
, name(name)
|
||||
{
|
||||
viewport = graphics->createViewport(owner->getGfxHandle(), viewportInfo);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"glm",
|
||||
"ktx",
|
||||
"nlohmann-json",
|
||||
"fmt",
|
||||
"shader-slang",
|
||||
"gtest"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user