Skip to content

Commit

Permalink
Merge branch 'main' into math-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
crud89 authored Jun 8, 2024
2 parents 37dce8c + c4957bd commit b2fe2c5
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 30 deletions.
40 changes: 40 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ LiteFX releases:
- SPIR-V Reflect: Copyright (c) 2017-2018 Google Inc. (4)
- DirectX 12 Agility SDK (5)
- Win PIX Event Runtime (6)
- DirectX Math: Copyright (c) Microsoft Corporation. (1)
- Vulkan Headers: Copyright 2015-2023 The Khronos Group Inc. (1)
- Vulkan Loader: Copyright 2015-2023 The Khronos Group Inc. (4)
- DirectX Shader Compiler (DXC): Copyright (c) 2003-2015 University of Illinois at Urbana-Champaign. (6)

The following permissions were granted to redistribute the third party
material:
Expand Down Expand Up @@ -480,3 +484,39 @@ Elle s’applique également, même si Microsoft connaissait ou devrait connaît

EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas.]

(6) LLVM Release License

Developed by:

LLVM Team

University of Illinois at Urbana-Champaign

http://llvm.org

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.

* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,14 @@ You can also build the sources on your own. Currently only MSVC builds under Win
In order for the project to be built, there are a few prerequisites that need to be present on your environment:
- [C++23 compatible compiler](https://en.cppreference.com/w/cpp/compiler_support/23): At the moment only MSVC fully supports the required features.
- [CMake](https://cmake.org/download/) (version 3.20 or higher).
- [C++23 compatible compiler](https://en.cppreference.com/w/cpp/compiler_support/23): At the moment only MSVC fully supports the required features.
- [CMake](https://cmake.org/download/) (version 3.20 or higher).
- Optional: [LunarG Vulkan SDK](https://vulkan.lunarg.com/) 1.3.204.1 or later (required to build the Vulkan backend).
- Optional: Custom [DXC](https://github.com/microsoft/DirectXShaderCompiler) build (required to build shaders for DirectX backend). ‡
- Optional: Windows 10 SDK 10.0.19041.0 or later (required to build DirectX backend).
CMake 3.20 is part of Visual Studio 2019 version 16.10 and above. When using other compilers, CMake needs to be installed manually.
Note that at least Visual Studio 17.10 or later is required.
Note that the LunarG Vulkan SDK (1.3.204.1 and above) ships with a pre-built DXC binary, that supports DXIL and SPIR-V code generation and thus should be favored over the DXC binary shipped with the Windows SDK, which only supports DXIL.
CMake 3.20 is part of Visual Studio 2022. When using other compilers, CMake needs to be installed manually.
#### Cloning the Repository
Expand Down Expand Up @@ -194,6 +193,7 @@ Depending on which rendering backends are build, the following dependencies are
- [DirectX Agility SDK](https://devblogs.microsoft.com/directx/directx12agility/): Required by the DirectX 12 backend.
- [WinPixEventRuntime](https://devblogs.microsoft.com/pix/winpixeventruntime/): Required by the DirectX 12 backend.
- [D3D12 Memory Allocator](https://gpuopen.com/d3d12-memory-allocator/): Required by the DirectX 12 backend. Handles memory allocations.
- [DirectX Shader Compiler (DXC)](https://github.com/microsoft/DirectXShaderCompiler): Optional for Vulkan backend, but required for the DirectX 12 backend.

The math module can optionally be built with converters for the following math and linear algebra libraries:

Expand Down
17 changes: 2 additions & 15 deletions src/Backends/DirectX12/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,7 @@ FIND_PACKAGE(directx-headers CONFIG REQUIRED)
FIND_PACKAGE(directx-agility-sdk CONFIG REQUIRED)
FIND_PACKAGE(d3d12-memory-allocator CONFIG REQUIRED)
FIND_PACKAGE(winpixeventruntime CONFIG REQUIRED)

# Attempt to find the proper dxcompiler.dll file from the Windows SDK and copy it to the runtime directory. This fixes an issue where the wrong (x64) dll
# is picked up from the Vulkan SDK in x86 builds.
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
FIND_FILE(DXCOMPILER_DLL "dxcompiler.dll" PATHS "$ENV{WindowsSdkVerBinPath}/x64/" NO_DEFAULT_PATH)
FIND_FILE(DXIL_DLL "dxil.dll" PATHS "$ENV{WindowsSdkVerBinPath}/x64/" NO_DEFAULT_PATH)
ELSEIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
FIND_FILE(DXCOMPILER_DLL "dxcompiler.dll" PATHS "$ENV{WindowsSdkVerBinPath}/x86/" NO_DEFAULT_PATH)
FIND_FILE(DXIL_DLL "dxil.dll" PATHS "$ENV{WindowsSdkVerBinPath}/x86/" NO_DEFAULT_PATH)
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)

IF(NOT DXCOMPILER_DLL OR NOT DXIL_DLL)
MESSAGE(WARNING "Unable to locate dxcompiler.dll or dxil.dll from Windows SDK. You may have to install the DLL manually.")
ENDIF(NOT DXCOMPILER_DLL OR NOT DXIL_DLL)
FIND_PACKAGE(directx-dxc CONFIG REQUIRED)

# Collect header & source files.
SET(DIRECTX12_BACKEND_HEADERS
Expand Down Expand Up @@ -101,7 +88,7 @@ TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME}

# Link project dependencies.
TARGET_LINK_LIBRARIES(${PROJECT_NAME}
PUBLIC LiteFX.Core LiteFX.Math LiteFX.Rendering LiteFX.AppModel Microsoft::DirectX-Headers Microsoft::DirectX-Guids dxgi dxcompiler Microsoft::DirectXAgilitySDK
PUBLIC LiteFX.Core LiteFX.Math LiteFX.Rendering LiteFX.AppModel Microsoft::DirectX-Headers Microsoft::DirectX-Guids dxgi Microsoft::DirectXAgilitySDK Microsoft::DirectXShaderCompiler Microsoft::DXIL
PRIVATE unofficial::d3d12-memory-allocator Microsoft::WinPixEventRuntime
)

Expand Down
2 changes: 1 addition & 1 deletion src/Backends/Vulkan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME}
# Link project dependencies.
TARGET_LINK_LIBRARIES(${PROJECT_NAME}
PUBLIC LiteFX.Core LiteFX.Math LiteFX.Rendering LiteFX.AppModel Vulkan::Vulkan
PRIVATE GPUOpen::VulkanMemoryAllocator unofficial::spirv-reflect::spirv-reflect
PRIVATE GPUOpen::VulkanMemoryAllocator unofficial::spirv-reflect
)

# Link against D3D12 to enable flip-model swap chains.
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/vcpkg
Submodule vcpkg updated 4440 files
2 changes: 2 additions & 0 deletions src/Samples/RayQueries/src/sample.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "sample.h"

#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/euler_angles.hpp>

Expand Down
12 changes: 6 additions & 6 deletions src/Samples/RayTracing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ IF(LITEFX_BUILD_VULKAN_BACKEND)
# NOTE: There is a DXC bug that emits SPV_KHR_ray_query extension for ray tracing shaders, even if it is not required (https://github.com/microsoft/DirectXShaderCompiler/issues/4385). This
# bug has been closed, but was not actually fixed. To prevent emitting this extension, we specify the supported extensions manually. If you are targeting only hardware that supports
# DXR tier 1.1 you can remove the compile options below. However, some GPUs are locked out in this case (e.g. GTX 10x series with compute emulation for ray-tracing features).
ADD_SHADER_MODULE(${PROJECT_NAME}.Vk.Shaders.RG SOURCE "shaders/raytracing_gen.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS SPIRV SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC COMPILE_OPTIONS "-fspv-extension=SPV_KHR_ray_tracing -fspv-extension=SPV_EXT_descriptor_indexing" INCLUDES "shaders/raytracing_common.hlsli")
ADD_SHADER_MODULE(${PROJECT_NAME}.Vk.Shaders.RH SOURCE "shaders/raytracing_hit.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS SPIRV SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC COMPILE_OPTIONS "-fspv-extension=SPV_KHR_ray_tracing -fspv-extension=SPV_EXT_descriptor_indexing" INCLUDES "shaders/raytracing_common.hlsli")
ADD_SHADER_MODULE(${PROJECT_NAME}.Vk.Shaders.RM SOURCE "shaders/raytracing_miss.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS SPIRV SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC COMPILE_OPTIONS "-fspv-extension=SPV_KHR_ray_tracing -fspv-extension=SPV_EXT_descriptor_indexing" INCLUDES "shaders/raytracing_common.hlsli")
ADD_SHADER_MODULE(${PROJECT_NAME}.Vk.Shaders.RG SOURCE "shaders/raytracing_gen.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS SPIRV SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC COMPILE_OPTIONS "-fspv-extension=SPV_KHR_ray_tracing -fspv-extension=SPV_EXT_descriptor_indexing -disable-payload-qualifiers" INCLUDES "shaders/raytracing_common.hlsli")
ADD_SHADER_MODULE(${PROJECT_NAME}.Vk.Shaders.RH SOURCE "shaders/raytracing_hit.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS SPIRV SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC COMPILE_OPTIONS "-fspv-extension=SPV_KHR_ray_tracing -fspv-extension=SPV_EXT_descriptor_indexing -disable-payload-qualifiers" INCLUDES "shaders/raytracing_common.hlsli")
ADD_SHADER_MODULE(${PROJECT_NAME}.Vk.Shaders.RM SOURCE "shaders/raytracing_miss.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS SPIRV SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC COMPILE_OPTIONS "-fspv-extension=SPV_KHR_ray_tracing -fspv-extension=SPV_EXT_descriptor_indexing -disable-payload-qualifiers" INCLUDES "shaders/raytracing_common.hlsli")
SET_TARGET_PROPERTIES(${PROJECT_NAME}.Vk.Shaders.RG PROPERTIES FOLDER "Samples/Shaders/Vulkan")
SET_TARGET_PROPERTIES(${PROJECT_NAME}.Vk.Shaders.RH PROPERTIES FOLDER "Samples/Shaders/Vulkan")
SET_TARGET_PROPERTIES(${PROJECT_NAME}.Vk.Shaders.RM PROPERTIES FOLDER "Samples/Shaders/Vulkan")
Expand All @@ -82,9 +82,9 @@ ENDIF(LITEFX_BUILD_VULKAN_BACKEND)
IF(LITEFX_BUILD_DIRECTX_12_BACKEND)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE LiteFX.Backends.DirectX12)

ADD_SHADER_MODULE(${PROJECT_NAME}.Dx.Shaders.RG SOURCE "shaders/raytracing_gen.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS DXIL SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC INCLUDES "shaders/raytracing_common.hlsli")
ADD_SHADER_MODULE(${PROJECT_NAME}.Dx.Shaders.RH SOURCE "shaders/raytracing_hit.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS DXIL SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC INCLUDES "shaders/raytracing_common.hlsli")
ADD_SHADER_MODULE(${PROJECT_NAME}.Dx.Shaders.RM SOURCE "shaders/raytracing_miss.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS DXIL SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC INCLUDES "shaders/raytracing_common.hlsli")
ADD_SHADER_MODULE(${PROJECT_NAME}.Dx.Shaders.RG SOURCE "shaders/raytracing_gen.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS DXIL SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC INCLUDES "shaders/raytracing_common.hlsli" COMPILE_OPTIONS "-disable-payload-qualifiers")
ADD_SHADER_MODULE(${PROJECT_NAME}.Dx.Shaders.RH SOURCE "shaders/raytracing_hit.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS DXIL SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC INCLUDES "shaders/raytracing_common.hlsli" COMPILE_OPTIONS "-disable-payload-qualifiers")
ADD_SHADER_MODULE(${PROJECT_NAME}.Dx.Shaders.RM SOURCE "shaders/raytracing_miss.hlsl" LANGUAGE HLSL TYPE RAYTRACING COMPILE_AS DXIL SHADER_MODEL ${LITEFX_BUILD_HLSL_SHADER_MODEL} COMPILER DXC INCLUDES "shaders/raytracing_common.hlsli" COMPILE_OPTIONS "-disable-payload-qualifiers")
SET_TARGET_PROPERTIES(${PROJECT_NAME}.Dx.Shaders.RG PROPERTIES FOLDER "Samples/Shaders/DirectX 12")
SET_TARGET_PROPERTIES(${PROJECT_NAME}.Dx.Shaders.RH PROPERTIES FOLDER "Samples/Shaders/DirectX 12")
SET_TARGET_PROPERTIES(${PROJECT_NAME}.Dx.Shaders.RM PROPERTIES FOLDER "Samples/Shaders/DirectX 12")
Expand Down
2 changes: 2 additions & 0 deletions src/Samples/RayTracing/src/sample.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "sample.h"

#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/euler_angles.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/cmake/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ OPTION(LITEFX_BUILD_WITH_GLM "Enables glm converters for math types." ON)
OPTION(LITEFX_BUILD_WITH_DIRECTX_MATH "Enables DirectXMath converters for math types." ON)

FIND_PROGRAM(LITEFX_BUILD_GLSLC_COMPILER glslc HINTS ENV VULKAN_SDK PATH_SUFFIXES bin DOC "The full path to the `glslc.exe` shader compiler binary.")
FIND_PROGRAM(LITEFX_BUILD_DXC_COMPILER dxc HINTS ENV VULKAN_SDK PATH_SUFFIXES bin DOC "The full path to the `dxc.exe` shader compiler binary.")
FIND_PROGRAM(LITEFX_BUILD_DXC_COMPILER dxc HINTS ${DIRECTX_DXC_TOOL} ENV VULKAN_SDK PATH_SUFFIXES bin DOC "The full path to the `dxc.exe` shader compiler binary.")

SET(LITEFX_BUILD_HLSL_SHADER_MODEL "6_5" CACHE STRING "Shader model version used to compile HLSL shaders.")

Expand Down
3 changes: 2 additions & 1 deletion src/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"vulkan-memory-allocator",
"d3d12-memory-allocator",
"winpixeventruntime",
"directx-agility-sdk"
"directx-agility-sdk",
"directx-dxc"
]
}

0 comments on commit b2fe2c5

Please sign in to comment.