Fixing missing includes
This commit is contained in:
Vendored
+8
-9
@@ -41,23 +41,22 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceRoot}/build/Editor",
|
"program": "${workspaceRoot}/build/Editor",
|
||||||
"args": [],
|
"args": [],
|
||||||
"stopAtEntry": false,
|
"environment": [
|
||||||
|
{
|
||||||
|
"name": "ASAN_OPTIONS",
|
||||||
|
"value": "alloc_dealloc_mismatch=0",
|
||||||
|
}
|
||||||
|
],
|
||||||
"cwd": "${workspaceRoot}/build",
|
"cwd": "${workspaceRoot}/build",
|
||||||
"environment": [],
|
|
||||||
"externalConsole": false,
|
|
||||||
"MIMode": "gdb",
|
"MIMode": "gdb",
|
||||||
|
"miDebuggerPath": "/usr/bin/gdb",
|
||||||
"setupCommands": [
|
"setupCommands": [
|
||||||
{
|
{
|
||||||
"description": "Enable pretty-printing for gdb",
|
"description": "Enable pretty-printing for gdb",
|
||||||
"text": "-enable-pretty-printing",
|
"text": "-enable-pretty-printing",
|
||||||
"ignoreFailures": true
|
"ignoreFailures": true
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "Set Disassembly Flavor to Intel",
|
|
||||||
"text": "-gdb-set disassembly-flavor intel",
|
|
||||||
"ignoreFailures": true
|
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Vendored
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
"lldb.showDisassembly": "auto",
|
"lldb.showDisassembly": "auto",
|
||||||
"lldb.dereferencePointers": true,
|
"lldb.dereferencePointers": true,
|
||||||
"lldb.consoleMode": "commands",
|
"lldb.consoleMode": "commands",
|
||||||
"cmake.generator": "Ninja",
|
"cmake.generator": "Unix Makefiles",
|
||||||
"editor.tabSize": 4,
|
"editor.tabSize": 4,
|
||||||
"slang.additionalSearchPaths": [
|
"slang.additionalSearchPaths": [
|
||||||
"res/shaders/",
|
"res/shaders/",
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ if(WIN32)
|
|||||||
set(VCPKG_BASE_FOLDER ${CMAKE_BINARY_DIR}/vcpkg_installed/x64-windows/)
|
set(VCPKG_BASE_FOLDER ${CMAKE_BINARY_DIR}/vcpkg_installed/x64-windows/)
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
set(VCPKG_BASE_FOLDER ${CMAKE_BINARY_DIR}/vcpkg_installed/arm64-osx/)
|
set(VCPKG_BASE_FOLDER ${CMAKE_BINARY_DIR}/vcpkg_installed/arm64-osx/)
|
||||||
|
else()
|
||||||
|
set(VCPKG_BASE_FOLDER ${CMAKE_BINARY_DIR}/vcpkg_installed/x64-linux/)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(Boost_NO_WARN_NEW_VERSIONS 1)
|
set(Boost_NO_WARN_NEW_VERSIONS 1)
|
||||||
@@ -81,6 +83,9 @@ if(WIN32)
|
|||||||
target_link_libraries(Engine PUBLIC ${VCPKG_BASE_FOLDER}/lib/slang.lib)
|
target_link_libraries(Engine PUBLIC ${VCPKG_BASE_FOLDER}/lib/slang.lib)
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
target_link_libraries(Engine PUBLIC ${VCPKG_BASE_FOLDER}/debug/lib/libslang.dylib)
|
target_link_libraries(Engine PUBLIC ${VCPKG_BASE_FOLDER}/debug/lib/libslang.dylib)
|
||||||
|
else()
|
||||||
|
target_link_libraries(Engine PUBLIC ${VCPKG_BASE_FOLDER}/lib/libslang.so)
|
||||||
|
target_link_libraries(Engine PUBLIC ${VCPKG_BASE_FOLDER}/lib/libslang-glslang.so)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"cmakeMinimumRequired": {
|
||||||
|
"major": 3,
|
||||||
|
"minor": 19,
|
||||||
|
"patch": 0
|
||||||
|
},
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"displayName": "Default (Release)",
|
||||||
|
"description": "Release build without sanitizers",
|
||||||
|
"binaryDir": "${sourceDir}/build",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "default-asan",
|
||||||
|
"displayName": "Default (Release + ASan)",
|
||||||
|
"description": "Release build with Address Sanitizer",
|
||||||
|
"binaryDir": "${sourceDir}/build",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release",
|
||||||
|
"CMAKE_CXX_FLAGS": "-fsanitize=address -fno-omit-frame-pointer",
|
||||||
|
"CMAKE_C_FLAGS": "-fsanitize=address -fno-omit-frame-pointer",
|
||||||
|
"CMAKE_EXE_LINKER_FLAGS": "-fsanitize=address",
|
||||||
|
"CMAKE_SHARED_LINKER_FLAGS": "-fsanitize=address"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "debug",
|
||||||
|
"displayName": "Debug (no ASan)",
|
||||||
|
"description": "Debug build without sanitizers",
|
||||||
|
"binaryDir": "${sourceDir}/build",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "debug-asan",
|
||||||
|
"displayName": "Debug (ASan)",
|
||||||
|
"description": "Debug build with Address Sanitizer",
|
||||||
|
"binaryDir": "${sourceDir}/build",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_CXX_FLAGS": "-fsanitize=address -fno-omit-frame-pointer",
|
||||||
|
"CMAKE_C_FLAGS": "-fsanitize=address -fno-omit-frame-pointer",
|
||||||
|
"CMAKE_EXE_LINKER_FLAGS": "-fsanitize=address",
|
||||||
|
"CMAKE_SHARED_LINKER_FLAGS": "-fsanitize=address"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"buildType": {
|
|
||||||
"default": "debug",
|
|
||||||
"description": "Configuration Type",
|
|
||||||
"choices": {
|
|
||||||
"asan": {
|
|
||||||
"short": "ASan",
|
|
||||||
"long": "Address Sanitizer",
|
|
||||||
"buildType": "Asan"
|
|
||||||
},
|
|
||||||
"debug": {
|
|
||||||
"short": "Debug",
|
|
||||||
"long": "Enable debugging and validation",
|
|
||||||
"buildType": "Debug"
|
|
||||||
},
|
|
||||||
"release": {
|
|
||||||
"short": "Release",
|
|
||||||
"long": "Optimize binary for speed",
|
|
||||||
"buildType": "Release"
|
|
||||||
},
|
|
||||||
"relwithdebinfo": {
|
|
||||||
"short": "RelWithDebInfo",
|
|
||||||
"long": "Release with debug symbols",
|
|
||||||
"buildType": "RelWithDebInfo"
|
|
||||||
},
|
|
||||||
"minsizerel": {
|
|
||||||
"short": "MinSizeRel",
|
|
||||||
"long": "Minimal size Release",
|
|
||||||
"buildType": "MinSizeRel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"architecture": {
|
|
||||||
"default": "x64",
|
|
||||||
"description": "Platform Architecture",
|
|
||||||
"choices": {
|
|
||||||
"x64": {
|
|
||||||
"short": "x64",
|
|
||||||
"long": "amd64 platform",
|
|
||||||
"settings": {
|
|
||||||
"CMAKE_PLATFORM": "x64"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"arm64": {
|
|
||||||
"short": "arm64",
|
|
||||||
"long": "arm64 platform",
|
|
||||||
"settings": {
|
|
||||||
"CMAKE_PLATFORM": "arm64"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -66,7 +66,7 @@ int main() {
|
|||||||
// .importPath = "sponza",
|
// .importPath = "sponza",
|
||||||
//});
|
//});
|
||||||
AssetImporter::importMesh(MeshImportArgs{
|
AssetImporter::importMesh(MeshImportArgs{
|
||||||
.filePath = sourcePath / "import" / "models" / "rttest.glb",
|
.filePath = sourcePath / "import" / "models" / "rttest.gltf",
|
||||||
.importPath = "rttest",
|
.importPath = "rttest",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "MemoryResource.h"
|
#include "MemoryResource.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <cstring>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <memory_resource>
|
#include <memory_resource>
|
||||||
@@ -423,6 +424,7 @@ template <typename T> struct Array {
|
|||||||
}
|
}
|
||||||
arraySize = newSize;
|
arraySize = newSize;
|
||||||
} else {
|
} else {
|
||||||
|
size_t oldSize = allocated;
|
||||||
allocated = calculateGrowth(newSize);
|
allocated = calculateGrowth(newSize);
|
||||||
// The array is not big enough, so we make a new one
|
// The array is not big enough, so we make a new one
|
||||||
T* newData = allocateArray(allocated);
|
T* newData = allocateArray(allocated);
|
||||||
@@ -438,7 +440,7 @@ template <typename T> struct Array {
|
|||||||
std::allocator_traits<allocator_type>::construct(allocator, &newData[i], value);
|
std::allocator_traits<allocator_type>::construct(allocator, &newData[i], value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deallocateArray(_data, allocated);
|
deallocateArray(_data, oldSize);
|
||||||
arraySize = newSize;
|
arraySize = newSize;
|
||||||
_data = newData;
|
_data = newData;
|
||||||
}
|
}
|
||||||
@@ -520,6 +522,7 @@ template <typename T, size_t N> struct StaticArray {
|
|||||||
beginIt = iterator(_data);
|
beginIt = iterator(_data);
|
||||||
endIt = iterator(_data + N);
|
endIt = iterator(_data + N);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr StaticArray(T value) {
|
constexpr StaticArray(T value) {
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
_data[i] = value;
|
_data[i] = value;
|
||||||
@@ -527,6 +530,7 @@ template <typename T, size_t N> struct StaticArray {
|
|||||||
beginIt = iterator(_data);
|
beginIt = iterator(_data);
|
||||||
endIt = iterator(_data + N);
|
endIt = iterator(_data + N);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr StaticArray(std::initializer_list<T> init) {
|
constexpr StaticArray(std::initializer_list<T> init) {
|
||||||
auto beg = init.begin();
|
auto beg = init.begin();
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "MemoryResource.h"
|
#include "MemoryResource.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ struct GraphicsInitializer {
|
|||||||
|
|
||||||
void* windowHandle;
|
void* windowHandle;
|
||||||
GraphicsInitializer()
|
GraphicsInitializer()
|
||||||
: applicationName("SeeleEngine"), engineName("SeeleEngine"), windowLayoutFile(nullptr), layers{"VK_LAYER_LUNARG_monitor"},
|
: applicationName("SeeleEngine"), engineName("SeeleEngine"), windowLayoutFile(nullptr), layers{},
|
||||||
instanceExtensions{}, deviceExtensions{"VK_KHR_swapchain"}, windowHandle(nullptr) {}
|
instanceExtensions{}, deviceExtensions{"VK_KHR_swapchain"}, windowHandle(nullptr) {}
|
||||||
};
|
};
|
||||||
struct WindowCreateInfo {
|
struct WindowCreateInfo {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "Material/Material.h"
|
#include "Material/Material.h"
|
||||||
#include "ThreadPool.h"
|
#include "ThreadPool.h"
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
using namespace Seele::Gfx;
|
using namespace Seele::Gfx;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "Graphics/VertexData.h"
|
#include "Graphics/VertexData.h"
|
||||||
#include "Mesh.h"
|
#include "Mesh.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <meshoptimizer.h>
|
#include <meshoptimizer.h>
|
||||||
#include <metis.h>
|
#include <metis.h>
|
||||||
|
#include <mutex>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
#include "vulkan/vulkan_core.h"
|
#include "vulkan/vulkan_core.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <mutex>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
@@ -201,7 +202,9 @@ DescriptorSet::DescriptorSet(PGraphics graphics, PDescriptorPool owner)
|
|||||||
boundResources.resize(owner->getLayout()->getBindings().size());
|
boundResources.resize(owner->getLayout()->getBindings().size());
|
||||||
for (uint32 i = 0; i < boundResources.size(); ++i) {
|
for (uint32 i = 0; i < boundResources.size(); ++i) {
|
||||||
boundResources[i].resize(owner->getLayout()->getBindings()[i].descriptorCount);
|
boundResources[i].resize(owner->getLayout()->getBindings()[i].descriptorCount);
|
||||||
std::memset(boundResources[i].data(), 0, sizeof(PCommandBoundResource) * boundResources[i].size());
|
for (size_t x = 0; x < boundResources[i].size(); ++x) {
|
||||||
|
boundResources[i][x] = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
constantData.resize(owner->getLayout()->constantsSize);
|
constantData.resize(owner->getLayout()->constantsSize);
|
||||||
}
|
}
|
||||||
@@ -248,7 +251,6 @@ void DescriptorSet::updateBuffer(const std::string& mappingName, uint32 index, G
|
|||||||
if (vulkanBuffer->getAlloc() == nullptr)
|
if (vulkanBuffer->getAlloc() == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
bufferInfos.add(VkDescriptorBufferInfo{
|
bufferInfos.add(VkDescriptorBufferInfo{
|
||||||
.buffer = vulkanBuffer->getHandle(),
|
.buffer = vulkanBuffer->getHandle(),
|
||||||
.offset = 0,
|
.offset = 0,
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ struct FramebufferDescription {
|
|||||||
StaticArray<VkImageView, 16> inputAttachments;
|
StaticArray<VkImageView, 16> inputAttachments;
|
||||||
StaticArray<VkImageView, 16> colorAttachments;
|
StaticArray<VkImageView, 16> colorAttachments;
|
||||||
StaticArray<VkImageView, 16> resolveAttachments;
|
StaticArray<VkImageView, 16> resolveAttachments;
|
||||||
VkImageView depthAttachment;
|
VkImageView depthAttachment = VK_NULL_HANDLE;
|
||||||
VkImageView depthResolveAttachment;
|
VkImageView depthResolveAttachment = VK_NULL_HANDLE;
|
||||||
uint32 numInputAttachments;
|
uint32 numInputAttachments = 0;
|
||||||
uint32 numColorAttachments;
|
uint32 numColorAttachments = 0;
|
||||||
uint32 numResolveAttachments;
|
uint32 numResolveAttachments = 0;
|
||||||
};
|
};
|
||||||
class Framebuffer {
|
class Framebuffer {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <numeric>
|
||||||
#include <vulkan/vulkan_core.h>
|
#include <vulkan/vulkan_core.h>
|
||||||
|
|
||||||
#define VMA_IMPLEMENTATION
|
#define VMA_IMPLEMENTATION
|
||||||
@@ -171,8 +172,8 @@ Gfx::OViewport Graphics::createViewport(Gfx::PWindow owner, const ViewportCreate
|
|||||||
return new Viewport(owner, viewportInfo);
|
return new Viewport(owner, viewportInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::ORenderPass Graphics::createRenderPass(Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, URect renderArea, std::string name,
|
Gfx::ORenderPass Graphics::createRenderPass(Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, URect renderArea,
|
||||||
Array<uint32> viewMasks, Array<uint32> correlationMasks) {
|
std::string name, Array<uint32> viewMasks, Array<uint32> correlationMasks) {
|
||||||
// todo: re-introduce render area to renderpass
|
// todo: re-introduce render area to renderpass
|
||||||
return new RenderPass(this, std::move(layout), std::move(dependencies), name, std::move(viewMasks), std::move(correlationMasks));
|
return new RenderPass(this, std::move(layout), std::move(dependencies), name, std::move(viewMasks), std::move(correlationMasks));
|
||||||
}
|
}
|
||||||
@@ -284,9 +285,7 @@ Gfx::PComputePipeline Graphics::createComputePipeline(Gfx::ComputePipelineCreate
|
|||||||
return pipelineCache->createPipeline(std::move(createInfo));
|
return pipelineCache->createPipeline(std::move(createInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::OSampler Graphics::createSampler(const SamplerCreateInfo& createInfo) {
|
Gfx::OSampler Graphics::createSampler(const SamplerCreateInfo& createInfo) { return new Sampler(this, createInfo); }
|
||||||
return new Sampler(this, createInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
Gfx::ODescriptorLayout Graphics::createDescriptorLayout(const std::string& name) { return new DescriptorLayout(this, name); }
|
Gfx::ODescriptorLayout Graphics::createDescriptorLayout(const std::string& name) { return new DescriptorLayout(this, name); }
|
||||||
|
|
||||||
@@ -450,7 +449,7 @@ void Graphics::buildBottomLevelAccelerationStructures(Array<Gfx::PBottomLevelAS>
|
|||||||
};
|
};
|
||||||
|
|
||||||
Array<VkTransformMatrixKHR> matrices;
|
Array<VkTransformMatrixKHR> matrices;
|
||||||
for (const auto gfxBlas : data) {
|
for (const auto& gfxBlas : data) {
|
||||||
const auto blas = gfxBlas.cast<BottomLevelAS>();
|
const auto blas = gfxBlas.cast<BottomLevelAS>();
|
||||||
matrices.add(blas->getTransform());
|
matrices.add(blas->getTransform());
|
||||||
}
|
}
|
||||||
@@ -765,11 +764,15 @@ void Graphics::pickPhysicalDevice() {
|
|||||||
physicalDevice = bestDevice;
|
physicalDevice = bestDevice;
|
||||||
|
|
||||||
vkGetPhysicalDeviceProperties2(physicalDevice, &props);
|
vkGetPhysicalDeviceProperties2(physicalDevice, &props);
|
||||||
|
bufferDeviceAddressFeatures = {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES,
|
||||||
|
.pNext = nullptr,
|
||||||
|
.bufferDeviceAddress = true,
|
||||||
|
};
|
||||||
rayTracingFeatures = {
|
rayTracingFeatures = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR,
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR,
|
||||||
.pNext = nullptr,
|
.pNext = &bufferDeviceAddressFeatures,
|
||||||
.rayTracingPipeline = true,
|
.rayTracingPipeline = true,
|
||||||
.rayTraversalPrimitiveCulling = true,
|
|
||||||
};
|
};
|
||||||
accelerationFeatures = {
|
accelerationFeatures = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR,
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR,
|
||||||
@@ -780,6 +783,8 @@ void Graphics::pickPhysicalDevice() {
|
|||||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT,
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT,
|
||||||
.taskShader = true,
|
.taskShader = true,
|
||||||
.meshShader = true,
|
.meshShader = true,
|
||||||
|
.multiviewMeshShader = true,
|
||||||
|
.primitiveFragmentShadingRateMeshShader = false,
|
||||||
.meshShaderQueries = true,
|
.meshShaderQueries = true,
|
||||||
};
|
};
|
||||||
features12 = {
|
features12 = {
|
||||||
@@ -825,6 +830,11 @@ void Graphics::pickPhysicalDevice() {
|
|||||||
};
|
};
|
||||||
bool rayTracingPipelineSupport = false;
|
bool rayTracingPipelineSupport = false;
|
||||||
bool accelerationStructureSupport = false;
|
bool accelerationStructureSupport = false;
|
||||||
|
bool hostOperationsSupport = false;
|
||||||
|
bool deviceAddressSupport = false;
|
||||||
|
bool descriptorIndexingSupport = false;
|
||||||
|
bool spirv14Support = false;
|
||||||
|
bool shaderFloatControls = false;
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
vkEnumerateDeviceExtensionProperties(physicalDevice, NULL, &count, nullptr);
|
vkEnumerateDeviceExtensionProperties(physicalDevice, NULL, &count, nullptr);
|
||||||
Array<VkExtensionProperties> extensionProps(count);
|
Array<VkExtensionProperties> extensionProps(count);
|
||||||
@@ -833,7 +843,6 @@ void Graphics::pickPhysicalDevice() {
|
|||||||
if (Gfx::useMeshShading) {
|
if (Gfx::useMeshShading) {
|
||||||
if (std::strcmp(VK_EXT_MESH_SHADER_EXTENSION_NAME, extensionProps[i].extensionName) == 0) {
|
if (std::strcmp(VK_EXT_MESH_SHADER_EXTENSION_NAME, extensionProps[i].extensionName) == 0) {
|
||||||
meshShadingEnabled = true;
|
meshShadingEnabled = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (std::strcmp(VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME, extensionProps[i].extensionName) == 0) {
|
if (std::strcmp(VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME, extensionProps[i].extensionName) == 0) {
|
||||||
@@ -842,8 +851,24 @@ void Graphics::pickPhysicalDevice() {
|
|||||||
if (std::strcmp(VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME, extensionProps[i].extensionName) == 0) {
|
if (std::strcmp(VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME, extensionProps[i].extensionName) == 0) {
|
||||||
accelerationStructureSupport = true;
|
accelerationStructureSupport = true;
|
||||||
}
|
}
|
||||||
|
if (std::strcmp(VK_KHR_DEFERRED_HOST_OPERATIONS_EXTENSION_NAME, extensionProps[i].extensionName) == 0) {
|
||||||
|
hostOperationsSupport = true;
|
||||||
}
|
}
|
||||||
rayTracingEnabled = rayTracingPipelineSupport && accelerationStructureSupport;
|
if (std::strcmp(VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME, extensionProps[i].extensionName) == 0) {
|
||||||
|
deviceAddressSupport = true;
|
||||||
|
}
|
||||||
|
if (std::strcmp(VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME, extensionProps[i].extensionName) == 0) {
|
||||||
|
descriptorIndexingSupport = true;
|
||||||
|
}
|
||||||
|
if (std::strcmp(VK_KHR_SPIRV_1_4_EXTENSION_NAME, extensionProps[i].extensionName) == 0) {
|
||||||
|
spirv14Support = true;
|
||||||
|
}
|
||||||
|
if (std::strcmp(VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME, extensionProps[i].extensionName) == 0) {
|
||||||
|
shaderFloatControls = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rayTracingEnabled = rayTracingPipelineSupport && accelerationStructureSupport && hostOperationsSupport && deviceAddressSupport &&
|
||||||
|
descriptorIndexingSupport && spirv14Support && shaderFloatControls;
|
||||||
if (meshShadingEnabled) {
|
if (meshShadingEnabled) {
|
||||||
features12.pNext = &meshShaderFeatures;
|
features12.pNext = &meshShaderFeatures;
|
||||||
}
|
}
|
||||||
@@ -927,9 +952,17 @@ void Graphics::createDevice(GraphicsInitializer initializer) {
|
|||||||
initializer.deviceExtensions.add(VK_EXT_MESH_SHADER_EXTENSION_NAME);
|
initializer.deviceExtensions.add(VK_EXT_MESH_SHADER_EXTENSION_NAME);
|
||||||
}
|
}
|
||||||
if (supportRayTracing()) {
|
if (supportRayTracing()) {
|
||||||
|
// ray tracing itself
|
||||||
initializer.deviceExtensions.add(VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME);
|
initializer.deviceExtensions.add(VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME);
|
||||||
initializer.deviceExtensions.add(VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME);
|
initializer.deviceExtensions.add(VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME);
|
||||||
|
// required by acceleration_structure
|
||||||
initializer.deviceExtensions.add(VK_KHR_DEFERRED_HOST_OPERATIONS_EXTENSION_NAME);
|
initializer.deviceExtensions.add(VK_KHR_DEFERRED_HOST_OPERATIONS_EXTENSION_NAME);
|
||||||
|
initializer.deviceExtensions.add(VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME);
|
||||||
|
initializer.deviceExtensions.add(VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME);
|
||||||
|
// required for ray tracing pipeline
|
||||||
|
initializer.deviceExtensions.add(VK_KHR_SPIRV_1_4_EXTENSION_NAME);
|
||||||
|
// required for spirv_1_4
|
||||||
|
initializer.deviceExtensions.add(VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME);
|
||||||
}
|
}
|
||||||
initializer.deviceExtensions.add(VK_KHR_MULTIVIEW_EXTENSION_NAME);
|
initializer.deviceExtensions.add(VK_KHR_MULTIVIEW_EXTENSION_NAME);
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|||||||
@@ -9,6 +9,35 @@ DECLARE_REF(CommandPool)
|
|||||||
DECLARE_REF(Queue)
|
DECLARE_REF(Queue)
|
||||||
DECLARE_REF(PipelineCache)
|
DECLARE_REF(PipelineCache)
|
||||||
DECLARE_REF(Framebuffer)
|
DECLARE_REF(Framebuffer)
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
concept chainable_struct = requires(T t) { t.pNext; };
|
||||||
|
template <chainable_struct... T> struct StructChain;
|
||||||
|
template <> struct StructChain<> {
|
||||||
|
};
|
||||||
|
template<chainable_struct Base> struct StructChain<Base> : StructChain<> {
|
||||||
|
StructChain(Base b):b(b) {}
|
||||||
|
StructChain(const StructChain<>&, Base b) : b(b) {}
|
||||||
|
template <chainable_struct Next> StructChain<Next, Base> append(Next next) { return StructChain<Next, Base>(*this, next); }
|
||||||
|
Base b;
|
||||||
|
Base& operator*(){
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
template <chainable_struct This, chainable_struct... Right> struct StructChain<This, Right...> : StructChain<Right...> {
|
||||||
|
StructChain(const StructChain<Right...>& parent, This t) : StructChain<Right...>(parent), t(t) {}
|
||||||
|
template <chainable_struct Next> StructChain<Next, This, Right...> append(Next next) {
|
||||||
|
return StructChain<Next, This, Right...>(*this, next);
|
||||||
|
}
|
||||||
|
auto& operator*() {
|
||||||
|
auto& base = StructChain<Right...>::operator*();
|
||||||
|
t.pNext = base.pNext;
|
||||||
|
base.pNext = &t;
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
This t;
|
||||||
|
};
|
||||||
|
|
||||||
class Graphics : public Gfx::Graphics {
|
class Graphics : public Gfx::Graphics {
|
||||||
public:
|
public:
|
||||||
Graphics();
|
Graphics();
|
||||||
@@ -34,8 +63,8 @@ class Graphics : public Gfx::Graphics {
|
|||||||
virtual Gfx::OWindow createWindow(const WindowCreateInfo& createInfo) override;
|
virtual Gfx::OWindow createWindow(const WindowCreateInfo& createInfo) override;
|
||||||
virtual Gfx::OViewport createViewport(Gfx::PWindow owner, const ViewportCreateInfo& createInfo) override;
|
virtual Gfx::OViewport createViewport(Gfx::PWindow owner, const ViewportCreateInfo& createInfo) override;
|
||||||
|
|
||||||
virtual Gfx::ORenderPass createRenderPass(Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, URect renderArea, std::string name,
|
virtual Gfx::ORenderPass createRenderPass(Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, URect renderArea,
|
||||||
Array<uint32> viewMasks, Array<uint32> correlationMasks) override;
|
std::string name, Array<uint32> viewMasks, Array<uint32> correlationMasks) override;
|
||||||
virtual void beginRenderPass(Gfx::PRenderPass renderPass) override;
|
virtual void beginRenderPass(Gfx::PRenderPass renderPass) override;
|
||||||
virtual void endRenderPass() override;
|
virtual void endRenderPass() override;
|
||||||
virtual void waitDeviceIdle() override;
|
virtual void waitDeviceIdle() override;
|
||||||
@@ -117,16 +146,20 @@ class Graphics : public Gfx::Graphics {
|
|||||||
thread_local static PCommandPool transferCommands;
|
thread_local static PCommandPool transferCommands;
|
||||||
std::mutex poolLock;
|
std::mutex poolLock;
|
||||||
Array<OCommandPool> pools;
|
Array<OCommandPool> pools;
|
||||||
|
|
||||||
VkQueueFamilyProperties graphicsProps;
|
VkQueueFamilyProperties graphicsProps;
|
||||||
|
|
||||||
VkPhysicalDeviceProperties2 props;
|
VkPhysicalDeviceProperties2 props;
|
||||||
|
VkPhysicalDeviceRayTracingPipelinePropertiesKHR rayTracingProperties;
|
||||||
|
VkPhysicalDeviceAccelerationStructurePropertiesKHR accelerationProperties;
|
||||||
|
|
||||||
VkPhysicalDeviceFeatures2 features;
|
VkPhysicalDeviceFeatures2 features;
|
||||||
VkPhysicalDeviceVulkan11Features features11;
|
VkPhysicalDeviceVulkan11Features features11;
|
||||||
VkPhysicalDeviceVulkan12Features features12;
|
VkPhysicalDeviceVulkan12Features features12;
|
||||||
VkPhysicalDeviceMeshShaderFeaturesEXT meshShaderFeatures;
|
VkPhysicalDeviceMeshShaderFeaturesEXT meshShaderFeatures;
|
||||||
|
VkPhysicalDeviceBufferDeviceAddressFeatures bufferDeviceAddressFeatures;
|
||||||
VkPhysicalDeviceAccelerationStructureFeaturesKHR accelerationFeatures;
|
VkPhysicalDeviceAccelerationStructureFeaturesKHR accelerationFeatures;
|
||||||
VkPhysicalDeviceAccelerationStructurePropertiesKHR accelerationProperties;
|
|
||||||
VkPhysicalDeviceRayTracingPipelineFeaturesKHR rayTracingFeatures;
|
VkPhysicalDeviceRayTracingPipelineFeaturesKHR rayTracingFeatures;
|
||||||
VkPhysicalDeviceRayTracingPipelinePropertiesKHR rayTracingProperties;
|
|
||||||
VkDebugUtilsMessengerEXT callback;
|
VkDebugUtilsMessengerEXT callback;
|
||||||
Map<uint32, OFramebuffer> allocatedFramebuffers;
|
Map<uint32, OFramebuffer> allocatedFramebuffers;
|
||||||
VmaAllocator allocator;
|
VmaAllocator allocator;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
#include "Graphics/Query.h"
|
#include "Graphics/Query.h"
|
||||||
|
#include <condition_variable>
|
||||||
|
|
||||||
namespace Seele {
|
namespace Seele {
|
||||||
namespace Vulkan {
|
namespace Vulkan {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
#include "Enums.h"
|
#include "Enums.h"
|
||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
using namespace Seele::Vulkan;
|
using namespace Seele::Vulkan;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class TopLevelAS : public Gfx::TopLevelAS {
|
|||||||
public:
|
public:
|
||||||
TopLevelAS(PGraphics graphics, const Gfx::TopLevelASCreateInfo& createInfo);
|
TopLevelAS(PGraphics graphics, const Gfx::TopLevelASCreateInfo& createInfo);
|
||||||
~TopLevelAS();
|
~TopLevelAS();
|
||||||
const VkAccelerationStructureKHR getHandle() const { return handle; }
|
VkAccelerationStructureKHR getHandle() const { return handle; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PGraphics graphics;
|
PGraphics graphics;
|
||||||
|
|||||||
@@ -215,7 +215,6 @@ RenderPass::~RenderPass() {
|
|||||||
|
|
||||||
uint32 RenderPass::getFramebufferHash() {
|
uint32 RenderPass::getFramebufferHash() {
|
||||||
FramebufferDescription description;
|
FramebufferDescription description;
|
||||||
std::memset(&description, 0, sizeof(FramebufferDescription));
|
|
||||||
for (auto& inputAttachment : layout.inputAttachments) {
|
for (auto& inputAttachment : layout.inputAttachments) {
|
||||||
PTextureBase tex = inputAttachment.getTexture().cast<TextureBase>();
|
PTextureBase tex = inputAttachment.getTexture().cast<TextureBase>();
|
||||||
description.inputAttachments[description.numInputAttachments++] = tex->getView();
|
description.inputAttachments[description.numInputAttachments++] = tex->getView();
|
||||||
|
|||||||
@@ -8,6 +8,4 @@ CameraUpdater::CameraUpdater(PScene scene) : ComponentSystem<Component::Camera,
|
|||||||
CameraUpdater::~CameraUpdater() {}
|
CameraUpdater::~CameraUpdater() {}
|
||||||
|
|
||||||
void CameraUpdater::update(Component::Camera& camera, Component::Transform& transform) {
|
void CameraUpdater::update(Component::Camera& camera, Component::Transform& transform) {
|
||||||
Vector eyePos = transform.getPosition();
|
|
||||||
Vector lookAt = eyePos + transform.getForward();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "Containers/List.h"
|
#include "Containers/List.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <condition_variable>
|
||||||
|
|
||||||
namespace Seele {
|
namespace Seele {
|
||||||
class ThreadPool {
|
class ThreadPool {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
"vulkan",
|
||||||
"assimp",
|
"assimp",
|
||||||
"entt",
|
"entt",
|
||||||
"stb",
|
"stb",
|
||||||
|
|||||||
Reference in New Issue
Block a user