From 4ea16b649b37abcb48af50f212dff0134e2fd8f8 Mon Sep 17 00:00:00 2001 From: Vanessa Karolek <vaka1997@uni-koblenz.de> Date: Mon, 20 Sep 2021 15:13:16 +0200 Subject: [PATCH] [#92] degrade RTX from module to just a subfolder, delete unused stuff, adjust cmake --- modules/CMakeLists.txt | 1 - modules/rtx/CMakeLists.txt | 33 -- modules/rtx/include/vkcv/rtx/ASManager.hpp | 188 ------- modules/rtx/include/vkcv/rtx/RTX.hpp | 85 ---- .../rtx/include/vkcv/rtx/RTXExtensions.hpp | 36 -- modules/rtx/src/vkcv/rtx/ASManager.cpp | 463 ------------------ modules/rtx/src/vkcv/rtx/RTX.cpp | 298 ----------- modules/rtx/src/vkcv/rtx/RTXExtensions.cpp | 130 ----- projects/CMakeLists.txt | 2 +- projects/rtx/CMakeLists.txt | 28 -- .../Cutlery/Cutlery_chrome_BaseColor.png | 3 - .../Cutlery/Cutlery_chrome_Normal.png | 3 - .../Cutlery/Cutlery_details_BaseColor.png | 3 - .../Cutlery/Cutlery_details_Normal.png | 3 - .../Paris_LiquorBottle_01_Caps_BaseColor.png | 3 - .../Paris_LiquorBottle_01_Caps_Normal.png | 3 - ...s_LiquorBottle_01_Glass_Wine_BaseColor.png | 3 - ...aris_LiquorBottle_01_Glass_Wine_Normal.png | 3 - .../Cutlery/Plates_Ceramic_BaseColor.png | 3 - .../Cutlery/Plates_Ceramic_Normal.png | 3 - ...ils_BaseColor-Plates_Details_BaseColor.png | 3 - .../Cutlery/Plates_Details_Normal.png | 3 - .../Cutlery/ToffeeJar_Label_BaseColor.png | 3 - .../Cutlery/ToffeeJar_Label_Normal.png | 3 - .../Cutlery/TransparentGlass_BaseColor.png | 3 - .../Cutlery/TransparentGlass_Normal.png | 3 - .../rtx/resources/Cutlery/cutlerySzene.bin | 3 - .../rtx/resources/Cutlery/cutlerySzene.glb | 3 - .../rtx/resources/Cutlery/cutlerySzene.gltf | 3 - projects/rtx/resources/Sponza/Sponza.bin | 3 - projects/rtx/resources/Sponza/Sponza.gltf | 3 - projects/rtx/resources/Sponza/SponzaFloor.bin | 3 - .../rtx/resources/Sponza/SponzaFloor.gltf | 3 - projects/rtx/resources/Sponza/background.png | 3 - .../rtx/resources/Sponza/chain_texture.png | 3 - projects/rtx/resources/Sponza/lion.png | 3 - .../resources/Sponza/spnza_bricks_a_diff.png | 3 - .../rtx/resources/Sponza/sponza_arch_diff.png | 3 - .../Sponza/sponza_ceiling_a_diff.png | 3 - .../resources/Sponza/sponza_column_a_diff.png | 3 - .../resources/Sponza/sponza_column_b_diff.png | 3 - .../resources/Sponza/sponza_column_c_diff.png | 3 - .../Sponza/sponza_curtain_blue_diff.png | 3 - .../resources/Sponza/sponza_curtain_diff.png | 3 - .../Sponza/sponza_curtain_green_diff.png | 3 - .../resources/Sponza/sponza_details_diff.png | 3 - .../Sponza/sponza_fabric_blue_diff.png | 3 - .../resources/Sponza/sponza_fabric_diff.png | 3 - .../Sponza/sponza_fabric_green_diff.png | 3 - .../resources/Sponza/sponza_flagpole_diff.png | 3 - .../resources/Sponza/sponza_floor_a_diff.png | 3 - .../rtx/resources/Sponza/sponza_roof_diff.png | 3 - .../resources/Sponza/sponza_thorn_diff.png | 3 - projects/rtx/resources/Sponza/vase_dif.png | 3 - .../rtx/resources/Sponza/vase_hanging.png | 3 - projects/rtx/resources/Sponza/vase_plant.png | 3 - projects/rtx/resources/Sponza/vase_round.png | 3 - projects/rtx/resources/Szene/Szene.bin | 3 - projects/rtx/resources/Szene/Szene.gltf | 3 - projects/rtx/resources/Szene/boards2_vcyc.jpg | 3 - .../rtx/resources/Szene/boards2_vcyc_jpg.jpg | 3 - .../rtx/resources/cube/boards2_vcyc_jpg.jpg | 3 - projects/rtx/resources/cube/cube.bin | 3 - projects/rtx/resources/cube/cube.blend | 3 - projects/rtx/resources/cube/cube.blend1 | 3 - projects/rtx/resources/cube/cube.glb | 3 - projects/rtx/resources/cube/cube.gltf | 3 - .../rtx/resources/house/medieval_house.gltf | 3 - .../{rtx => rtx_ambient_occlusion}/.gitignore | 0 projects/rtx_ambient_occlusion/CMakeLists.txt | 41 ++ .../resources/shaders/ambientOcclusion.rchit | 0 .../resources/shaders/ambientOcclusion.rgen | 0 .../resources/shaders/ambientOcclusion.rmiss | 0 .../src/main.cpp | 6 +- .../src/teapot.hpp | 0 75 files changed, 45 insertions(+), 1440 deletions(-) delete mode 100644 modules/rtx/CMakeLists.txt delete mode 100644 modules/rtx/include/vkcv/rtx/ASManager.hpp delete mode 100644 modules/rtx/include/vkcv/rtx/RTX.hpp delete mode 100644 modules/rtx/include/vkcv/rtx/RTXExtensions.hpp delete mode 100644 modules/rtx/src/vkcv/rtx/ASManager.cpp delete mode 100644 modules/rtx/src/vkcv/rtx/RTX.cpp delete mode 100644 modules/rtx/src/vkcv/rtx/RTXExtensions.cpp delete mode 100644 projects/rtx/CMakeLists.txt delete mode 100644 projects/rtx/resources/Cutlery/Cutlery_chrome_BaseColor.png delete mode 100644 projects/rtx/resources/Cutlery/Cutlery_chrome_Normal.png delete mode 100644 projects/rtx/resources/Cutlery/Cutlery_details_BaseColor.png delete mode 100644 projects/rtx/resources/Cutlery/Cutlery_details_Normal.png delete mode 100644 projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Caps_BaseColor.png delete mode 100644 projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Caps_Normal.png delete mode 100644 projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Glass_Wine_BaseColor.png delete mode 100644 projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Glass_Wine_Normal.png delete mode 100644 projects/rtx/resources/Cutlery/Plates_Ceramic_BaseColor.png delete mode 100644 projects/rtx/resources/Cutlery/Plates_Ceramic_Normal.png delete mode 100644 projects/rtx/resources/Cutlery/Plates_Details_BaseColor-Plates_Details_BaseColor.png delete mode 100644 projects/rtx/resources/Cutlery/Plates_Details_Normal.png delete mode 100644 projects/rtx/resources/Cutlery/ToffeeJar_Label_BaseColor.png delete mode 100644 projects/rtx/resources/Cutlery/ToffeeJar_Label_Normal.png delete mode 100644 projects/rtx/resources/Cutlery/TransparentGlass_BaseColor.png delete mode 100644 projects/rtx/resources/Cutlery/TransparentGlass_Normal.png delete mode 100644 projects/rtx/resources/Cutlery/cutlerySzene.bin delete mode 100644 projects/rtx/resources/Cutlery/cutlerySzene.glb delete mode 100644 projects/rtx/resources/Cutlery/cutlerySzene.gltf delete mode 100644 projects/rtx/resources/Sponza/Sponza.bin delete mode 100644 projects/rtx/resources/Sponza/Sponza.gltf delete mode 100644 projects/rtx/resources/Sponza/SponzaFloor.bin delete mode 100644 projects/rtx/resources/Sponza/SponzaFloor.gltf delete mode 100644 projects/rtx/resources/Sponza/background.png delete mode 100644 projects/rtx/resources/Sponza/chain_texture.png delete mode 100644 projects/rtx/resources/Sponza/lion.png delete mode 100644 projects/rtx/resources/Sponza/spnza_bricks_a_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_arch_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_ceiling_a_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_column_a_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_column_b_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_column_c_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_curtain_blue_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_curtain_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_curtain_green_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_details_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_fabric_blue_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_fabric_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_fabric_green_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_flagpole_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_floor_a_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_roof_diff.png delete mode 100644 projects/rtx/resources/Sponza/sponza_thorn_diff.png delete mode 100644 projects/rtx/resources/Sponza/vase_dif.png delete mode 100644 projects/rtx/resources/Sponza/vase_hanging.png delete mode 100644 projects/rtx/resources/Sponza/vase_plant.png delete mode 100644 projects/rtx/resources/Sponza/vase_round.png delete mode 100644 projects/rtx/resources/Szene/Szene.bin delete mode 100644 projects/rtx/resources/Szene/Szene.gltf delete mode 100644 projects/rtx/resources/Szene/boards2_vcyc.jpg delete mode 100644 projects/rtx/resources/Szene/boards2_vcyc_jpg.jpg delete mode 100644 projects/rtx/resources/cube/boards2_vcyc_jpg.jpg delete mode 100644 projects/rtx/resources/cube/cube.bin delete mode 100644 projects/rtx/resources/cube/cube.blend delete mode 100644 projects/rtx/resources/cube/cube.blend1 delete mode 100644 projects/rtx/resources/cube/cube.glb delete mode 100644 projects/rtx/resources/cube/cube.gltf delete mode 100644 projects/rtx/resources/house/medieval_house.gltf rename projects/{rtx => rtx_ambient_occlusion}/.gitignore (100%) create mode 100644 projects/rtx_ambient_occlusion/CMakeLists.txt rename projects/{rtx => rtx_ambient_occlusion}/resources/shaders/ambientOcclusion.rchit (100%) rename projects/{rtx => rtx_ambient_occlusion}/resources/shaders/ambientOcclusion.rgen (100%) rename projects/{rtx => rtx_ambient_occlusion}/resources/shaders/ambientOcclusion.rmiss (100%) rename projects/{rtx => rtx_ambient_occlusion}/src/main.cpp (98%) rename projects/{rtx => rtx_ambient_occlusion}/src/teapot.hpp (100%) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 1f3c5ce9..4b576e71 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -4,7 +4,6 @@ add_subdirectory(asset_loader) add_subdirectory(camera) add_subdirectory(gui) add_subdirectory(material) -add_subdirectory(rtx) add_subdirectory(meshlet) add_subdirectory(scene) add_subdirectory(shader_compiler) diff --git a/modules/rtx/CMakeLists.txt b/modules/rtx/CMakeLists.txt deleted file mode 100644 index 77f9bb06..00000000 --- a/modules/rtx/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -project(vkcv_rtx) - -# setting c++ standard for the project -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -set(vkcv_rtx_source ${PROJECT_SOURCE_DIR}/src) -set(vkcv_rtx_include ${PROJECT_SOURCE_DIR}/include) - -set(vkcv_rtx_sources - ${vkcv_rtx_include}/vkcv/rtx/RTX.hpp - ${vkcv_rtx_source}/vkcv/rtx/RTX.cpp - - ${vkcv_rtx_include}/vkcv/rtx/ASManager.hpp - ${vkcv_rtx_source}/vkcv/rtx/ASManager.cpp - - ${vkcv_rtx_include}/vkcv/rtx/RTXExtensions.hpp - ${vkcv_rtx_source}/vkcv/rtx/RTXExtensions.cpp - -) - -# adding source files to the project -add_library(vkcv_rtx STATIC ${vkcv_rtx_sources}) - -# link the required libraries to the module -target_link_libraries(vkcv_rtx vkcv) - -# including headers of dependencies and the VkCV framework -target_include_directories(vkcv_rtx SYSTEM BEFORE PRIVATE ${vkcv_include}) - -# add the own include directory for public headers -target_include_directories(vkcv_rtx BEFORE PUBLIC ${vkcv_rtx_include}) \ No newline at end of file diff --git a/modules/rtx/include/vkcv/rtx/ASManager.hpp b/modules/rtx/include/vkcv/rtx/ASManager.hpp deleted file mode 100644 index 0cdb14d1..00000000 --- a/modules/rtx/include/vkcv/rtx/ASManager.hpp +++ /dev/null @@ -1,188 +0,0 @@ -#pragma once - -#include <vkcv/Core.hpp> - -namespace vkcv::rtx { - - /** - * @brief Used for @#RTXBuffer creation depending on the @#RTXBufferType. - */ - enum class RTXBufferType { - STAGING, - GPU, - ACCELERATION, - SHADER_BINDING, - SCRATCH - }; - - /** - * @brief Used as a container to handle buffer creation and destruction in RTX-specific use cases. - */ - struct RTXBuffer { - RTXBufferType bufferType; - void* data; - vk::DeviceSize deviceSize; - vk::DeviceMemory deviceMemory; - vk::BufferUsageFlags bufferUsageFlagBits; - vk::MemoryPropertyFlags memoryPropertyFlagBits; - vk::Buffer vulkanHandle; - }; - - /** - * @brief Used as a container to handle bottom-level acceleration structure (BLAS) construction and destruction. - */ - struct BottomLevelAccelerationStructure { - RTXBuffer vertexBuffer; - RTXBuffer indexBuffer; - RTXBuffer accelerationBuffer; - vk::AccelerationStructureKHR vulkanHandle; - }; - - /** - * @brief Used as a container to handle top-level acceleration structure (TLAS) construction and destruction. - */ - struct TopLevelAccelerationStructure { - RTXBuffer gpuBufferInstances; - RTXBuffer tlasBuffer; - RTXBuffer tempBuildDataBuffer; // scratch buffer - vk::AccelerationStructureKHR vulkanHandle; - }; - - /** - * @brief A class for managing acceleration structures (bottom, top). - */ - class ASManager { - private: - Core* m_core; - const vk::Device* m_device; - std::vector<BottomLevelAccelerationStructure> m_bottomLevelAccelerationStructures; - TopLevelAccelerationStructure m_topLevelAccelerationStructure; - vk::DispatchLoaderDynamic m_rtxDispatcher; - - /** - * Creates a command pool. - */ - vk::CommandPool createCommandPool(); - - /** - * @brief Takes a @p cmdPool, allocates a command buffer and starts recording it. - * @param cmdPool The command pool. - * @return The allocated command buffer. - */ - vk::CommandBuffer allocateAndBeginCommandBuffer( vk::CommandPool cmdPool); - - /** - * @brief Ends recording, submits, waits, and then frees the @p commandBuffer. - * @param commandPool The command pool. - * @param commandBuffer The command buffer. - */ - void submitCommandBuffer(vk::CommandPool commandPool, vk::CommandBuffer& commandBuffer); - - /** - * @brief Gets the device address of a @p buffer. - * @param buffer The buffer. - * @return The device address of the @p buffer. - */ - vk::DeviceAddress getBufferDeviceAddress(vk::Buffer buffer); - - /** - * @brief Copies @p cpuBuffer data into a @p gpuBuffer. Typical use case is a staging buffer (namely, - * @p cpuBuffer) used to fill a @p gpuBuffer with @p vk::MemoryPropertyFlagBits::eDeviceLocal flag set. - * @p cpuBuffer is destroyed and freed after copying. - * @param cpuBuffer - * @param gpuBuffer - */ - void copyFromCPUToGPU(RTXBuffer &cpuBuffer, RTXBuffer &gpuBuffer); - - public: - - /** - * @brief Constructor of @#ASManager . - * @param core - */ - ASManager(vkcv::Core *core); - - /** - * @brief Default destructor of @#ASManager. - */ - ~ASManager(); - - /** - * @brief Returns a @#RTXBuffer object holding data of type @p T. - * @param data The input data of type @p T. - * @return A @#RTXBuffer object holding @p data of type @p T. - */ - template<class T> - RTXBuffer makeBufferFromData(std::vector<T>& data) { - - // first: Staging Buffer creation - RTXBuffer stagingBuffer; - stagingBuffer.bufferType = RTXBufferType::STAGING; - stagingBuffer.deviceSize = sizeof(T) * data.size(); - stagingBuffer.data = data.data(); - stagingBuffer.bufferUsageFlagBits = vk::BufferUsageFlagBits::eTransferSrc; - stagingBuffer.memoryPropertyFlagBits = vk::MemoryPropertyFlagBits::eHostCoherent | vk::MemoryPropertyFlagBits::eHostVisible; - - createBuffer(stagingBuffer); - - // second: create AS Buffer - RTXBuffer targetBuffer; - targetBuffer.bufferType = RTXBufferType::GPU; - targetBuffer.deviceSize = sizeof(T) * data.size(); - targetBuffer.bufferUsageFlagBits = vk::BufferUsageFlagBits::eAccelerationStructureBuildInputReadOnlyKHR - | vk::BufferUsageFlagBits::eTransferDst - | vk::BufferUsageFlagBits::eStorageBuffer - | vk::BufferUsageFlagBits::eShaderDeviceAddress; - targetBuffer.memoryPropertyFlagBits = vk::MemoryPropertyFlagBits::eDeviceLocal; - - createBuffer(targetBuffer); - - // copy from CPU to GPU - copyFromCPUToGPU(stagingBuffer, targetBuffer); - - return targetBuffer; - }; - - /** - * @brief A helper function used by @#ASManager::makeBufferFromData. Creates a fully initialized @#RTXBuffer object - * from partially specified @p buffer. All missing data of @p buffer will be completed by this function. - * @param buffer The partially specified @#RTXBuffer holding that part of information which is required for - * successfully creating a @p vk::Buffer object. - */ - void createBuffer(RTXBuffer& buffer); - - /** - * @brief Build a Bottom Level Acceleration Structure (BLAS) object from given @p vertexBuffer and @p indexBuffer. - * @param[in] vertexBuffer The vertex data. - * @param[in] vertexCount The amount of vertices in @p vertexBuffer. - * @param[in] indexBuffer The index data. - * @param[in] indexCount The amount of indices in @p indexBuffer. - */ - void buildBLAS(RTXBuffer vertexBuffer, uint32_t vertexCount, RTXBuffer indexBuffer, uint32_t indexCount); - - /** - * @brief Build a Top Level Acceleration Structure (TLAS) object from the created - * @#ASManager::m_accelerationStructures objects. - */ - void buildTLAS(); - - /** - * @brief Returns the top-level acceleration structure (TLAS) buffer. - * @return A @#TopLevelAccelerationStructure object holding the TLAS. - */ - TopLevelAccelerationStructure getTLAS(); - - /** - * @brief Returns the bottom-level acceleration structure at @p id. - * @param id The ID used for indexing. - * @return The specified @#BottomLevelAccelerationStructure object. - */ - BottomLevelAccelerationStructure getBLAS(uint32_t id); - - /** - * @brief Returns the dispatcher member variable for access in the @#RTXModule. - * @return The dispatcher member variable. - */ - const vk::DispatchLoaderDynamic& getDispatcher(); - }; -} \ No newline at end of file diff --git a/modules/rtx/include/vkcv/rtx/RTX.hpp b/modules/rtx/include/vkcv/rtx/RTX.hpp deleted file mode 100644 index 3712ddb9..00000000 --- a/modules/rtx/include/vkcv/rtx/RTX.hpp +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once - -#include <vector> -#include "vulkan/vulkan.hpp" -#include "vkcv/Core.hpp" -#include "ASManager.hpp" - -namespace vkcv::rtx { - - class RTXModule { - private: - - Core* m_core; - ASManager* m_asManager; - vk::Pipeline m_pipeline; - vk::PipelineLayout m_pipelineLayout; - RTXBuffer m_shaderBindingTableBuffer; - vk::DeviceSize m_shaderGroupBaseAlignment; - - public: - - /** - * @brief Initializes the @#RTXModule with scene data. - * @param core The reference to the @#Core. - * @param asManager The reference to the @#ASManager. - * @param vertices The vertex data of the scene. - * @param indices The index data of the scene. - * @param descriptorSetHandles The descriptor set handles for RTX. - */ - RTXModule(Core* core, ASManager* asManager, std::vector<float>& vertices, - std::vector<uint32_t>& indices, std::vector<vkcv::DescriptorSetHandle>& descriptorSetHandles); - - /** - * @brief Default #RTXModule destructor. - */ - ~RTXModule(); - - /** - * @brief Returns the RTX pipeline. - * @return The RTX pipeline. - */ - vk::Pipeline getPipeline(); - - /** - * @brief Returns the shader binding table buffer. - * @return The shader binding table buffer. - */ - vk::Buffer getShaderBindingTableBuffer(); - - /** - * @brief Returns the shader group base alignment for partitioning the shader binding table buffer. - * @return The shader group base alignment. - */ - vk::DeviceSize getShaderGroupBaseAlignment(); - - /** - * @brief Returns the RTX pipeline layout. - * @return The RTX pipeline layout. - */ - vk::PipelineLayout getPipelineLayout(); - - /** - * @brief Sets the shader group base alignment and creates the shader binding table by allocating a shader - * binding table buffer. The allocation depends on @p shaderCount and the shader group base alignment. - * @param shaderCount The amount of shaders to be used for RTX. - */ - void createShaderBindingTable(uint32_t shaderCount); - - /** - * @brief Creates Descriptor-Writes for RTX - * @param descriptorSetHandles The descriptorSetHandles for RTX. - */ - void RTXDescriptors(std::vector<vkcv::DescriptorSetHandle>& descriptorSetHandles); - - /** - * @brief Creates the RTX pipeline and the RTX pipeline layout. Currently, only RayGen, RayClosestHit and - * RayMiss are supported. - * @param pushConstantSize The size of the push constant used in the RTX shaders. - * @param descriptorSetLayouts The descriptor set layout handles. - * @param rtxShader The RTX shader program. - */ - void createRTXPipelineAndLayout(uint32_t pushConstantSize, std::vector<DescriptorSetLayoutHandle> descriptorSetLayouts, ShaderProgram &rtxShader); - }; - -} diff --git a/modules/rtx/include/vkcv/rtx/RTXExtensions.hpp b/modules/rtx/include/vkcv/rtx/RTXExtensions.hpp deleted file mode 100644 index 067428e0..00000000 --- a/modules/rtx/include/vkcv/rtx/RTXExtensions.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once -#include<vector> -#include<vkcv/Core.hpp> - -namespace vkcv::rtx{ - -class RTXExtensions { -private: - std::vector<const char*> m_instanceExtensions; // the instance extensions needed for using RTX - std::vector<const char*> m_deviceExtensions; // the device extensions needed for using RTX - vkcv::Features m_features; // the features needed to be enabled for using RTX -public: - - RTXExtensions(); - ~RTXExtensions()=default; - /** - * @brief Returns the raytracing instance extensions. - * @return The raytracing instance extensions. - */ - std::vector<const char*> getInstanceExtensions(); - - /** - * @brief Returns the raytracing device extensions. - * @return The raytracing device extensions. - */ - std::vector<const char*> getDeviceExtensions(); - - /** - * @brief Returns the raytracing features. - * @return The raytracing features. - */ - vkcv::Features getFeatures(); - - -}; -} \ No newline at end of file diff --git a/modules/rtx/src/vkcv/rtx/ASManager.cpp b/modules/rtx/src/vkcv/rtx/ASManager.cpp deleted file mode 100644 index 67bf2048..00000000 --- a/modules/rtx/src/vkcv/rtx/ASManager.cpp +++ /dev/null @@ -1,463 +0,0 @@ -#include "vkcv/rtx/ASManager.hpp" -#include <array> - -namespace vkcv::rtx { - - - ASManager::ASManager(vkcv::Core *core) : - m_core(core), - m_device(&(core->getContext().getDevice())){ - // INFO: Using RTX extensions implies that we cannot use the standard dispatcher from Vulkan because using RTX - // specific functions via vk::Device will result in validation errors. Instead we need to use a - // vk::DispatchLoaderDynamic which is used as dispatcher parameter of the device functions. - m_rtxDispatcher = vk::DispatchLoaderDynamic( (PFN_vkGetInstanceProcAddr) m_core->getContext().getInstance().getProcAddr("vkGetInstanceProcAddr") ); - m_rtxDispatcher.init(m_core->getContext().getInstance()); - - // TODO: Recursive call of buildBLAS for bigger scenes. Currently, the RTX module only supports one mesh. - } - - ASManager::~ASManager() noexcept { - m_rtxDispatcher = vk::DispatchLoaderDynamic( (PFN_vkGetInstanceProcAddr) m_core->getContext().getInstance().getProcAddr("vkGetInstanceProcAddr") ); - m_rtxDispatcher.init(m_core->getContext().getInstance()); - - // destroy every BLAS, its data containers and free used memory blocks - for (size_t i=0; i < m_bottomLevelAccelerationStructures.size(); i++) { - BottomLevelAccelerationStructure blas = m_bottomLevelAccelerationStructures[i]; - m_core->getContext().getDevice().destroyAccelerationStructureKHR(blas.vulkanHandle, nullptr, m_rtxDispatcher); - m_core->getContext().getDevice().destroy(blas.accelerationBuffer.vulkanHandle); - m_core->getContext().getDevice().destroy(blas.indexBuffer.vulkanHandle); - m_core->getContext().getDevice().destroy(blas.vertexBuffer.vulkanHandle); - - m_core->getContext().getDevice().freeMemory(blas.accelerationBuffer.deviceMemory); - m_core->getContext().getDevice().freeMemory(blas.indexBuffer.deviceMemory); - m_core->getContext().getDevice().freeMemory(blas.vertexBuffer.deviceMemory); - } - - // destroy the TLAS, its data containers and free used memory blocks - TopLevelAccelerationStructure tlas = m_topLevelAccelerationStructure; - m_core->getContext().getDevice().destroyAccelerationStructureKHR(tlas.vulkanHandle, nullptr, m_rtxDispatcher); - m_core->getContext().getDevice().destroy(tlas.tlasBuffer.vulkanHandle); - m_core->getContext().getDevice().destroy(tlas.gpuBufferInstances.vulkanHandle); - - m_core->getContext().getDevice().freeMemory(tlas.tlasBuffer.deviceMemory); - m_core->getContext().getDevice().freeMemory(tlas.gpuBufferInstances.deviceMemory); - } - - - - vk::CommandPool ASManager::createCommandPool() { - vk::CommandPool commandPool; - vk::CommandPoolCreateInfo commandPoolCreateInfo; - commandPoolCreateInfo.setQueueFamilyIndex(m_core->getContext().getQueueManager().getComputeQueues()[0].familyIndex); - vk::Result res = m_device->createCommandPool(&commandPoolCreateInfo, nullptr, &commandPool); - if (res != vk::Result::eSuccess) { - vkcv_log(LogLevel::ERROR, "ASManager: command pool could not be created! (%s)", vk::to_string(res).c_str()); - } - return commandPool; - }; - - vk::CommandBuffer ASManager::allocateAndBeginCommandBuffer(vk::CommandPool commandPool) - { - vk::CommandBufferAllocateInfo commandBufferAllocateInfo{}; - commandBufferAllocateInfo.setLevel(vk::CommandBufferLevel::ePrimary); - commandBufferAllocateInfo.setCommandPool(commandPool); - commandBufferAllocateInfo.setCommandBufferCount(1); - vk::CommandBuffer commandBuffer; - vk::Result result = m_device->allocateCommandBuffers(&commandBufferAllocateInfo, &commandBuffer); - if (result != vk::Result::eSuccess) { - vkcv_log(LogLevel::ERROR, "ASManager: command buffer for Acceleration Strucutre Build could not be allocated! (%s)", vk::to_string(result).c_str()); - } - - beginCommandBuffer(commandBuffer, vk::CommandBufferUsageFlagBits::eOneTimeSubmit); - return commandBuffer; - } - - void ASManager::submitCommandBuffer(vk::CommandPool commandPool, vk::CommandBuffer& commandBuffer) - { - commandBuffer.end(); - - vk::SubmitInfo submitInfo; - submitInfo.setCommandBufferCount(1); - submitInfo.setPCommandBuffers(&commandBuffer); - - vkcv::Queue queue = m_core->getContext().getQueueManager().getComputeQueues()[0]; - - queue.handle.submit(submitInfo); - queue.handle.waitIdle(); - - m_device->freeCommandBuffers(commandPool, 1, &commandBuffer); - m_device->destroyCommandPool(commandPool); - } - - vk::DeviceAddress ASManager::getBufferDeviceAddress(vk::Buffer buffer) - { - vk::BufferDeviceAddressInfo bufferDeviceAddressInfo(buffer); - return m_device->getBufferAddress(bufferDeviceAddressInfo); - } - - void ASManager::createBuffer(RTXBuffer& buffer) { - - vk::BufferCreateInfo bufferCreateInfo; - bufferCreateInfo.setFlags(vk::BufferCreateFlags()); - bufferCreateInfo.setUsage(buffer.bufferUsageFlagBits); - bufferCreateInfo.setSize(buffer.deviceSize); - - buffer.vulkanHandle = m_device->createBuffer(bufferCreateInfo); - vk::MemoryRequirements2 memoryRequirements2; - vk::MemoryDedicatedRequirements dedicatedRequirements; - vk::BufferMemoryRequirementsInfo2 bufferRequirements; - - bufferRequirements.setBuffer(buffer.vulkanHandle); - memoryRequirements2.pNext = &dedicatedRequirements; - m_device->getBufferMemoryRequirements2(&bufferRequirements, &memoryRequirements2); - - vk::PhysicalDeviceMemoryProperties physicalDeviceMemoryProperties = m_core->getContext().getPhysicalDevice().getMemoryProperties(); - - uint32_t memoryTypeIndex = -1; - for (int i = 0; i < physicalDeviceMemoryProperties.memoryTypeCount; i++) { - if ((memoryRequirements2.memoryRequirements.memoryTypeBits & (1 << i)) - && (physicalDeviceMemoryProperties.memoryTypes[i].propertyFlags & buffer.memoryPropertyFlagBits) == buffer.memoryPropertyFlagBits) { - memoryTypeIndex = i; - break; - } - } - - vk::MemoryAllocateInfo memoryAllocateInfo( - memoryRequirements2.memoryRequirements.size, // size of allocation in bytes - memoryTypeIndex // index identifying a memory type from the memoryTypes array of the vk::PhysicalDeviceMemoryProperties structure. - ); - vk::MemoryAllocateFlagsInfo allocateFlagsInfo( - vk::MemoryAllocateFlagBits::eDeviceAddress // vk::MemoryAllocateFlags - ); - memoryAllocateInfo.setPNext(&allocateFlagsInfo); // extend memory allocate info with allocate flag info - buffer.deviceMemory = m_device->allocateMemory(memoryAllocateInfo); - - uint32_t memoryOffset = 0; - m_device->bindBufferMemory(buffer.vulkanHandle, buffer.deviceMemory, memoryOffset); - - // only fill data in case of CPU buffer - if (buffer.bufferType == RTXBufferType::STAGING) { - void* mapped = m_device->mapMemory(buffer.deviceMemory, memoryOffset, buffer.deviceSize); - std::memcpy(mapped, buffer.data, buffer.deviceSize); - m_device->unmapMemory(buffer.deviceMemory); - } - } - - void ASManager::copyFromCPUToGPU(RTXBuffer& cpuBuffer, RTXBuffer& gpuBuffer) { - SubmitInfo submitInfo; - submitInfo.queueType = QueueType::Graphics; - - vk::CommandPool commandPool= createCommandPool(); - vk::CommandBuffer commandBuffer= allocateAndBeginCommandBuffer(commandPool); - vk::BufferCopy bufferCopy; - bufferCopy.size = cpuBuffer.deviceSize; - commandBuffer.copyBuffer(cpuBuffer.vulkanHandle, gpuBuffer.vulkanHandle, 1, &bufferCopy); - - submitCommandBuffer(commandPool,commandBuffer); - - m_device->destroyBuffer(cpuBuffer.vulkanHandle); - m_device->freeMemory(cpuBuffer.deviceMemory); - } - - void ASManager::buildBLAS(RTXBuffer vertexBuffer, uint32_t vertexCount, RTXBuffer indexBuffer, uint32_t indexCount) { - // TODO: organize hierarchical structure of multiple BLAS - - vk::DeviceAddress vertexBufferAddress = getBufferDeviceAddress(vertexBuffer.vulkanHandle); - vk::DeviceAddress indexBufferAddress = getBufferDeviceAddress(indexBuffer.vulkanHandle); - - // Specify triangle mesh data - vk::AccelerationStructureGeometryTrianglesDataKHR asTriangles( - vk::Format::eR32G32B32Sfloat, // vertex format - vertexBufferAddress, // vertex buffer address (vk::DeviceOrHostAddressConstKHR) - 3 * sizeof(float), // vertex stride (vk::DeviceSize) - uint32_t(vertexCount - 1), // maxVertex (uint32_t) - vk::IndexType::eUint32, // indexType (vk::IndexType) --> INFO: UINT16 oder UINT32! - indexBufferAddress, // indexData (vk::DeviceOrHostAddressConstKHR) - {} // transformData (vk::DeviceOrHostAddressConstKHR) - ); - - // Encapsulate geometry data - vk::AccelerationStructureGeometryKHR asGeometry( - vk::GeometryTypeKHR::eTriangles, // The geometry type, e.g. triangles, AABBs, instances - asTriangles, // the geometry data - vk::GeometryFlagBitsKHR::eOpaque // This flag disables any-hit shaders to increase ray tracing performance - ); - - // List ranges of data for access - vk::AccelerationStructureBuildRangeInfoKHR asRangeInfo( - uint32_t(indexCount / 3), // the primitiveCount (uint32_t) - 0, // primitiveOffset (uint32_t) - 0, // firstVertex (uint32_t) - 0 // transformOffset (uint32_t) - ); - - // This struct points to an array of geometries to be built into the - // BLAS, as well as build settings. - vk::AccelerationStructureBuildGeometryInfoKHR asBuildInfo( - vk::AccelerationStructureTypeKHR::eBottomLevel, // type of the AS: bottom vs. top - vk::BuildAccelerationStructureFlagBitsKHR::ePreferFastTrace, // some flags for different purposes, e.g. efficiency - vk::BuildAccelerationStructureModeKHR::eBuild, // AS mode: build vs. update - {}, // src AS (this seems to be for copying AS) - {}, // dst AS (this seems to be for copying AS) - 1, // the geometryCount. TODO: how many do we need? - &asGeometry // the next input entry would be a pointer to a pointer to geometries. Maybe geometryCount depends on the next entry? - ); - - // Query the worst-case amount of memory needed for the AS - vk::AccelerationStructureBuildSizesInfoKHR asBuildSizesInfo; - m_device->getAccelerationStructureBuildSizesKHR( - vk::AccelerationStructureBuildTypeKHR::eDevice, // build on device instead of host - &asBuildInfo, // pointer to build info - &asRangeInfo.primitiveCount, // array of number of primitives per geometry - &asBuildSizesInfo, // output pointer to store sizes - m_rtxDispatcher - ); - - // create buffer for acceleration structure - RTXBuffer blasBuffer; - blasBuffer.bufferType = RTXBufferType::ACCELERATION; - blasBuffer.deviceSize = asBuildSizesInfo.accelerationStructureSize; - blasBuffer.bufferUsageFlagBits = vk::BufferUsageFlagBits::eAccelerationStructureStorageKHR - | vk::BufferUsageFlagBits::eShaderDeviceAddress - | vk::BufferUsageFlagBits::eStorageBuffer; - blasBuffer.memoryPropertyFlagBits = { vk::MemoryPropertyFlagBits::eDeviceLocal }; - - createBuffer(blasBuffer); - - // Create an empty AS object - vk::AccelerationStructureCreateInfoKHR asCreateInfo( - vk::AccelerationStructureCreateFlagsKHR(), // creation flags - blasBuffer.vulkanHandle, // allocated AS buffer. - 0, - asBuildSizesInfo.accelerationStructureSize, // size of the AS - asBuildInfo.type // type of the AS - ); - - // Create the intended AS object - vk::AccelerationStructureKHR blasKHR; - vk::Result res = m_device->createAccelerationStructureKHR( - &asCreateInfo, // AS create info - nullptr, // allocator callbacks - &blasKHR, // the AS - m_rtxDispatcher - ); - if (res != vk::Result::eSuccess) { - vkcv_log(vkcv::LogLevel::ERROR, "The Bottom Level Acceleration Structure could not be build! (%s)", vk::to_string(res).c_str()); - } - asBuildInfo.setDstAccelerationStructure(blasKHR); - - // Allocate the scratch buffer holding temporary build data. - RTXBuffer scratchBuffer; - scratchBuffer.bufferType = RTXBufferType::SCRATCH; - scratchBuffer.deviceSize = asBuildSizesInfo.buildScratchSize; - scratchBuffer.bufferUsageFlagBits = vk::BufferUsageFlagBits::eShaderDeviceAddress - | vk::BufferUsageFlagBits::eStorageBuffer; - scratchBuffer.memoryPropertyFlagBits = { vk::MemoryPropertyFlagBits::eDeviceLocal }; - - createBuffer(scratchBuffer); - - asBuildInfo.setScratchData(getBufferDeviceAddress(scratchBuffer.vulkanHandle)); - - // Since Vulkan requries an array of pointers to - // VkAccelerationStructureBuildRangeInfoKHR objects, get a pointer to - // rangeInfo: - vk::AccelerationStructureBuildRangeInfoKHR* pointerToRangeInfo = &asRangeInfo; - - vk::CommandPool commandPool = createCommandPool(); - vk::CommandBuffer commandBuffer = allocateAndBeginCommandBuffer(commandPool); - - commandBuffer.buildAccelerationStructuresKHR(1, &asBuildInfo, &pointerToRangeInfo, m_rtxDispatcher); - - submitCommandBuffer(commandPool, commandBuffer); - - m_core->getContext().getDevice().destroyBuffer(scratchBuffer.vulkanHandle, nullptr, m_rtxDispatcher); - m_core->getContext().getDevice().freeMemory(scratchBuffer.deviceMemory, nullptr, m_rtxDispatcher); - - BottomLevelAccelerationStructure blas = { - vertexBuffer, - indexBuffer, - blasBuffer, - blasKHR - }; - m_bottomLevelAccelerationStructures.push_back(blas); - } - - void ASManager::buildTLAS() { - // TODO: organize hierarchical structure of multiple BLAS - - // We need an the device address of each BLAS --> TODO: for loop for bigger scenes - vk::AccelerationStructureDeviceAddressInfoKHR addressInfo( - m_bottomLevelAccelerationStructures[0].vulkanHandle - ); - vk::DeviceAddress blasAddress = m_device->getAccelerationStructureAddressKHR(&addressInfo, m_rtxDispatcher); - - std::array<std::array<float, 4>, 3> transformMatrix = { - std::array<float, 4>{1.f, 0.f, 0.f, 0.f}, - std::array<float, 4>{0.f, 1.f, 0.f, 0.f}, - std::array<float, 4>{0.f, 0.f, 1.f, 0.f}, - }; - - vk::TransformMatrixKHR transformMatrixKhr( - transformMatrix // std::array<std::array<float,4>,3> const& - ); - - vk::AccelerationStructureInstanceKHR accelerationStructureInstanceKhr( - transformMatrixKhr, // vk::TransformMatrixKHR transform_ = {}, - 0, // uint32_t instanceCustomIndex, - 0xFF, //uint32_t mask_ = {}, - 0, // uint32_t instanceShaderBindingTableRecordOffset, - vk::GeometryInstanceFlagBitsKHR::eTriangleFacingCullDisable, // vk::GeometryInstanceFlagsKHR - blasAddress // uint64_t accelerationStructureReference (the device address of the BLAS) - ); - - // create a buffer of instances on the device and upload the array of instances to it - RTXBuffer stagingBufferInstances; - stagingBufferInstances.bufferType = RTXBufferType::STAGING; - stagingBufferInstances.deviceSize = sizeof(accelerationStructureInstanceKhr); - stagingBufferInstances.data = &accelerationStructureInstanceKhr; - stagingBufferInstances.bufferUsageFlagBits = vk::BufferUsageFlagBits::eShaderDeviceAddress - | vk::BufferUsageFlagBits::eTransferSrc; - stagingBufferInstances.memoryPropertyFlagBits = vk::MemoryPropertyFlagBits::eHostCoherent - | vk::MemoryPropertyFlagBits::eHostVisible; - - createBuffer(stagingBufferInstances); - - RTXBuffer bufferInstances; - bufferInstances.bufferType = RTXBufferType::GPU; - bufferInstances.deviceSize = sizeof(accelerationStructureInstanceKhr); - bufferInstances.bufferUsageFlagBits = vk::BufferUsageFlagBits::eShaderDeviceAddress - | vk::BufferUsageFlagBits::eTransferDst | vk::BufferUsageFlagBits::eTransferSrc; - bufferInstances.memoryPropertyFlagBits = vk::MemoryPropertyFlagBits::eDeviceLocal; - - createBuffer(bufferInstances); - copyFromCPUToGPU(stagingBufferInstances, bufferInstances); // automatically deletes and frees memory of stagingBufferInstances - - vk::MemoryBarrier barrier; - barrier.setSrcAccessMask(vk::AccessFlagBits::eTransferWrite); - barrier.setDstAccessMask(vk::AccessFlagBits::eAccelerationStructureWriteKHR); - vk::CommandPool commandPool = createCommandPool(); - vk::CommandBuffer commandBuffer = allocateAndBeginCommandBuffer(commandPool); - commandBuffer.pipelineBarrier( - vk::PipelineStageFlagBits::eTransfer, - vk::PipelineStageFlagBits::eAccelerationStructureBuildKHR, - {},1,&barrier,0, nullptr,0,nullptr); - submitCommandBuffer(commandPool, commandBuffer); - - - // ranging information for TLAS build - vk::AccelerationStructureBuildRangeInfoKHR asRangeInfo( - 1, // primitiveCount -> number of instances - 0, // primitiveOffset - 0, // firstVertex - 0 //transformOffset - ); - - vk::DeviceAddress bufferInstancesAddress = getBufferDeviceAddress(bufferInstances.vulkanHandle); - - vk::AccelerationStructureGeometryInstancesDataKHR asInstances( - false, // vk::Bool32 arrayOfPointers - bufferInstancesAddress // vk::DeviceOrHostAddressConstKHR data_ = {} - ); - - // Like creating the BLAS, point to the geometry (in this case, the instances) in a polymorphic object. - vk::AccelerationStructureGeometryKHR asGeometry( - vk::GeometryTypeKHR::eInstances, // vk::GeometryTypeKHR geometryType_ = vk::GeometryTypeKHR::eTriangles - asInstances, // vk::AccelerationStructureGeometryDataKHR geometry_ = {} - {} // vk::GeometryFlagsKHR flags_ = {} - ); - - // Finally, create the TLAS - vk::AccelerationStructureBuildGeometryInfoKHR asBuildInfo( - vk::AccelerationStructureTypeKHR::eTopLevel, // type of the AS: bottom vs. top - vk::BuildAccelerationStructureFlagBitsKHR::ePreferFastTrace, // some flags for different purposes, e.g. efficiency - vk::BuildAccelerationStructureModeKHR::eBuild, // AS mode: build vs. update - {}, // src AS (this seems to be for copying AS) - {}, // dst AS (this seems to be for copying AS) - 1, // the geometryCount. - &asGeometry // the next input entry would be a pointer to a pointer to geometries. Maybe geometryCount depends on the next entry? - ); - - // Query the worst-case AS size and scratch space size based on the number of instances (in this case, 1). - vk::AccelerationStructureBuildSizesInfoKHR asSizeInfo; - m_core->getContext().getDevice().getAccelerationStructureBuildSizesKHR( - vk::AccelerationStructureBuildTypeKHR::eDevice, - &asBuildInfo, - &asRangeInfo.primitiveCount, - &asSizeInfo, - m_rtxDispatcher - ); - - // Allocate a buffer for the acceleration structure. - RTXBuffer tlasBuffer; - tlasBuffer.bufferType = RTXBufferType::ACCELERATION; - tlasBuffer.deviceSize = asSizeInfo.accelerationStructureSize; - tlasBuffer.bufferUsageFlagBits = vk::BufferUsageFlagBits::eAccelerationStructureStorageKHR - | vk::BufferUsageFlagBits::eShaderDeviceAddress - | vk::BufferUsageFlagBits::eStorageBuffer; - - createBuffer(tlasBuffer); - - // Create the acceleration structure object. (Data has not yet been set.) - vk::AccelerationStructureCreateInfoKHR asCreateInfo( - {}, // creation flags - tlasBuffer.vulkanHandle, // allocated AS buffer. - 0, - asSizeInfo.accelerationStructureSize, // size of the AS - asBuildInfo.type // type of the AS - ); - - vk::AccelerationStructureKHR tlas; - vk::Result res = m_device->createAccelerationStructureKHR(&asCreateInfo, nullptr, &tlas, m_rtxDispatcher); - if (res != vk::Result::eSuccess) { - vkcv_log(LogLevel::ERROR, "Top Level Acceleration Structure could not be created! (%s)", vk::to_string(res).c_str()); - } - asBuildInfo.setDstAccelerationStructure(tlas); - - // Allocate the scratch buffer holding temporary build data. - RTXBuffer tlasScratchBuffer; // scratch buffer - tlasScratchBuffer.bufferType = RTXBufferType::ACCELERATION; - tlasScratchBuffer.deviceSize = asSizeInfo.buildScratchSize; - tlasScratchBuffer.bufferUsageFlagBits = vk::BufferUsageFlagBits::eShaderDeviceAddressKHR - | vk::BufferUsageFlagBits::eStorageBuffer; - - createBuffer(tlasScratchBuffer); - - vk::BufferDeviceAddressInfo tempBuildDataBufferDeviceAddressInfo(tlasScratchBuffer.vulkanHandle); - vk::DeviceAddress tempBuildBufferDataAddress = m_core->getContext().getDevice().getBufferAddressKHR(tempBuildDataBufferDeviceAddressInfo, m_rtxDispatcher); - asBuildInfo.setScratchData(tempBuildBufferDataAddress); - - // Create a one-element array of pointers to range info objects. - vk::AccelerationStructureBuildRangeInfoKHR* pointerToRangeInfo = &asRangeInfo; - - // Build the TLAS. - - vk::CommandPool commandPool2 = createCommandPool(); - vk::CommandBuffer commandBuffer2 = allocateAndBeginCommandBuffer(commandPool2); - commandBuffer2.buildAccelerationStructuresKHR(1, &asBuildInfo, &pointerToRangeInfo, m_rtxDispatcher); - submitCommandBuffer(commandPool2, commandBuffer2); - - m_device->destroyBuffer(tlasScratchBuffer.vulkanHandle, nullptr, m_rtxDispatcher); - m_device->freeMemory(tlasScratchBuffer.deviceMemory, nullptr, m_rtxDispatcher); - - m_topLevelAccelerationStructure = { - bufferInstances, - tlasBuffer, - tlasScratchBuffer, - tlas - }; - } - - TopLevelAccelerationStructure ASManager::getTLAS() - { - return m_topLevelAccelerationStructure; - } - - BottomLevelAccelerationStructure ASManager::getBLAS(uint32_t id) - { - return m_bottomLevelAccelerationStructures[id]; - } - - const vk::DispatchLoaderDynamic& ASManager::getDispatcher() { - return m_rtxDispatcher; - } -} \ No newline at end of file diff --git a/modules/rtx/src/vkcv/rtx/RTX.cpp b/modules/rtx/src/vkcv/rtx/RTX.cpp deleted file mode 100644 index 6a64b442..00000000 --- a/modules/rtx/src/vkcv/rtx/RTX.cpp +++ /dev/null @@ -1,298 +0,0 @@ -#include "vkcv/rtx/RTX.hpp" - -namespace vkcv::rtx { - - RTXModule::RTXModule(Core* core, ASManager* asManager, std::vector<float>& vertices, - std::vector<uint32_t>& indices, std::vector<vkcv::DescriptorSetHandle>& descriptorSetHandles){ - m_core = core; - m_asManager = asManager; - // build acceleration structures BLAS then TLAS --> see ASManager - RTXBuffer vertexBuffer = m_asManager->makeBufferFromData(vertices); - RTXBuffer indexBuffer = m_asManager->makeBufferFromData(indices); - m_asManager->buildBLAS(vertexBuffer, vertices.size(), indexBuffer,indices.size()); - m_asManager->buildTLAS(); - RTXDescriptors(descriptorSetHandles); - } - - - RTXModule::~RTXModule() - { - m_core->getContext().getDevice().destroy(m_pipeline); - m_core->getContext().getDevice().destroy(m_pipelineLayout); - m_core->getContext().getDevice().destroy(m_shaderBindingTableBuffer.vulkanHandle); - m_core->getContext().getDevice().freeMemory(m_shaderBindingTableBuffer.deviceMemory); - } - - void RTXModule::createShaderBindingTable(uint32_t shaderCount) { - vk::PhysicalDeviceRayTracingPipelinePropertiesKHR rayTracingProperties; - - vk::PhysicalDeviceProperties2 physicalProperties; - physicalProperties.pNext = &rayTracingProperties; - - m_core->getContext().getPhysicalDevice().getProperties2(&physicalProperties); - - vk::DeviceSize shaderBindingTableSize = rayTracingProperties.shaderGroupHandleSize * shaderCount; - - - m_shaderBindingTableBuffer.bufferType = RTXBufferType::SHADER_BINDING; - m_shaderBindingTableBuffer.bufferUsageFlagBits = vk::BufferUsageFlagBits::eShaderBindingTableKHR | vk::BufferUsageFlagBits::eShaderDeviceAddressKHR; - m_shaderBindingTableBuffer.memoryPropertyFlagBits = vk::MemoryPropertyFlagBits::eHostVisible; - m_shaderBindingTableBuffer.deviceSize = shaderBindingTableSize; - - m_asManager->createBuffer(m_shaderBindingTableBuffer); - - void* shaderHandleStorage = (void*)malloc(sizeof(uint8_t) * shaderBindingTableSize); - - if (m_core->getContext().getDevice().getRayTracingShaderGroupHandlesKHR(m_pipeline, 0, shaderCount, shaderBindingTableSize, - shaderHandleStorage, m_asManager->getDispatcher()) != vk::Result::eSuccess) { - vkcv_log(LogLevel::ERROR, "Could not retrieve shader binding table group handles."); - } - - m_shaderGroupBaseAlignment = rayTracingProperties.shaderGroupBaseAlignment; - uint8_t* mapped = (uint8_t*) m_core->getContext().getDevice().mapMemory(m_shaderBindingTableBuffer.deviceMemory, 0, shaderBindingTableSize); - for (int i = 0; i < shaderCount; i++) { - memcpy(mapped, (uint8_t*)shaderHandleStorage + (i * rayTracingProperties.shaderGroupHandleSize), rayTracingProperties.shaderGroupHandleSize); - mapped += m_shaderGroupBaseAlignment; - } - - m_core->getContext().getDevice().unmapMemory(m_shaderBindingTableBuffer.deviceMemory); - free(shaderHandleStorage); - } - - - void RTXModule::RTXDescriptors(std::vector<vkcv::DescriptorSetHandle>& descriptorSetHandles) - { - //TLAS-Descriptor-Write - TopLevelAccelerationStructure tlas = m_asManager->getTLAS(); - RTXBuffer tlasBuffer = tlas.tlasBuffer; - vk::WriteDescriptorSetAccelerationStructureKHR AccelerationDescriptor = {}; - AccelerationDescriptor.accelerationStructureCount = 1; - const TopLevelAccelerationStructure constTLAS = tlas; - AccelerationDescriptor.pAccelerationStructures = &constTLAS.vulkanHandle; - - vk::WriteDescriptorSet tlasWrite; - tlasWrite.setPNext(&AccelerationDescriptor); - tlasWrite.setDstSet(m_core->getDescriptorSet(descriptorSetHandles[0]).vulkanHandle); - tlasWrite.setDstBinding(1); - tlasWrite.setDstArrayElement(0); - tlasWrite.setDescriptorCount(1); - tlasWrite.setDescriptorType(vk::DescriptorType::eAccelerationStructureKHR); - m_core->getContext().getDevice().updateDescriptorSets(tlasWrite, nullptr); - tlasWrite.setDstBinding(2); - m_core->getContext().getDevice().updateDescriptorSets(tlasWrite, nullptr); - - //INDEX & VERTEX BUFFER - BottomLevelAccelerationStructure blas = m_asManager->getBLAS(0);//HARD CODED - - //VERTEX BUFFER - vk::DescriptorBufferInfo vertexInfo = {}; - vertexInfo.setBuffer(blas.vertexBuffer.vulkanHandle); - vertexInfo.setOffset(0); - vertexInfo.setRange(blas.vertexBuffer.deviceSize); //maybe check if size is correct - - vk::WriteDescriptorSet vertexWrite; - vertexWrite.setDstSet(m_core->getDescriptorSet(descriptorSetHandles[0]).vulkanHandle); - vertexWrite.setDstBinding(3); - vertexWrite.setDescriptorCount(1); - vertexWrite.setDescriptorType(vk::DescriptorType::eStorageBuffer); - vertexWrite.setPBufferInfo(&vertexInfo); - m_core->getContext().getDevice().updateDescriptorSets(vertexWrite, nullptr); - - //INDEXBUFFER - vk::DescriptorBufferInfo indexInfo = {}; - indexInfo.setBuffer(blas.indexBuffer.vulkanHandle); - indexInfo.setOffset(0); - indexInfo.setRange(blas.indexBuffer.deviceSize); //maybe check if size is correct - - vk::WriteDescriptorSet indexWrite; - indexWrite.setDstSet(m_core->getDescriptorSet(descriptorSetHandles[0]).vulkanHandle); - indexWrite.setDstBinding(4); - indexWrite.setDescriptorCount(1); - indexWrite.setDescriptorType(vk::DescriptorType::eStorageBuffer); - indexWrite.setPBufferInfo(&indexInfo); - m_core->getContext().getDevice().updateDescriptorSets(indexWrite, nullptr); - } - - void RTXModule::createRTXPipelineAndLayout(uint32_t pushConstantSize, std::vector<DescriptorSetLayoutHandle> descriptorSetLayouts, ShaderProgram &rtxShader) { - // -- process vkcv::ShaderProgram into vk::ShaderModule - std::vector<char> rayGenShaderCode = rtxShader.getShader(ShaderStage::RAY_GEN).shaderCode; - - vk::ShaderModuleCreateInfo rayGenShaderModuleInfo( - vk::ShaderModuleCreateFlags(), // vk::ShaderModuleCreateFlags flags_, - rayGenShaderCode.size(), // size_t codeSize - (const uint32_t*)rayGenShaderCode.data() // const uint32_t* pCode - ); - vk::ShaderModule rayGenShaderModule = m_core->getContext().getDevice().createShaderModule(rayGenShaderModuleInfo); - if (!rayGenShaderModule) { - vkcv_log(LogLevel::ERROR, "The Ray Generation Shader Module could not be created!"); - } - - std::vector<char> rayMissShaderCode = rtxShader.getShader(ShaderStage::RAY_MISS).shaderCode; - vk::ShaderModuleCreateInfo rayMissShaderModuleInfo( - vk::ShaderModuleCreateFlags(), // vk::ShaderModuleCreateFlags flags_, - rayMissShaderCode.size(), //size_t codeSize - (const uint32_t*)rayMissShaderCode.data() // const uint32_t* pCode - ); - - vk::ShaderModule rayMissShaderModule = m_core->getContext().getDevice().createShaderModule(rayMissShaderModuleInfo); - if (!rayMissShaderModule) { - vkcv_log(LogLevel::ERROR, "The Ray Miss Shader Module could not be created!"); - } - - std::vector<char> rayClosestHitShaderCode = rtxShader.getShader(ShaderStage::RAY_CLOSEST_HIT).shaderCode; - vk::ShaderModuleCreateInfo rayClosestHitShaderModuleInfo( - vk::ShaderModuleCreateFlags(), // vk::ShaderModuleCreateFlags flags_, - rayClosestHitShaderCode.size(), //size_t codeSize - (const uint32_t*)rayClosestHitShaderCode.data() // const uint32_t* pCode_ - ); - vk::ShaderModule rayClosestHitShaderModule = m_core->getContext().getDevice().createShaderModule(rayClosestHitShaderModuleInfo); - if (!rayClosestHitShaderModule) { - vkcv_log(LogLevel::ERROR, "The Ray Closest Hit Shader Module could not be created!"); - } - - // -- PipelineShaderStages - - // ray generation - vk::PipelineShaderStageCreateInfo rayGenShaderStageInfo( - vk::PipelineShaderStageCreateFlags(), // vk::PipelineShaderStageCreateFlags flags_ = {} - vk::ShaderStageFlagBits::eRaygenKHR, // vk::ShaderStageFlagBits stage_ = vk::ShaderStageFlagBits::eVertex, - rayGenShaderModule, // vk::ShaderModule module_ = {}, - "main" // const char* pName_ = {}, - ); - - // ray miss - vk::PipelineShaderStageCreateInfo rayMissShaderStageInfo( - vk::PipelineShaderStageCreateFlags(), // vk::PipelineShaderStageCreateFlags flags_ = {} - vk::ShaderStageFlagBits::eMissKHR, // vk::ShaderStageFlagBits stage_ = vk::ShaderStageFlagBits::eVertex, - rayMissShaderModule, // vk::ShaderModule module_ = {}, - "main" // const char* pName_ = {}, - ); - - // ray closest hit - vk::PipelineShaderStageCreateInfo rayClosestHitShaderStageInfo( - vk::PipelineShaderStageCreateFlags(), // vk::PipelineShaderStageCreateFlags flags_ = {} - vk::ShaderStageFlagBits::eClosestHitKHR, // vk::ShaderStageFlagBits stage_ = vk::ShaderStageFlagBits::eVertex, - rayClosestHitShaderModule, // vk::ShaderModule module_ = {}, - "main" // const char* pName_ = {}, - ); - - std::vector<vk::PipelineShaderStageCreateInfo> shaderStages = { // HARD CODED. TODO: Support more shader stages. - rayGenShaderStageInfo, rayMissShaderStageInfo, rayClosestHitShaderStageInfo - }; - - // -- PipelineLayouts - - std::vector<vk::RayTracingShaderGroupCreateInfoKHR> shaderGroups(shaderStages.size()); - // Ray Gen - shaderGroups[0] = vk::RayTracingShaderGroupCreateInfoKHR( - vk::RayTracingShaderGroupTypeKHR::eGeneral, // vk::RayTracingShaderGroupTypeKHR type_ = vk::RayTracingShaderGroupTypeKHR::eGeneral - 0, // uint32_t generalShader_ = {} - VK_SHADER_UNUSED_KHR, // uint32_t closestHitShader_ = {} - VK_SHADER_UNUSED_KHR, // uint32_t anyHitShader_ = {} - VK_SHADER_UNUSED_KHR, // uint32_t intersectionShader_ = {} - nullptr // const void* pShaderGroupCaptureReplayHandle_ = {} - ); - // Ray Miss - shaderGroups[1] = vk::RayTracingShaderGroupCreateInfoKHR( - vk::RayTracingShaderGroupTypeKHR::eGeneral, // vk::RayTracingShaderGroupTypeKHR type_ = vk::RayTracingShaderGroupTypeKHR::eGeneral - 1, // uint32_t generalShader_ = {} - VK_SHADER_UNUSED_KHR, // uint32_t closestHitShader_ = {} - VK_SHADER_UNUSED_KHR, // uint32_t anyHitShader_ = {} - VK_SHADER_UNUSED_KHR, // uint32_t intersectionShader_ = {} - nullptr // const void* pShaderGroupCaptureReplayHandle_ = {} - ); - // Ray Closest Hit - shaderGroups[2] = vk::RayTracingShaderGroupCreateInfoKHR( - vk::RayTracingShaderGroupTypeKHR::eTrianglesHitGroup, // vk::RayTracingShaderGroupTypeKHR type_ = vk::RayTracingShaderGroupTypeKHR::eGeneral - VK_SHADER_UNUSED_KHR, // uint32_t generalShader_ = {} - 2, // uint32_t closestHitShader_ = {} - VK_SHADER_UNUSED_KHR, // uint32_t anyHitShader_ = {} - VK_SHADER_UNUSED_KHR, // uint32_t intersectionShader_ = {} - nullptr // const void* pShaderGroupCaptureReplayHandle_ = {} - ); - - std::vector<vk::DescriptorSetLayout> descriptorSetLayoutsVulkan; - for (size_t i=0; i<descriptorSetLayouts.size(); i++) { - descriptorSetLayoutsVulkan.push_back(m_core->getDescriptorSetLayout(descriptorSetLayouts[i]).vulkanHandle); - } - - vk::PushConstantRange pushConstant( - vk::ShaderStageFlagBits::eRaygenKHR | vk::ShaderStageFlagBits::eClosestHitKHR | vk::ShaderStageFlagBits::eMissKHR, // vk::ShaderStageFlags stageFlags_ = {}, - 0, // uint32_t offset_ = {}, - pushConstantSize // uint32_t size_ = {} - ); - - vk::PipelineLayoutCreateInfo rtxPipelineLayoutCreateInfo( - vk::PipelineLayoutCreateFlags(), // vk::PipelineLayoutCreateFlags flags_ = {} - (uint32_t) descriptorSetLayoutsVulkan.size(), // uint32_t setLayoutCount_ = {} HARD CODED (2) - descriptorSetLayoutsVulkan.data(), // const vk::DescriptorSetLayout* pSetLayouts_ = {} - 1, // 0, // uint32_t pushConstantRangeCount_ = {} - &pushConstant // nullptr // const vk::PushConstantRange* pPushConstantRanges_ = {} - ); - - m_pipelineLayout = m_core->getContext().getDevice().createPipelineLayout(rtxPipelineLayoutCreateInfo); - if (!m_pipelineLayout) { - vkcv_log(LogLevel::ERROR, "The RTX Pipeline Layout could not be created!"); - } - - vk::PipelineLibraryCreateInfoKHR rtxPipelineLibraryCreateInfo( - 0, // uint32_t libraryCount_ = {} - nullptr // const vk::Pipeline* pLibraries_ = {} - ); - - // -- RTX Pipeline - - vk::RayTracingPipelineCreateInfoKHR rtxPipelineInfo( - vk::PipelineCreateFlags(), // vk::PipelineCreateFlags flags_ = {} - (uint32_t) shaderStages.size(), // uint32_t stageCount_ = {} - shaderStages.data(), // const vk::PipelineShaderStageCreateInfo* pStages_ = {} - (uint32_t) shaderGroups.size(), // uint32_t groupCount_ = {} - shaderGroups.data(), // const vk::RayTracingShaderGroupCreateInfoKHR* pGroups_ = {} - 16, // uint32_t maxPipelineRayRecursionDepth_ = {} - &rtxPipelineLibraryCreateInfo, // const vk::PipelineLibraryCreateInfoKHR* pLibraryInfo_ = {} - nullptr, // const vk::RayTracingPipelineInterfaceCreateInfoKHR* pLibraryInterface_ = {} - nullptr, // const vk::PipelineDynamicStateCreateInfo* pDynamicState_ = {} - m_pipelineLayout // vk::PipelineLayout layout_ = {} - ); - - auto pipelineResult = m_core->getContext().getDevice().createRayTracingPipelineKHR( - vk::DeferredOperationKHR(), - vk::PipelineCache(), - rtxPipelineInfo, - nullptr, - m_asManager->getDispatcher() - ); - - if (pipelineResult.result != vk::Result::eSuccess) { - vkcv_log(LogLevel::ERROR, "The RTX Pipeline could not be created!"); - } - - m_pipeline = pipelineResult.value; - - m_core->getContext().getDevice().destroy(rayGenShaderModule); - m_core->getContext().getDevice().destroy(rayMissShaderModule); - m_core->getContext().getDevice().destroy(rayClosestHitShaderModule); - - // TODO: add possibility of more than one shader per stage - createShaderBindingTable(shaderStages.size()); - } - - vk::Pipeline RTXModule::getPipeline() { - return m_pipeline; - } - - vk::Buffer RTXModule::getShaderBindingTableBuffer() - { - return m_shaderBindingTableBuffer.vulkanHandle; - } - - vk::DeviceSize RTXModule::getShaderGroupBaseAlignment() - { - return m_shaderGroupBaseAlignment; - } - - vk::PipelineLayout RTXModule::getPipelineLayout() { - return m_pipelineLayout; - } - -} \ No newline at end of file diff --git a/modules/rtx/src/vkcv/rtx/RTXExtensions.cpp b/modules/rtx/src/vkcv/rtx/RTXExtensions.cpp deleted file mode 100644 index 59a248ac..00000000 --- a/modules/rtx/src/vkcv/rtx/RTXExtensions.cpp +++ /dev/null @@ -1,130 +0,0 @@ -#include "vkcv/rtx/RTXExtensions.hpp" - -namespace vkcv::rtx{ - -RTXExtensions::RTXExtensions() -{ - - // prepare needed raytracing extensions - m_instanceExtensions = { - VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME - }; - m_deviceExtensions = { - VK_KHR_MAINTENANCE3_EXTENSION_NAME, - VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME, - VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME, - VK_KHR_DEFERRED_HOST_OPERATIONS_EXTENSION_NAME, - VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME, - VK_KHR_SPIRV_1_4_EXTENSION_NAME, - VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME, - VK_KHR_RAY_QUERY_EXTENSION_NAME, - VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME - }; - - // get all features required by the device extensions - for (auto deviceExtension : m_deviceExtensions) { - m_features.requireExtension(deviceExtension); - } - - /* FIXME: We must disable features that will be mentioned as "not supported" by the FeatureManager. If every unsupported feature is disabled, this should work. - * Maybe we find a better workaround... - */ - m_features.requireFeature<vk::PhysicalDeviceVulkan12Features>( - [](vk::PhysicalDeviceVulkan12Features& features) { - features.setSamplerMirrorClampToEdge(true); - features.setDrawIndirectCount(true); - features.setStorageBuffer8BitAccess(true); - features.setUniformAndStorageBuffer8BitAccess(true); - features.setStoragePushConstant8(true); - features.setShaderBufferInt64Atomics(true); - features.setShaderSharedInt64Atomics(true); - features.setShaderFloat16(true); - features.setShaderInt8(true); - features.setDescriptorIndexing(true); - features.setShaderInputAttachmentArrayDynamicIndexing(true); - features.setShaderUniformTexelBufferArrayDynamicIndexing(true); - features.setShaderStorageTexelBufferArrayDynamicIndexing(true); - features.setShaderUniformBufferArrayNonUniformIndexing(true); - features.setShaderSampledImageArrayNonUniformIndexing(true); - features.setShaderStorageBufferArrayNonUniformIndexing(true); - features.setShaderStorageImageArrayNonUniformIndexing(true); - features.setShaderInputAttachmentArrayNonUniformIndexing(true); - features.setShaderUniformTexelBufferArrayNonUniformIndexing(true); - features.setShaderStorageTexelBufferArrayNonUniformIndexing(true); - features.setDescriptorBindingUniformBufferUpdateAfterBind(true); - features.setDescriptorBindingSampledImageUpdateAfterBind(true); - features.setDescriptorBindingStorageImageUpdateAfterBind(true); - features.setDescriptorBindingStorageBufferUpdateAfterBind(true); - features.setDescriptorBindingUniformTexelBufferUpdateAfterBind(true); - features.setDescriptorBindingStorageTexelBufferUpdateAfterBind(true); - features.setDescriptorBindingUpdateUnusedWhilePending(true); - features.setDescriptorBindingPartiallyBound(true); - features.setDescriptorBindingVariableDescriptorCount(true); - features.setRuntimeDescriptorArray(true); - features.setSamplerFilterMinmax(true); - features.setScalarBlockLayout(true); - features.setImagelessFramebuffer(true); - features.setUniformBufferStandardLayout(true); - features.setShaderSubgroupExtendedTypes(true); - features.setSeparateDepthStencilLayouts(true); - features.setHostQueryReset(true); - features.setTimelineSemaphore(true); - features.setBufferDeviceAddress(true); - features.setBufferDeviceAddressCaptureReplay(true); - features.setBufferDeviceAddressMultiDevice(true); - features.setVulkanMemoryModel(true); - features.setVulkanMemoryModelDeviceScope(true); - features.setVulkanMemoryModelAvailabilityVisibilityChains(true); - features.setShaderOutputViewportIndex(true); - features.setShaderOutputLayer(true); - features.setSubgroupBroadcastDynamicId(true); - }); - m_features.requireFeature<vk::PhysicalDeviceVulkan11Features>( - [](vk::PhysicalDeviceVulkan11Features& features) { - features.setMultiview(true); - features.setMultiviewGeometryShader(true); - features.setMultiviewTessellationShader(true); - // features.setProtectedMemory(true); // not supported - features.setSamplerYcbcrConversion(true); - features.setShaderDrawParameters(true); - features.setStorageBuffer16BitAccess(true); - // features.setStorageInputOutput16(true); // not supported - features.setStoragePushConstant16(true); - features.setUniformAndStorageBuffer16BitAccess(true); - features.setVariablePointers(true); - features.setVariablePointersStorageBuffer(true); - }); - m_features.requireFeature<vk::PhysicalDeviceAccelerationStructureFeaturesKHR>( - [](vk::PhysicalDeviceAccelerationStructureFeaturesKHR& features) { - features.setAccelerationStructure(true); - features.setAccelerationStructureCaptureReplay(true); - // features.setAccelerationStructureIndirectBuild(true); // not supported - // features.setAccelerationStructureHostCommands(true); // not supported - features.setDescriptorBindingAccelerationStructureUpdateAfterBind(true); - }); - m_features.requireExtensionFeature<vk::PhysicalDeviceRayTracingPipelineFeaturesKHR>( - VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME, [](vk::PhysicalDeviceRayTracingPipelineFeaturesKHR& features) { - features.setRayTracingPipeline(true); - // features.setRayTracingPipelineShaderGroupHandleCaptureReplay(true); // not supported - // features.setRayTracingPipelineShaderGroupHandleCaptureReplayMixed(true); // not supported - features.setRayTracingPipelineTraceRaysIndirect(true); - features.setRayTraversalPrimitiveCulling(true); - }); -} - -std::vector<const char*> RTXExtensions::getInstanceExtensions() -{ - return m_instanceExtensions; -} - -std::vector<const char*> RTXExtensions::getDeviceExtensions() -{ - return m_deviceExtensions; -} - -vkcv::Features RTXExtensions::getFeatures() -{ - return m_features; -} - -} \ No newline at end of file diff --git a/projects/CMakeLists.txt b/projects/CMakeLists.txt index dde8bfa9..07623300 100644 --- a/projects/CMakeLists.txt +++ b/projects/CMakeLists.txt @@ -4,7 +4,7 @@ add_subdirectory(first_triangle) add_subdirectory(first_mesh) add_subdirectory(first_scene) add_subdirectory(particle_simulation) -add_subdirectory(rtx) +add_subdirectory(rtx_ambient_occlusion) add_subdirectory(voxelization) add_subdirectory(mesh_shader) add_subdirectory(indirect_dispatch) diff --git a/projects/rtx/CMakeLists.txt b/projects/rtx/CMakeLists.txt deleted file mode 100644 index 56cfa576..00000000 --- a/projects/rtx/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -project(rtx) - -# setting c++ standard for the project -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -# this should fix the execution path to load local files from the project -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - -# adding source files to the project -add_executable(rtx src/main.cpp src/teapot.hpp) - -# this should fix the execution path to load local files from the project (for MSVC) -if(MSVC) - set_target_properties(rtx PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - set_target_properties(rtx PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - - # in addition to setting the output directory, the working directory has to be set - # by default visual studio sets the working directory to the build directory, when using the debugger - set_target_properties(rtx PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) -endif() - -# including headers of dependencies and the VkCV framework -target_include_directories(rtx SYSTEM BEFORE PRIVATE ${vkcv_include} ${vkcv_includes} ${vkcv_asset_loader_include} ${vkcv_camera_include} ${vkcv_scene_include} ${vkcv_shader_compiler_include} ${vkcv_rtx_include}) - -# linking with libraries from all dependencies and the VkCV framework -target_link_libraries(rtx vkcv ${vkcv_libraries} vkcv_asset_loader ${vkcv_asset_loader_libraries} vkcv_camera vkcv_scene vkcv_shader_compiler vkcv_rtx) diff --git a/projects/rtx/resources/Cutlery/Cutlery_chrome_BaseColor.png b/projects/rtx/resources/Cutlery/Cutlery_chrome_BaseColor.png deleted file mode 100644 index 8258525f..00000000 --- a/projects/rtx/resources/Cutlery/Cutlery_chrome_BaseColor.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0ce87f6407ee40ffa60983587aeb52333d59b4b1c01a53e11f4bb227ba1099d9 -size 109 diff --git a/projects/rtx/resources/Cutlery/Cutlery_chrome_Normal.png b/projects/rtx/resources/Cutlery/Cutlery_chrome_Normal.png deleted file mode 100644 index 620fe762..00000000 --- a/projects/rtx/resources/Cutlery/Cutlery_chrome_Normal.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:68a0064d457a6f7994814b07d943deda778754128935689874334300ede6161d -size 2332064 diff --git a/projects/rtx/resources/Cutlery/Cutlery_details_BaseColor.png b/projects/rtx/resources/Cutlery/Cutlery_details_BaseColor.png deleted file mode 100644 index 5570e88c..00000000 --- a/projects/rtx/resources/Cutlery/Cutlery_details_BaseColor.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:42c2715635081eb29c4489ce631798b0e9c881460efc0aa63d0e81641a0dcfe9 -size 108 diff --git a/projects/rtx/resources/Cutlery/Cutlery_details_Normal.png b/projects/rtx/resources/Cutlery/Cutlery_details_Normal.png deleted file mode 100644 index d07681f5..00000000 --- a/projects/rtx/resources/Cutlery/Cutlery_details_Normal.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:15b0133e140899c47ccf35b0f99a7e337e3110ae089f45d27faf9983f3e0a1f7 -size 770758 diff --git a/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Caps_BaseColor.png b/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Caps_BaseColor.png deleted file mode 100644 index 1845e8a7..00000000 --- a/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Caps_BaseColor.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ea7c82c0f9e25afa401470df1fb6903f508fa138d21ad30f57a9153b0395b198 -size 521315 diff --git a/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Caps_Normal.png b/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Caps_Normal.png deleted file mode 100644 index 1c800c04..00000000 --- a/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Caps_Normal.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:119efbbc020244ff9b7ff16ac9795a6d4b1808d1b90d81d20d2c874d0dc8a924 -size 1693468 diff --git a/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Glass_Wine_BaseColor.png b/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Glass_Wine_BaseColor.png deleted file mode 100644 index 36f46ebf..00000000 --- a/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Glass_Wine_BaseColor.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:99896468c7d47dd5391d585eecf149f420eca3bfec31923c21fa86c45fe02d0f -size 108 diff --git a/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Glass_Wine_Normal.png b/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Glass_Wine_Normal.png deleted file mode 100644 index 28c205d4..00000000 --- a/projects/rtx/resources/Cutlery/Paris_LiquorBottle_01_Glass_Wine_Normal.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b31618aa5adce4ad476bec2c03718c5ae097250e784344f2d298b8a74c3bfd46 -size 90 diff --git a/projects/rtx/resources/Cutlery/Plates_Ceramic_BaseColor.png b/projects/rtx/resources/Cutlery/Plates_Ceramic_BaseColor.png deleted file mode 100644 index e0104189..00000000 --- a/projects/rtx/resources/Cutlery/Plates_Ceramic_BaseColor.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6eff6ccd12d8b39d60ae5ee91edd73d4d7838fcb5d9bc6ff0e671bdf009134e9 -size 109 diff --git a/projects/rtx/resources/Cutlery/Plates_Ceramic_Normal.png b/projects/rtx/resources/Cutlery/Plates_Ceramic_Normal.png deleted file mode 100644 index fa13483d..00000000 --- a/projects/rtx/resources/Cutlery/Plates_Ceramic_Normal.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fe92c40ff4032fdaf10eeafd943657a0c6e0bfb3f38770f5654aa943a660f421 -size 59419 diff --git a/projects/rtx/resources/Cutlery/Plates_Details_BaseColor-Plates_Details_BaseColor.png b/projects/rtx/resources/Cutlery/Plates_Details_BaseColor-Plates_Details_BaseColor.png deleted file mode 100644 index b91d0ac6..00000000 --- a/projects/rtx/resources/Cutlery/Plates_Details_BaseColor-Plates_Details_BaseColor.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4ca7d436a68a2a1237aee6e763b2954f01666b21f1dbd46929a322ea277483d2 -size 779227 diff --git a/projects/rtx/resources/Cutlery/Plates_Details_Normal.png b/projects/rtx/resources/Cutlery/Plates_Details_Normal.png deleted file mode 100644 index 6efd9679..00000000 --- a/projects/rtx/resources/Cutlery/Plates_Details_Normal.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b01fc6482054c64d7407b283731e57fce0601a8db28b6781c14fae3c6b30b0fe -size 504362 diff --git a/projects/rtx/resources/Cutlery/ToffeeJar_Label_BaseColor.png b/projects/rtx/resources/Cutlery/ToffeeJar_Label_BaseColor.png deleted file mode 100644 index d0e0c4f4..00000000 --- a/projects/rtx/resources/Cutlery/ToffeeJar_Label_BaseColor.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:df138ee68c1d455652d1b9ae3dd03e93fcd2f6a0d8a1f12e3710f39143088674 -size 1593466 diff --git a/projects/rtx/resources/Cutlery/ToffeeJar_Label_Normal.png b/projects/rtx/resources/Cutlery/ToffeeJar_Label_Normal.png deleted file mode 100644 index 9f310653..00000000 --- a/projects/rtx/resources/Cutlery/ToffeeJar_Label_Normal.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6af5da97cbb25d79aea2dde8dd71ecbd495334fe34e99497ba17821be93fd7fd -size 2696676 diff --git a/projects/rtx/resources/Cutlery/TransparentGlass_BaseColor.png b/projects/rtx/resources/Cutlery/TransparentGlass_BaseColor.png deleted file mode 100644 index 4e4f0fcb..00000000 --- a/projects/rtx/resources/Cutlery/TransparentGlass_BaseColor.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2796affdfdcf6bc805176d9f85505680b5ee52eeec625e9eaeea4f0ff3854883 -size 108 diff --git a/projects/rtx/resources/Cutlery/TransparentGlass_Normal.png b/projects/rtx/resources/Cutlery/TransparentGlass_Normal.png deleted file mode 100644 index 28c205d4..00000000 --- a/projects/rtx/resources/Cutlery/TransparentGlass_Normal.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b31618aa5adce4ad476bec2c03718c5ae097250e784344f2d298b8a74c3bfd46 -size 90 diff --git a/projects/rtx/resources/Cutlery/cutlerySzene.bin b/projects/rtx/resources/Cutlery/cutlerySzene.bin deleted file mode 100644 index ab9a0aa4..00000000 --- a/projects/rtx/resources/Cutlery/cutlerySzene.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f545b986e0a1ac5bff5d49693a52042aa37878425818f72c69c243da20d1f99d -size 183324 diff --git a/projects/rtx/resources/Cutlery/cutlerySzene.glb b/projects/rtx/resources/Cutlery/cutlerySzene.glb deleted file mode 100644 index b0c5f345..00000000 --- a/projects/rtx/resources/Cutlery/cutlerySzene.glb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fb1bad604192ca36222c0ca485ba87b846ecbd11ee8254327e04e3c993b00116 -size 11150396 diff --git a/projects/rtx/resources/Cutlery/cutlerySzene.gltf b/projects/rtx/resources/Cutlery/cutlerySzene.gltf deleted file mode 100644 index 53e339cd..00000000 --- a/projects/rtx/resources/Cutlery/cutlerySzene.gltf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c77cd60e2327daca1a01044e45f2c38655f7b781bd07985fc0135328a8a96b57 -size 34312 diff --git a/projects/rtx/resources/Sponza/Sponza.bin b/projects/rtx/resources/Sponza/Sponza.bin deleted file mode 100644 index cfedd26c..00000000 --- a/projects/rtx/resources/Sponza/Sponza.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4b809f7a17687dc99e6f41ca1ea32c06eded8779bf34d16f1f565d750b0ffd68 -size 6347696 diff --git a/projects/rtx/resources/Sponza/Sponza.gltf b/projects/rtx/resources/Sponza/Sponza.gltf deleted file mode 100644 index 172ea07e..00000000 --- a/projects/rtx/resources/Sponza/Sponza.gltf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5cc0ecad5c4694088ff820e663619c370421afc1323ac487406e8e9b4735d787 -size 713962 diff --git a/projects/rtx/resources/Sponza/SponzaFloor.bin b/projects/rtx/resources/Sponza/SponzaFloor.bin deleted file mode 100644 index 68425128..00000000 --- a/projects/rtx/resources/Sponza/SponzaFloor.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:678455aca641cb1f449aa1a5054a7cae132be81c2b333aac283053967da66df0 -size 512 diff --git a/projects/rtx/resources/Sponza/SponzaFloor.gltf b/projects/rtx/resources/Sponza/SponzaFloor.gltf deleted file mode 100644 index b45f1c55..00000000 --- a/projects/rtx/resources/Sponza/SponzaFloor.gltf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a6deb75441b1138b50a6b0eec05e60df276fe8fb6d58118fdfce2090b6fbe734 -size 3139 diff --git a/projects/rtx/resources/Sponza/background.png b/projects/rtx/resources/Sponza/background.png deleted file mode 100644 index b64def12..00000000 --- a/projects/rtx/resources/Sponza/background.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f5b5f900ff8ed83a31750ec8e428b5b91273794ddcbfc4e4b8a6a7e781f8c686 -size 1417666 diff --git a/projects/rtx/resources/Sponza/chain_texture.png b/projects/rtx/resources/Sponza/chain_texture.png deleted file mode 100644 index c1e1768c..00000000 --- a/projects/rtx/resources/Sponza/chain_texture.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d8362cfd472880daeaea37439326a4651d1338680ae69bb2513fc6b17c8de7d4 -size 490895 diff --git a/projects/rtx/resources/Sponza/lion.png b/projects/rtx/resources/Sponza/lion.png deleted file mode 100644 index c49c7f0e..00000000 --- a/projects/rtx/resources/Sponza/lion.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9f882f746c3a9cd51a9c6eedc1189b97668721d91a3fe49232036e789912c652 -size 2088728 diff --git a/projects/rtx/resources/Sponza/spnza_bricks_a_diff.png b/projects/rtx/resources/Sponza/spnza_bricks_a_diff.png deleted file mode 100644 index cde4c7a6..00000000 --- a/projects/rtx/resources/Sponza/spnza_bricks_a_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b94219c2f5f943f3f4715c74e7d1038bf0ab3b3b3216a758eaee67f875df0851 -size 1928829 diff --git a/projects/rtx/resources/Sponza/sponza_arch_diff.png b/projects/rtx/resources/Sponza/sponza_arch_diff.png deleted file mode 100644 index bcd9bda2..00000000 --- a/projects/rtx/resources/Sponza/sponza_arch_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c0df2c8a01b2843b1c792b494f7173cdbc4f834840fc2177af3e5d690fceda57 -size 1596151 diff --git a/projects/rtx/resources/Sponza/sponza_ceiling_a_diff.png b/projects/rtx/resources/Sponza/sponza_ceiling_a_diff.png deleted file mode 100644 index 59de631f..00000000 --- a/projects/rtx/resources/Sponza/sponza_ceiling_a_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ab6c187a81aa68f4eba30119e17fce2e4882a9ec320f70c90482dbe9da82b1c6 -size 1872074 diff --git a/projects/rtx/resources/Sponza/sponza_column_a_diff.png b/projects/rtx/resources/Sponza/sponza_column_a_diff.png deleted file mode 100644 index 01a82432..00000000 --- a/projects/rtx/resources/Sponza/sponza_column_a_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2c291507e2808bb83e160ab4b020689817df273baad3713a9ad19ac15fac6826 -size 1840992 diff --git a/projects/rtx/resources/Sponza/sponza_column_b_diff.png b/projects/rtx/resources/Sponza/sponza_column_b_diff.png deleted file mode 100644 index 10a660cc..00000000 --- a/projects/rtx/resources/Sponza/sponza_column_b_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2820b0267c4289c6cedbb42721792a57ef244ec2d0935941011c2a7d3fe88a9b -size 2170433 diff --git a/projects/rtx/resources/Sponza/sponza_column_c_diff.png b/projects/rtx/resources/Sponza/sponza_column_c_diff.png deleted file mode 100644 index bc46fd97..00000000 --- a/projects/rtx/resources/Sponza/sponza_column_c_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a0bc993ff59865468ef4530798930c7dfefb07482d71db45bc2a520986b27735 -size 2066950 diff --git a/projects/rtx/resources/Sponza/sponza_curtain_blue_diff.png b/projects/rtx/resources/Sponza/sponza_curtain_blue_diff.png deleted file mode 100644 index 384c8c2c..00000000 --- a/projects/rtx/resources/Sponza/sponza_curtain_blue_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b85c6bb3cd5105f48d3812ec8e7a1068521ce69e917300d79e136e19d45422fb -size 9510905 diff --git a/projects/rtx/resources/Sponza/sponza_curtain_diff.png b/projects/rtx/resources/Sponza/sponza_curtain_diff.png deleted file mode 100644 index af842e9f..00000000 --- a/projects/rtx/resources/Sponza/sponza_curtain_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:563c56bdbbee395a6ef7f0c51c8ac9223c162e517b4cdba0d4654e8de27c98d8 -size 9189263 diff --git a/projects/rtx/resources/Sponza/sponza_curtain_green_diff.png b/projects/rtx/resources/Sponza/sponza_curtain_green_diff.png deleted file mode 100644 index 6c9b6391..00000000 --- a/projects/rtx/resources/Sponza/sponza_curtain_green_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:238fe1c7f481388d1c1d578c2da8d411b99e8f0030ab62060a306db333124476 -size 8785458 diff --git a/projects/rtx/resources/Sponza/sponza_details_diff.png b/projects/rtx/resources/Sponza/sponza_details_diff.png deleted file mode 100644 index 12656686..00000000 --- a/projects/rtx/resources/Sponza/sponza_details_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cb1223b3bb82f8757e7df25a6891f1239cdd7ec59990340e952fb2d6b7ea570c -size 1522643 diff --git a/projects/rtx/resources/Sponza/sponza_fabric_blue_diff.png b/projects/rtx/resources/Sponza/sponza_fabric_blue_diff.png deleted file mode 100644 index 879d16ef..00000000 --- a/projects/rtx/resources/Sponza/sponza_fabric_blue_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:467d290bf5d4b2a017da140ba9e244ed8a8a9be5418a9ac9bcb4ad572ae2d7ab -size 2229440 diff --git a/projects/rtx/resources/Sponza/sponza_fabric_diff.png b/projects/rtx/resources/Sponza/sponza_fabric_diff.png deleted file mode 100644 index 3311287a..00000000 --- a/projects/rtx/resources/Sponza/sponza_fabric_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1594f59cc2848db26add47361f4e665e3d8afa147760ed915d839fea42b20287 -size 2267382 diff --git a/projects/rtx/resources/Sponza/sponza_fabric_green_diff.png b/projects/rtx/resources/Sponza/sponza_fabric_green_diff.png deleted file mode 100644 index de110f36..00000000 --- a/projects/rtx/resources/Sponza/sponza_fabric_green_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:902b87faab221173bf370cea7c74cb9060b4d870ac6316b190dafded1cb12993 -size 2258220 diff --git a/projects/rtx/resources/Sponza/sponza_flagpole_diff.png b/projects/rtx/resources/Sponza/sponza_flagpole_diff.png deleted file mode 100644 index 5f6e0812..00000000 --- a/projects/rtx/resources/Sponza/sponza_flagpole_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bfffb62e770959c725d0f3db6dc7dbdd46a380ec55ef884dab94d44ca017b438 -size 1425673 diff --git a/projects/rtx/resources/Sponza/sponza_floor_a_diff.png b/projects/rtx/resources/Sponza/sponza_floor_a_diff.png deleted file mode 100644 index 788ed764..00000000 --- a/projects/rtx/resources/Sponza/sponza_floor_a_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a16f9230fa91f9f31dfca6216ce205f1ef132d44f3b012fbf6efc0fba69770ab -size 1996838 diff --git a/projects/rtx/resources/Sponza/sponza_roof_diff.png b/projects/rtx/resources/Sponza/sponza_roof_diff.png deleted file mode 100644 index c5b84261..00000000 --- a/projects/rtx/resources/Sponza/sponza_roof_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7fc412138c20da19f8173e53545e771f4652558dff624d4dc67143e40efe562b -size 2320533 diff --git a/projects/rtx/resources/Sponza/sponza_thorn_diff.png b/projects/rtx/resources/Sponza/sponza_thorn_diff.png deleted file mode 100644 index 7a914267..00000000 --- a/projects/rtx/resources/Sponza/sponza_thorn_diff.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a73a17c883cd0d0d67cfda2dc4118400a916366c05b9a5ac465f0c8b30fd9c8e -size 635001 diff --git a/projects/rtx/resources/Sponza/vase_dif.png b/projects/rtx/resources/Sponza/vase_dif.png deleted file mode 100644 index 61236a81..00000000 --- a/projects/rtx/resources/Sponza/vase_dif.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:53d06f52bf9e59df4cf00237707cca76c4f692bda61a62b06a30d321311d6dd9 -size 1842101 diff --git a/projects/rtx/resources/Sponza/vase_hanging.png b/projects/rtx/resources/Sponza/vase_hanging.png deleted file mode 100644 index 36a3cee7..00000000 --- a/projects/rtx/resources/Sponza/vase_hanging.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a9d10b4f27a3c9a78d5bac882fdd4b6a6987c262f48fa490670fe5e235951e31 -size 1432804 diff --git a/projects/rtx/resources/Sponza/vase_plant.png b/projects/rtx/resources/Sponza/vase_plant.png deleted file mode 100644 index 7ad95e70..00000000 --- a/projects/rtx/resources/Sponza/vase_plant.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d2087371ff02212fb7014b6daefa191cf5676d2227193fff261a5d02f554cb8e -size 998089 diff --git a/projects/rtx/resources/Sponza/vase_round.png b/projects/rtx/resources/Sponza/vase_round.png deleted file mode 100644 index c17953ab..00000000 --- a/projects/rtx/resources/Sponza/vase_round.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:aa23d48d492d5d4ada2ddb27d1ef22952b214e6eb3b301c65f9d88442723d20a -size 1871399 diff --git a/projects/rtx/resources/Szene/Szene.bin b/projects/rtx/resources/Szene/Szene.bin deleted file mode 100644 index c87d2763..00000000 --- a/projects/rtx/resources/Szene/Szene.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ee4742718f720d589a2a03f5d879f8c50ba9057718d191a43b046eaa9071080d -size 70328 diff --git a/projects/rtx/resources/Szene/Szene.gltf b/projects/rtx/resources/Szene/Szene.gltf deleted file mode 100644 index e5a32b29..00000000 --- a/projects/rtx/resources/Szene/Szene.gltf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:75ba834118792ebbacf528a1690c7d04df4b4c8122b9f99a9aa9a9d075d2c86a -size 7421 diff --git a/projects/rtx/resources/Szene/boards2_vcyc.jpg b/projects/rtx/resources/Szene/boards2_vcyc.jpg deleted file mode 100644 index 2636039e..00000000 --- a/projects/rtx/resources/Szene/boards2_vcyc.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cca33a6e58ddd1b37a6e6853a9aa0e7b15ca678937119194752393dd2a0a0564 -size 1192476 diff --git a/projects/rtx/resources/Szene/boards2_vcyc_jpg.jpg b/projects/rtx/resources/Szene/boards2_vcyc_jpg.jpg deleted file mode 100644 index 2636039e..00000000 --- a/projects/rtx/resources/Szene/boards2_vcyc_jpg.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cca33a6e58ddd1b37a6e6853a9aa0e7b15ca678937119194752393dd2a0a0564 -size 1192476 diff --git a/projects/rtx/resources/cube/boards2_vcyc_jpg.jpg b/projects/rtx/resources/cube/boards2_vcyc_jpg.jpg deleted file mode 100644 index 2636039e..00000000 --- a/projects/rtx/resources/cube/boards2_vcyc_jpg.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cca33a6e58ddd1b37a6e6853a9aa0e7b15ca678937119194752393dd2a0a0564 -size 1192476 diff --git a/projects/rtx/resources/cube/cube.bin b/projects/rtx/resources/cube/cube.bin deleted file mode 100644 index 3303cd86..00000000 --- a/projects/rtx/resources/cube/cube.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9bb9b6b8bbe50a0aaa517057f245ee844f80afa7426dacb2aed4128f71629ce4 -size 840 diff --git a/projects/rtx/resources/cube/cube.blend b/projects/rtx/resources/cube/cube.blend deleted file mode 100644 index 62ccb2c7..00000000 --- a/projects/rtx/resources/cube/cube.blend +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a6c1e245f259c610528c9485db6688928faac0ab2addee9e3c2dde7740e4dd09 -size 774920 diff --git a/projects/rtx/resources/cube/cube.blend1 b/projects/rtx/resources/cube/cube.blend1 deleted file mode 100644 index 13f21dcc..00000000 --- a/projects/rtx/resources/cube/cube.blend1 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f4496f423569b8ca81f3b3a55fad00f925557e0193fb9dbe6cdce7e71fb48f7b -size 774920 diff --git a/projects/rtx/resources/cube/cube.glb b/projects/rtx/resources/cube/cube.glb deleted file mode 100644 index 66a42c65..00000000 --- a/projects/rtx/resources/cube/cube.glb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:198568b715f397d78f7c358c0f709a419e7fd677e54cdec7c19f71b5ed264897 -size 1194508 diff --git a/projects/rtx/resources/cube/cube.gltf b/projects/rtx/resources/cube/cube.gltf deleted file mode 100644 index 42817614..00000000 --- a/projects/rtx/resources/cube/cube.gltf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f82f455647a84ca6242882ae26a79a499d3ce594f8de317ab89488c5b79721ac -size 2823 diff --git a/projects/rtx/resources/house/medieval_house.gltf b/projects/rtx/resources/house/medieval_house.gltf deleted file mode 100644 index 017eb8a8..00000000 --- a/projects/rtx/resources/house/medieval_house.gltf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e17d5c9f676497e4e445dcbb6932d4fec9b4e651273e35988ac48e8925ed6d18 -size 1704450 diff --git a/projects/rtx/.gitignore b/projects/rtx_ambient_occlusion/.gitignore similarity index 100% rename from projects/rtx/.gitignore rename to projects/rtx_ambient_occlusion/.gitignore diff --git a/projects/rtx_ambient_occlusion/CMakeLists.txt b/projects/rtx_ambient_occlusion/CMakeLists.txt new file mode 100644 index 00000000..414279c3 --- /dev/null +++ b/projects/rtx_ambient_occlusion/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.16) +project(rtx_ambient_occlusion) + +# setting c++ standard for the project +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# this should fix the execution path to load local files from the project +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + +set(rtx_source ${PROJECT_SOURCE_DIR}/src/RTX) + +set(rtx_sources + ${rtx_source}/RTX.hpp + ${rtx_source}/RTX.cpp + + ${rtx_source}/ASManager.hpp + ${rtx_source}/ASManager.cpp + + ${rtx_source}/RTXExtensions.hpp + ${rtx_source}/RTXExtensions.cpp + ) + +# adding source files to the project +add_executable(rtx_ambient_occlusion src/main.cpp src/teapot.hpp ${rtx_sources}) + +# this should fix the execution path to load local files from the project (for MSVC) +if(MSVC) + set_target_properties(rtx_ambient_occlusion PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set_target_properties(rtx_ambient_occlusion PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + + # in addition to setting the output directory, the working directory has to be set + # by default visual studio sets the working directory to the build directory, when using the debugger + set_target_properties(rtx_ambient_occlusion PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +endif() + +# including headers of dependencies and the VkCV framework +target_include_directories(rtx_ambient_occlusion SYSTEM BEFORE PRIVATE ${vkcv_include} ${vkcv_includes} ${vkcv_asset_loader_include} ${vkcv_camera_include} ${vkcv_scene_include} ${vkcv_shader_compiler_include}) + +# linking with libraries from all dependencies and the VkCV framework +target_link_libraries(rtx_ambient_occlusion vkcv ${vkcv_libraries} vkcv_asset_loader ${vkcv_asset_loader_libraries} vkcv_camera vkcv_scene vkcv_shader_compiler) diff --git a/projects/rtx/resources/shaders/ambientOcclusion.rchit b/projects/rtx_ambient_occlusion/resources/shaders/ambientOcclusion.rchit similarity index 100% rename from projects/rtx/resources/shaders/ambientOcclusion.rchit rename to projects/rtx_ambient_occlusion/resources/shaders/ambientOcclusion.rchit diff --git a/projects/rtx/resources/shaders/ambientOcclusion.rgen b/projects/rtx_ambient_occlusion/resources/shaders/ambientOcclusion.rgen similarity index 100% rename from projects/rtx/resources/shaders/ambientOcclusion.rgen rename to projects/rtx_ambient_occlusion/resources/shaders/ambientOcclusion.rgen diff --git a/projects/rtx/resources/shaders/ambientOcclusion.rmiss b/projects/rtx_ambient_occlusion/resources/shaders/ambientOcclusion.rmiss similarity index 100% rename from projects/rtx/resources/shaders/ambientOcclusion.rmiss rename to projects/rtx_ambient_occlusion/resources/shaders/ambientOcclusion.rmiss diff --git a/projects/rtx/src/main.cpp b/projects/rtx_ambient_occlusion/src/main.cpp similarity index 98% rename from projects/rtx/src/main.cpp rename to projects/rtx_ambient_occlusion/src/main.cpp index 99304c07..5d6ede05 100644 --- a/projects/rtx/src/main.cpp +++ b/projects/rtx_ambient_occlusion/src/main.cpp @@ -6,12 +6,12 @@ #include <vkcv/asset/asset_loader.hpp> #include <vkcv/shader/GLSLCompiler.hpp> #include <vkcv/scene/Scene.hpp> -#include <vkcv/rtx/RTX.hpp> -#include <vkcv/rtx/RTXExtensions.hpp> +#include "RTX/RTX.hpp" +#include "RTX/RTXExtensions.hpp" #include "teapot.hpp" int main(int argc, const char** argv) { - const char* applicationName = "RTX"; + const char* applicationName = "RTX Ambient Occlusion"; uint32_t windowWidth = 800; uint32_t windowHeight = 600; diff --git a/projects/rtx/src/teapot.hpp b/projects/rtx_ambient_occlusion/src/teapot.hpp similarity index 100% rename from projects/rtx/src/teapot.hpp rename to projects/rtx_ambient_occlusion/src/teapot.hpp -- GitLab