-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
235 changed files
with
90,535 additions
and
4,598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
BasedOnStyle: Google | ||
ColumnLimit: 120 | ||
IndentWidth: 4 | ||
AlignAfterOpenBracket: Align | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterUnion: true | ||
AfterEnum: true | ||
AfterStruct: true | ||
SplitEmptyFunction: true | ||
AfterNamespace: true | ||
AfterClass: true | ||
AfterFunction: true | ||
AfterControlStatement: true | ||
AllowShortIfStatementsOnASingleLine: false | ||
IndentCaseLabels: false | ||
DerivePointerAlignment: false | ||
PointerAlignment: Left | ||
AlignTrailingComments: true | ||
AllowShortBlocksOnASingleLine: false | ||
AlignConsecutiveDeclarations: true | ||
AlignConsecutiveAssignments: true | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
AccessModifierOffset: -4 | ||
TabWidth: 4 | ||
UseTab: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,11 @@ | ||
*.vcxproj | ||
*.filters | ||
*.obj | ||
*.tlog | ||
*.pdb | ||
*.lib | ||
*.exp | ||
*.ilk | ||
*.log | ||
*.suo | ||
*.cache | ||
*.idb | ||
*.user | ||
*.dll | ||
*.exe | ||
*.opendb | ||
*.db | ||
*.sln | ||
*.d | ||
*.o | ||
*.a | ||
*.so | ||
build/ | ||
*.json | ||
*.xcworkspacedata | ||
*.plist | ||
*.xcuserstate | ||
*.xcuserstate | ||
core/.DS_Store | ||
*.json | ||
resources/ | ||
src/core/src/vlk/kernels/*.comp.* | ||
src/core/src/vlk/compiled*spv.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "third_party/gtest"] | ||
path = third_party/gtest | ||
url = https://github.com/google/googletest.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# RadeonRays | ||
|
||
https://github.com/Radeon-Pro/RadeonRays | ||
|
||
## Build | ||
|
||
### Requirements | ||
|
||
* Cmake 3.12+ | ||
* VS 2019 | ||
* Windows 10 + latest updates | ||
* MacOS 10.15 (10.14 - build ok) | ||
* Ubuntu latest LTS (18.04) | ||
|
||
### Dependencies | ||
|
||
* Ubuntu | ||
* fmt | ||
|
||
```bash | ||
$ sudo apt install libfmt-dev | ||
``` | ||
|
||
* spdlog | ||
https://github.com/gabime/spdlog | ||
|
||
```bash | ||
$ git clone https://github.com/gabime/spdlog.git | ||
$ cd spdlog && mkdir build && cd build | ||
$ cmake .. && make -j | ||
$ sudo make install | ||
``` | ||
|
||
* macOS | ||
|
||
```bash | ||
brew install fmt | ||
brew install spdlog | ||
``` | ||
|
||
* Windows | ||
|
||
1. Install with `vcpkg` and use `CMAKE_PREFIX_PATH` for build | ||
2. Install form sources | ||
|
||
```cmd | ||
git clone https://github.com/gabime/spdlog.git | ||
mkdir build | ||
cd build | ||
cmake .. | ||
cmake --build . --config Release --target INSTALL | ||
``` | ||
|
||
```cmd | ||
git clone https://github.com/fmtlib/fmt.git | ||
mkdir build | ||
cd build | ||
cmake .. | ||
cmake --build . --config Release --target INSTALL | ||
``` | ||
### Build options | ||
|
||
``` | ||
EMBEDDED_KERNELS=ON | ||
ENABLE_TESTING=ON | ||
CMAKE_BUILD_TYPE=Release | ||
``` | ||
* Windows | ||
```cmake | ||
ENABLE_DX12=ON | ||
ENABLE_VULKAN=ON | ||
``` | ||
|
||
* Lunix | ||
|
||
```cmake | ||
ENABLE_VULKAN=ON | ||
CMAKE_CXX_FLAGS="-std=gnu++17" | ||
``` | ||
|
||
* OSX | ||
|
||
```cmake | ||
CMAKE_CXX_FLAGS="-std=c++17" | ||
CMAKE_MACOSX_RPATH=ON | ||
``` | ||
|
||
## Tests | ||
|
||
> :warning: Windows required beta driver with ray-traicing support | ||
[resources](resources) dir is required for tests | ||
|
||
### GPUs | ||
|
||
* vega56/64 | ||
* navi (5700/5700XT) | ||
* nvidia 1080/2070/2080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
|
||
project(radeonrays CXX) | ||
include(cmake/StandardProjectSettings.cmake) | ||
|
||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) | ||
|
||
# Link this 'library' to set the c++ standard / compile-time options requested | ||
add_library(project_options INTERFACE) | ||
target_compile_features(project_options INTERFACE cxx_std_17) | ||
|
||
# Link this 'library' to use the warnings specified in CompilerWarnings.cmake | ||
add_library(project_warnings INTERFACE) | ||
|
||
# sanitizer options if supported by compiler | ||
include(cmake/Sanitizers.cmake) | ||
enable_sanitizers(project_options) | ||
|
||
# enable doxygen | ||
include(cmake/Doxygen.cmake) | ||
enable_doxygen() | ||
|
||
# allow for static analysis options | ||
include(cmake/StaticAnalyzers.cmake) | ||
|
||
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" ON) | ||
option(ENABLE_TESTING "Enable Test Builds" ON) | ||
option(ENABLE_DX12 "Enable DX12 backend" OFF) | ||
option(ENABLE_VULKAN "Enable Vulkan backend" OFF) | ||
option(EMBEDDED_KERNELS "Enable embedding kernels/shaders into library" OFF) | ||
|
||
# Very basic PCH example | ||
option(ENABLE_PCH "Enable Precompiled Headers" OFF) | ||
if (ENABLE_PCH) | ||
# This sets a global PCH parameter, each project will build its own PCH, which | ||
# is a good idea if any #define's change | ||
# | ||
# | ||
target_precompile_headers(project_options INTERFACE <vector> <string> <map> <utility>) | ||
endif() | ||
|
||
if(ENABLE_VULKAN) | ||
include(cmake/KernelUtils.cmake) | ||
endif(ENABLE_VULKAN) | ||
|
||
if(ENABLE_TESTING) | ||
enable_testing() | ||
set(gtest_force_shared_crt ON CACHE BOOL "Use /MD and /MDd" FORCE) | ||
add_subdirectory(third_party/gtest) | ||
|
||
set(THIRD_PARTY_TARGETS | ||
gtest | ||
gtest_main | ||
gmock | ||
gmock_main) | ||
|
||
foreach(TGT ${THIRD_PARTY_TARGETS}) | ||
set_property(TARGET ${TGT} PROPERTY FOLDER "third_party") | ||
endforeach() | ||
|
||
add_subdirectory(test) | ||
endif(ENABLE_TESTING) | ||
|
||
if(ENABLE_FUZZING) | ||
message( | ||
"Building Fuzz Tests, using fuzzing sanitizer https://www.llvm.org/docs/LibFuzzer.html" | ||
) | ||
add_subdirectory(fuzz_test) | ||
endif(ENABLE_FUZZING) | ||
|
||
add_subdirectory(src) | ||
add_subdirectory(bvh_analyzer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
find_package(OpenMP) | ||
|
||
file(GLOB HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h) | ||
file(GLOB SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) | ||
|
||
add_executable(bvh_analyzer ${HEADER_FILES} ${SOURCE_FILES}) | ||
|
||
target_link_libraries(bvh_analyzer PRIVATE project_options) | ||
if(OpenMP_CXX_FOUND) | ||
target_link_libraries(bvh_analyzer PRIVATE OpenMP::OpenMP_CXX) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/********************************************************************** | ||
Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in 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: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
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 | ||
AUTHORS 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 IN | ||
THE SOFTWARE. | ||
********************************************************************/ | ||
#pragma once | ||
#include <cfloat> | ||
#include <ostream> | ||
|
||
#include "float2.h" | ||
#include "float3.h" | ||
|
||
namespace bvh | ||
{ | ||
struct Aabb | ||
{ | ||
//<! Create AABB from a single point. | ||
Aabb() : pmin{FLT_MAX, FLT_MAX, FLT_MAX}, pmax{-FLT_MAX, -FLT_MAX, -FLT_MAX} {} | ||
//<! Create AABB from a single point. | ||
Aabb(const float3& p) : pmin(p), pmax(p) {} | ||
//<! Create AABB from min and max points. | ||
Aabb(const float3& mi, const float3& ma) : pmin(mi), pmax(ma) {} | ||
//<! Create AABB from another AABB. | ||
Aabb(const Aabb& rhs) : pmin(rhs.pmin), pmax(rhs.pmax) {} | ||
//<! Grow AABB to enclose itself and another AABB. | ||
Aabb& Grow(const Aabb& rhs) | ||
{ | ||
pmin = vmin(pmin, rhs.pmin); | ||
pmax = vmax(pmax, rhs.pmax); | ||
return *this; | ||
} | ||
//<! Grow AABB to enclose itself and another point. | ||
Aabb& Grow(const float3& p) | ||
{ | ||
pmin = vmin(pmin, p); | ||
pmax = vmax(pmax, p); | ||
return *this; | ||
} | ||
//<! Box center. | ||
float3 Center() const { return (pmax + pmin) * 0.5; } | ||
|
||
//<! Box extens along each axe. | ||
float3 Extents() const { return pmax - pmin; } | ||
//<! Calculate AABB union. | ||
static Aabb Union(const Aabb& rhs, const Aabb& lhs) | ||
{ | ||
Aabb result(vmin(lhs.pmin, rhs.pmin), vmax(lhs.pmax, rhs.pmax)); | ||
return result; | ||
} | ||
|
||
//<! Box extens along each axe. | ||
float Area() const | ||
{ | ||
float3 ext = Extents(); | ||
return 2 * (ext.x * ext.y + ext.x * ext.z + ext.y * ext.z); | ||
} | ||
|
||
//<! Calculate AABB vs ray intersection distances. | ||
float2 Intersect(const float3& invD, const float3& oxInvD, float minT, float maxT) const | ||
{ | ||
float3 f = fma(pmax, invD, oxInvD); | ||
float3 n = fma(pmin, invD, oxInvD); | ||
float3 tmax = vmax(f, n); | ||
float3 tmin = vmin(f, n); | ||
float t1 = fminf(fminf(fminf(tmax.x, tmax.y), tmax.z), maxT); | ||
float t0 = fmaxf(fmaxf(fmaxf(tmin.x, tmin.y), tmin.z), minT); | ||
return float2{t0, t1}; | ||
} | ||
|
||
bool Includes(Aabb const& rhs) const | ||
{ | ||
float3 min_diff = rhs.pmin - pmin; | ||
float3 max_diff = pmax - rhs.pmax; | ||
return !(min_diff.x < -1e-8f || min_diff.y < -1e-8f || min_diff.z < -1e-8f || max_diff.x < -1e-8f || | ||
max_diff.y < -1e-8f || max_diff.z < -1e-8f); | ||
} | ||
|
||
//<! Min point of AABB. | ||
float3 pmin; | ||
//<! Max point of AABB. | ||
float3 pmax; | ||
}; | ||
|
||
inline std::ostream& operator<<(std::ostream& oss, const Aabb& aabb) | ||
{ | ||
oss << "{ min: [" << aabb.pmin.x << ", " << aabb.pmin.y << ", " << aabb.pmin.z << "], "; | ||
oss << " max: [" << aabb.pmax.x << ", " << aabb.pmax.y << ", " << aabb.pmax.z << "] }"; | ||
return oss; | ||
} | ||
} // namespace bvh |
Oops, something went wrong.