Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
306d8ac
added gprt submodule
Waqar-ukaea Mar 31, 2025
5937aec
Add gprt_test tool and remove GPRT stubs from constants.h
Waqar-ukaea Mar 31, 2025
c4069fc
Working GPRT raygen sample built as an XDG tool
Waqar-ukaea Mar 31, 2025
de9e446
gprt-test now creates an XDG instance from a file passed into the pro…
Waqar-ukaea Mar 31, 2025
14b5c7c
Add GPRT apt packages and Vulkan SDK install to CI
pshriwise Apr 1, 2025
e196f8e
Add GPRT dependencies to OpenMC test workflow as well
pshriwise Apr 1, 2025
0d25170
Swapped out the GPRT sample to a slightly more complex one
Waqar-ukaea Apr 7, 2025
b6d10bb
Reverting changes to the OpenMC test GHA workflow
pshriwise Apr 7, 2025
b539f06
Restructured tools to build gprt tools independently
Waqar-ukaea Apr 7, 2025
6b3b52c
Started on adding GPRT concrete interface
Waqar-ukaea Apr 9, 2025
b2de2c4
Copiedh5m-reader structs with new GPRT API types
Waqar-ukaea Apr 10, 2025
13f716f
Moved GPRTRaytracer method declarations into XDG namespace
Waqar-ukaea Apr 11, 2025
ae2d408
Link gprt at build time to avoid CMake error
Waqar-ukaea Apr 11, 2025
9a8787f
Added some stub methods for the GPRTRayTracer so XDG builds
Waqar-ukaea Apr 11, 2025
95c364d
Attempting to GPRT render triangle mesh from XDG
Waqar-ukaea Apr 17, 2025
75b5969
Updated SharedCode.h to use h5m-reader version
Waqar-ukaea Apr 17, 2025
92a48b6
Make camera zoom static but far out
Waqar-ukaea Apr 17, 2025
52c14a0
Better connectivities but coords still off
Waqar-ukaea Apr 29, 2025
c3da04e
Working single precision ray tracing against MOAB mesh
Waqar-ukaea Apr 30, 2025
a2e82f5
Added a method to return the world bounding box
Waqar-ukaea Apr 30, 2025
4c7db76
Messing about with the camera settings
Waqar-ukaea Apr 30, 2025
d4e37fe
Started on implementation of GPRT::ray_fire()
Waqar-ukaea May 6, 2025
53b7f48
Added methods for setting up GPRT structures
Waqar-ukaea May 12, 2025
5905a01
Updated XDG::create() to make instantiation with GPRT possible
Waqar-ukaea May 12, 2025
2b6fcdc
Create a BLAS for each surface and TLAS for each volume
Waqar-ukaea May 12, 2025
200e2f2
Somewhat working GPRTRayTracer
Waqar-ukaea May 14, 2025
4caae5b
Setting up XDG for use with GPRT
Waqar-ukaea May 14, 2025
022dd62
Added missing sharedCode.h needed for deviceCode
Waqar-ukaea May 14, 2025
1b93d7d
Added a ray_fire test for GPRT
Waqar-ukaea May 15, 2025
54b8c96
Removed shader code for 2dRayGen copied over from gprt-test
Waqar-ukaea May 15, 2025
33bdc4b
Remove destructors causing double free issues
Waqar-ukaea May 15, 2025
ac76e3b
Added create_world_tlas() to ray_tracing_interface base
Waqar-ukaea May 16, 2025
e36add9
Working ray_fire() - missing ability to choose intersection orientations
Waqar-ukaea May 20, 2025
c7ec9b4
Correctly store sense/orientation in push_constants
Waqar-ukaea May 21, 2025
7702428
Nearly have exclude_primitives working
Waqar-ukaea May 21, 2025
5620cce
Working point_in_vol() except on volume boundary
Waqar-ukaea May 23, 2025
1178030
Add the ability to set multiple closesthit shaders to the same geometry
Waqar-ukaea May 23, 2025
7bf5f2a
Make GPRTRayTracer::render_mesh() a standalone method + camera fixes
Waqar-ukaea Jun 3, 2025
cc7a0fc
Added the ability to specify RT library in ray_fire tool
Waqar-ukaea Jun 13, 2025
4777171
TraceRay in render shaders now uses correct miss shader
Waqar-ukaea Jun 13, 2025
938e10e
Refactored register_volume to create a single BLAS per surface
Waqar-ukaea Jun 16, 2025
ff75211
Updated ray_fire and point_in_volume tools to be able to run with GPRT
Waqar-ukaea Jun 19, 2025
5a6558a
Added double precision structs to shared code
Waqar-ukaea Jun 25, 2025
d037e01
Updated CMakeLists.txt to build/install dbl shaders as well as flt
Waqar-ukaea Jul 7, 2025
fecc9f7
Added array<double> aliases for double3/double4 internally to xdg
Waqar-ukaea Jul 10, 2025
2dba1b5
Added a compute shader to get AABB bounds
Waqar-ukaea Jul 11, 2025
834fc18
Extending GPRT vectors to support dbl precision internally to XDG
Waqar-ukaea Jul 14, 2025
c3ca998
Updated sharedCode.h to remove double precision definitions
Waqar-ukaea Jul 14, 2025
906c8ff
Compiling but rays are always missing AABBs
Waqar-ukaea Jul 14, 2025
d08575c
Custom intersection shader is being called but returning early
Waqar-ukaea Jul 15, 2025
2dde2a7
Store double hitDistance on mesh record
Waqar-ukaea Jul 21, 2025
e541626
Agreement between Embree and GPRT ray-fire hitdistances
Waqar-ukaea Jul 22, 2025
88f7010
Working double precision point_in_vol
Waqar-ukaea Jul 22, 2025
d7b2cd5
Removed old cmake target
Waqar-ukaea Jul 31, 2025
b45a65a
Fixed transfer of tMin and tMax into intersection shader
Waqar-ukaea Aug 1, 2025
5fc3bdd
exclude_primitives looks like its working and now ray_fire tests are …
Waqar-ukaea Aug 5, 2025
534f3ce
Fixed plucker coord calculation for GPRT
Waqar-ukaea Aug 12, 2025
0ac6a7f
Implemented per primitive sense tagging which has fixed ray-fire and …
Waqar-ukaea Aug 15, 2025
a19e816
GPRTRayTracer working with particle sim! Ready for review/merge into …
Waqar-ukaea Aug 21, 2025
eb4954d
Fixed all the issues which arose after rebasing
Waqar-ukaea Aug 27, 2025
f4294c6
Removed some redundant files and added a slang compilation guard to s…
Waqar-ukaea Aug 27, 2025
35fe1e6
Removed structs required for single precision ray tracing
Waqar-ukaea Aug 28, 2025
cfda39a
Removed last remnants of single precision logic in GPRTRayTracer
Waqar-ukaea Aug 28, 2025
3e84c2a
Added a function to query which RT library is in use
Waqar-ukaea Aug 29, 2025
44e543e
Consistent usage of signed ints for MeshIDs between host and device code
Waqar-ukaea Sep 1, 2025
24192af
Resolved a bunch of minor review comments
Waqar-ukaea Sep 5, 2025
6dffa8b
Added a guard to ensure at least one RT library is enabled
Waqar-ukaea Sep 19, 2025
5ee1cf6
Implemented create_global_surface_tree() and minor cleanups from code…
Waqar-ukaea Sep 19, 2025
0fdd394
Removed redundant constants from sharedCode.h header
Waqar-ukaea Sep 19, 2025
7b15ce4
Removed unecessary nesting in orientation checks for plucker coords
Waqar-ukaea Sep 19, 2025
2ff3ced
Removed unnecessary implementations of double3 cross product operator…
Waqar-ukaea Sep 19, 2025
7af77f0
Update for GPRTRayTracer to better mirror EmbreeRayTracer in global_s…
Waqar-ukaea Sep 19, 2025
a940a55
Fixed library handling for tools given GPRT doesn't work with GPRT yet
Waqar-ukaea Sep 19, 2025
535db32
Removed redundant init() calls from tests
Waqar-ukaea Sep 19, 2025
a969b31
Removed calls to create_element_tree() since its not implemented for …
Waqar-ukaea Sep 19, 2025
c2842bb
Removed GPRT-renderer to be added in a separate PR
Waqar-ukaea Sep 23, 2025
7d70bf5
More robust compile guards for when GPRT is not enabled
Waqar-ukaea Sep 22, 2025
79b2eb5
Refactored ray-fire and point-in-volume tests
Waqar-ukaea Sep 22, 2025
01a6c25
Refactored test_moab tests to avoid code duplication
Waqar-ukaea Sep 22, 2025
7aaa601
Kept more descriptive test comments
Waqar-ukaea Sep 22, 2025
c458d4c
Fixed linker errors happeneing when GPRT enabled
Waqar-ukaea Sep 22, 2025
bb00d6d
Added missing gprt headers to test_moab
Waqar-ukaea Sep 22, 2025
8d74828
Adding options to simplify test generation
pshriwise Sep 23, 2025
ec8174b
Removed redundant preprocessor guards
Waqar-ukaea Sep 24, 2025
089ace1
Create header stubs to consolidate perprocessor statements
pshriwise Sep 24, 2025
900b892
Fixed variable spacing
Waqar-ukaea Sep 24, 2025
c0bc1f8
Moved create_raytracer helper to util.h
Waqar-ukaea Sep 25, 2025
2b3a0a9
Refactored ray tracing interface tests to make use of Catch2 GENERATORS
Waqar-ukaea Sep 25, 2025
721cbf4
Reverting back to GENERATE approach for test cases
Waqar-ukaea Sep 25, 2025
31f49ac
Adding fmt formatters for mesh and ray tracing libraries
pshriwise Sep 26, 2025
3462c17
Switched to latest GPRT commit for subproject
Waqar-ukaea Sep 26, 2025
acc09a5
Remove GPRT linkage in tools since renderer has been removed from thi…
Waqar-ukaea Sep 26, 2025
e2f78be
Updated shaders and BVH setup to comply with latest GPRT API
Waqar-ukaea Sep 26, 2025
43d25e7
Removed internal double vector types which are now included with late…
Waqar-ukaea Sep 29, 2025
639c888
Aligning code across multiple lines for argparse
Waqar-ukaea Sep 29, 2025
c357299
Added new GPRT synchronise functions to ensure shader fully complete …
Waqar-ukaea Sep 29, 2025
29e3c2c
Added extra GPRT cleanup calls to GPRTRayTracer destructor
Waqar-ukaea Sep 29, 2025
10527f2
Use consistent generator pattern within all multi-backend tests
Waqar-ukaea Sep 30, 2025
5a7a0bb
Fixed indentation in GPRTRayTracer definition
Waqar-ukaea Sep 30, 2025
586d888
Ensure double3 vectors use [] operators instead of .x .y .z member ac…
Waqar-ukaea Sep 30, 2025
20fdf90
Fixed ray tracing queries so that Shader Binding Table is only built …
Waqar-ukaea Sep 30, 2025
6bca3b3
Refactor shared structs and enums into separate headers, since enums …
Waqar-ukaea Sep 30, 2025
69a554f
Final round of code review changes
Waqar-ukaea Oct 2, 2025
00f2716
Update include location in constants.h
pshriwise Oct 6, 2025
062201c
Attempting to fix CI
Waqar-ukaea Oct 8, 2025
cfbf66b
Adding xdg namespacing to shared_enums
Waqar-ukaea Oct 8, 2025
d37aaf1
Set XDG_ENABLE_LIBMESH=ON for CI
Waqar-ukaea Oct 8, 2025
b52f867
Switch to build GPRT as a shared library
Waqar-ukaea Oct 8, 2025
c163b2d
Added a function to probe if there is a vulkan device available on th…
Waqar-ukaea Oct 10, 2025
b02c138
Update GPRT submodule to latest commit
Waqar-ukaea Oct 10, 2025
c1399d5
Re-enable CI tests now that vk probe is in place
Waqar-ukaea Oct 10, 2025
d5b6733
Moved check_ray_tracer_supported into DYNAMIC_SECTION for clearer rep…
Waqar-ukaea Oct 10, 2025
71310cf
Fixed system_has_vk_device() check to actually return true if we have…
Waqar-ukaea Oct 10, 2025
97cf5b1
Added --allow-running-no-tests to ensure SKIPPED tests not marked as …
Waqar-ukaea Oct 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive

- name: Apt dependencies
shell: bash
Expand All @@ -27,7 +27,31 @@ jobs:
libnetcdf-dev \
libhdf5-dev \
libeigen3-dev \
cmake
cmake
- name: Update CMake
uses: ssrobins/install-cmake@v1
with:
version: 3.24.3
cache: true

- name: GPRT Apt Dependencies
shell: bash
run: |
sudo apt install -y \
libpthread-stubs0-dev \
libx11-xcb-dev \
xorg-dev \
libxinerama-dev \
libglu1-mesa-dev \
freeglut3-dev \
mesa-common-dev \
libglfw3

- name: Prepare Vulkan SDK
uses: humbletim/install-vulkan-sdk@v1.2
with:
version: 1.4.309.0
cache: true

- name: MOAB Clone
shell: bash
Expand Down Expand Up @@ -97,9 +121,10 @@ jobs:
- name: Build
shell: bash
run: |
export LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that this isn't straightfoward to figure out, but these days we really shouldn't need to set this environment variable for a CMake project. For now I'll create an issue so we don't lose track of it.

@Waqar-ukaea Waqar-ukaea Oct 14, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I previously assumed this wasn't too much of an issue, more so from a place of ignorance in not really being familiar with RPATHs. But after having done some reading, I agree we should hold off on merging until I figure this one out too.

mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH="$HOME/LIBMESH;$HOME/MOAB" -DCMAKE_INSTALL_PREFIX=$HOME/opt -DXDG_ENABLE_MOAB=ON -DXDG_ENABLE_LIBMESH=ON
cmake .. -DCMAKE_PREFIX_PATH="$HOME/LIBMESH;$HOME/MOAB" -DCMAKE_INSTALL_PREFIX=$HOME/opt -DXDG_ENABLE_MOAB=ON -DXDG_ENABLE_LIBMESH=ON -DXDG_ENABLE_GPRT=ON
make -j4 install

- name: Test
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@
[submodule "vendor/linalg"]
path = vendor/linalg
url = git@github.com:sgorsten/linalg.git
[submodule "vendor/GPRT"]
path = vendor/GPRT
url = https://github.com/gprt-org/GPRT.git
65 changes: 65 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ option(XDG_ENABLE_MOAB "Enable support for the MOAB mesh library" ON
option(XDG_ENABLE_MFEM "Enable support for the MFEM mesh library" OFF)
option(XDG_ENABLE_LIBMESH "Enable support for the libMesh mesh library" OFF)
option(XDG_ENABLE_EMBREE "Enable support for the Embree ray tracing library" ON)
option(XDG_ENABLE_GPRT "Enable support for the GPRT ray tracing library" OFF)
option(XDG_BUILD_TESTS "Enable C++ unit testing" ON)
option(XDG_BUILD_TOOLS "Enable tools and miniapps" ON)

Expand Down Expand Up @@ -93,6 +94,21 @@ add_subdirectory(vendor/argparse)
set(INDICATORS_INSTALL ON CACHE STRING "Ensure indicators targets are provided")
add_subdirectory(vendor/indicators)

# Ensure at least one ray tracing backend is enabled
if (NOT XDG_ENABLE_EMBREE AND NOT XDG_ENABLE_GPRT)
message(FATAL_ERROR
"No ray tracing backend enabled. Enable at least one of:\n"
" -DXDG_ENABLE_EMBREE=ON\n"
" -DXDG_ENABLE_GPRT=ON")
endif()


# GPRT
Comment thread
Waqar-ukaea marked this conversation as resolved.
set(GPRT_BUILD_SHARED ON CACHE BOOL "Build GPRT as a shared library" FORCE)
if (XDG_ENABLE_GPRT)
add_subdirectory(vendor/GPRT)
endif()

list(APPEND xdg_sources
src/geometry/measure.cpp
src/geometry/plucker.cpp
Expand All @@ -114,6 +130,16 @@ src/embree/ray_tracer.cpp
)
endif()

if (XDG_ENABLE_GPRT)
list(APPEND xdg_sources
src/gprt/ray_tracer.cpp
)
list(APPEND xdg_device_codes
dbl_deviceCode
)

endif()

if (XDG_ENABLE_LIBMESH)
list(APPEND xdg_sources
src/libmesh/mesh_manager.cpp
Expand Down Expand Up @@ -202,6 +228,11 @@ if (XDG_ENABLE_EMBREE)
target_compile_definitions(xdg PUBLIC XDG_ENABLE_EMBREE)
endif()

if (XDG_ENABLE_GPRT)
target_compile_definitions(xdg PUBLIC XDG_ENABLE_GPRT)
target_link_options(xdg INTERFACE -Wl,--unresolved-symbols=ignore-in-shared-libs)
endif()

# ==========================
# Link ray tracing libraries
# ==========================
Expand All @@ -210,6 +241,22 @@ if (XDG_ENABLE_EMBREE)
target_link_libraries(xdg embree fmt::fmt)
endif()

if (XDG_ENABLE_GPRT)
# Compile device code for each slang file (currently only dbl_deviceCode.slang)
foreach(device_code ${xdg_device_codes})
embed_devicecode(
OUTPUT_TARGET
${device_code}
HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/include/xdg/gprt/shared_structs.h
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/gprt/${device_code}.slang
)
target_link_libraries(xdg ${device_code})
endforeach()
target_link_libraries(xdg $<BUILD_INTERFACE:gprt>)
endif()

# ===================
# Link mesh libraries
# ===================
Expand All @@ -235,6 +282,24 @@ install(TARGETS xdg
INCLUDES DESTINATION include
)

# Install GPRT Targets from shared library
if (TARGET gprt)
install(TARGETS gprt
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()

# Install targets for each slang file compiled (currently only dbl_deviceCode)
foreach(device_code ${xdg_device_codes})
install(TARGETS ${device_code}
EXPORT xdg-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endforeach()

install(EXPORT xdg-targets
FILE XDGTargets.cmake
NAMESPACE xdg::
Expand Down
27 changes: 23 additions & 4 deletions include/xdg/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#include <limits>
#include <string>

#include "fmt/format.h"

#include "xdg/shared_enums.h"

namespace xdg {

constexpr double INFTY {std::numeric_limits<double>::max()};
Expand Down Expand Up @@ -63,7 +67,7 @@ static const std::map<MeshLibrary, std::string> MESH_LIB_TO_STR =
static const std::map<RTLibrary, std::string> RT_LIB_TO_STR =
{
{RTLibrary::EMBREE, "EMBREE"},
{RTLibrary::GPRT, "GPRT"},
{RTLibrary::GPRT, "GPRT"}
};

// Mesh identifer type
Expand Down Expand Up @@ -111,9 +115,6 @@ static Property VOID_MATERIAL {PropertyType::MATERIAL, "void"};
// Enumerator for different ray fire types
enum class RayFireType { VOLUME, POINT_CONTAINMENT, ACCUMULATE_HITS, FIND_VOLUME };

//
enum class HitOrientation { ANY, EXITING, ENTERING };

// Enumerator for different element types (maybe we want more here?)
enum class SurfaceElementType {
TRI = 0,
Expand All @@ -127,4 +128,22 @@ enum class VolumeElementType {

} // namespace xdg

namespace fmt {
template <>
struct formatter<xdg::RTLibrary> : fmt::formatter<std::string> {
auto format(xdg::RTLibrary lib, fmt::format_context& ctx) {
return fmt::formatter<std::string>::format(xdg::RT_LIB_TO_STR.at(lib), ctx);
}
};

template <>
struct formatter<xdg::MeshLibrary> : fmt::formatter<std::string> {
auto format(xdg::MeshLibrary lib, fmt::format_context& ctx) {
return fmt::formatter<std::string>::format(xdg::MESH_LIB_TO_STR.at(lib), ctx);
}
};


}

#endif // include guard
4 changes: 4 additions & 0 deletions include/xdg/embree/ray_tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class EmbreeRayTracer : public RayTracer {
public:
EmbreeRayTracer();
~EmbreeRayTracer();
RTLibrary library() const override { return RTLibrary::EMBREE; }

void init() override;
RTCScene create_embree_scene();

Expand All @@ -38,6 +40,7 @@ class EmbreeRayTracer : public RayTracer {

MeshID find_element(TreeID tree, const Position& point) const override;


// Query Methods
bool point_in_volume(TreeID scene,
const Position& point,
Expand Down Expand Up @@ -88,6 +91,7 @@ class EmbreeRayTracer : public RayTracer {
MeshID surface,
RTCScene& volume_scene,
int& storage_offset);
// Global Tree IDs
RTCScene global_surface_scene_ {nullptr};
RTCScene global_element_scene_ {nullptr};

Expand Down
132 changes: 132 additions & 0 deletions include/xdg/gprt/ray_tracer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#ifndef _XDG_GPRT_BASE_RAY_TRACING_INTERFACE_H
#define _XDG_GPRT_BASE_RAY_TRACING_INTERFACE_H

#include <memory>
#include <vector>
#include <unordered_map>

#include "xdg/constants.h"
#include "xdg/mesh_manager_interface.h"
#include "xdg/primitive_ref.h"
#include "xdg/geometry_data.h"
#include "xdg/ray_tracing_interface.h"
#include "xdg/ray.h"
#include "xdg/error.h"
#include "gprt/gprt.h"
#include "shared_structs.h"

extern GPRTProgram dbl_deviceCode;
namespace xdg {

class GPRTRayTracer : public RayTracer {
public:
GPRTRayTracer();
~GPRTRayTracer();
RTLibrary library() const override { return RTLibrary::GPRT; }

void set_geom_data(const std::shared_ptr<MeshManager> mesh_manager);
void init() override;

// Setup the different shader programs for use with this ray tracer
void setup_shaders();

MeshID find_element(const Position& point) const override
{
fatal_error("Element trees not currently supported with GPRT ray tracer");
return ID_NONE;
};

MeshID find_element(TreeID tree, const Position& point) const override {
fatal_error("Element trees not currently supported with GPRT ray tracer");
return ID_NONE;
};

std::pair<TreeID, TreeID>
register_volume(const std::shared_ptr<MeshManager>& mesh_manager,
MeshID volume) override;

TreeID create_surface_tree(const std::shared_ptr<MeshManager>& mesh_manager,
MeshID volume) override;

Comment thread
Waqar-ukaea marked this conversation as resolved.
TreeID create_element_tree(const std::shared_ptr<MeshManager>& mesh_manager,
MeshID volume) override;

void create_global_surface_tree() override;

void create_global_element_tree() override
{
warning("Global element trees not currently supported with GPRT ray tracer");
return;
};

bool point_in_volume(TreeID scene,
const Position& point,
const Direction* direction = nullptr,
const std::vector<MeshID>* exclude_primitives = nullptr) const override;

std::pair<double, MeshID> ray_fire(TreeID scene,
const Position& origin,
const Direction& direction,
const double dist_limit = INFTY,
HitOrientation orientation = HitOrientation::EXITING,
std::vector<MeshID>* const exclude_primitives = nullptr) override;

void closest(TreeID scene,
const Position& origin,
double& dist,
MeshID& triangle) override {};
void closest(TreeID scene,
const Position& origin,
double& dist) override {};

bool occluded(TreeID scene,
const Position& origin,
const Direction& direction,
double& dist) const override {
fatal_error("Occlusion queries are not currently supported with GPRT ray tracer");
return false;
}

private:
// GPRT objects
GPRTContext context_;
GPRTProgram deviceCode_; // device code for float precision shaders
GPRTModule module_; // device code module for single precision shaders
GPRTAccel world_;
GPRTBuildParams buildParams_; //<! Build parameters for acceleration structures

// Shader programs
GPRTRayGenOf<dblRayGenData> rayGenProgram_;
GPRTRayGenOf<dblRayGenData> rayGenPointInVolProgram_;
GPRTMissOf<void> missProgram_;
GPRTComputeOf<DPTriangleGeomData> aabbPopulationProgram_; //<! AABB population program for double precision rays

// Buffers
GPRTBufferOf<dblRayInput> rayInputBuffer_; //<! Ray buffer for ray generation
GPRTBufferOf<dblRayOutput> rayOutputBuffer_; //<! Ray output buffer for ray generation
GPRTBufferOf<int32_t> excludePrimitivesBuffer_; //<! Buffer for excluded primitives

// Geometry Type and Instances
std::vector<gprt::Instance> globalBlasInstances_; //<! List of every BLAS instance stored in this ray tracer
GPRTGeomTypeOf<DPTriangleGeomData> trianglesGeomType_; //<! Geometry type for triangles

// Ray Generation parameters
size_t numRays = 1; //<! Number of rays to be cast
uint32_t numRayTypes_ = 1; // <! Number of ray types. Allows multiple shaders to be set to the same geometery

// Mesh-to-Scene maps
std::map<MeshID, GPRTGeomOf<DPTriangleGeomData>> surface_to_geometry_map_; //<! Map from mesh surface to embree geometry

// Internal GPRT Mappings
std::unordered_map<SurfaceTreeID, GPRTAccel> surface_volume_tree_to_accel_map; // Map from XDG::TreeID to GPRTAccel for volume TLAS
std::vector<GPRTAccel> blas_handles_; // Store BLAS handles so that they can be explicitly referenced in destructor

// Global Tree IDs
GPRTAccel global_surface_accel_ {nullptr};
GPRTAccel global_element_accel_ {nullptr};

};

} // namespace xdg

#endif // include guard
Loading
Loading