Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
foray::as::Blas Class Reference

A Blas (Bottom Level Acceleration Structure) is the raytracing equivalent concept of a mesh. More...

#include <foray_blas.hpp>

Inheritance diagram for foray::as::Blas:
foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR > foray::core::ManagedResource foray::NoMoveDefaults

Public Member Functions

virtual ~Blas ()
 
virtual std::string_view GetTypeName () const override
 Returns <OBJECT_TYPE> stringified.
 
virtual void CreateOrUpdate (core::Context *context, const scene::Mesh *mesh, const scene::gcomp::GeometryStore *store, bench::HostBenchmark *benchmark=nullptr)
 Recreates the acceleration structure.
 
virtual bool Exists () const override
 Return true, if the managed resource is allocated.
 
virtual void Destroy () override
 Destroy the resource.
 
- Public Member Functions inherited from foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR >
 VulkanResource ()
 
 VulkanResource (std::string_view name)
 
- Public Member Functions inherited from foray::core::ManagedResource
 ManagedResource ()
 Default constructor registers the resource.
 
 ManagedResource (std::string_view name)
 Registers the resource and sets its name.
 
virtual ~ManagedResource ()
 Unregisters the resource.
 
std::string_view GetName () const
 Return a custom name for the object.
 
virtual void SetName (std::string_view name)
 Set a custom name for the object.
 
std::string Print () const
 Print name and type in one string.
 
- Public Member Functions inherited from foray::NoMoveDefaults
 NoMoveDefaults ()=default
 
 NoMoveDefaults (const NoMoveDefaults &other)=delete
 
 NoMoveDefaults (NoMoveDefaults &&other)=default
 
NoMoveDefaultsoperator= (const NoMoveDefaults &other)=delete
 

Static Public Attributes

static const char * BENCH_RESET = "Reset"
 
static const char * BENCH_CREATESTRUCTS = "Create Build Structs"
 
static const char * BENCH_GETSIZES = "Get Build Sizes"
 
static const char * BENCH_CREATE = "Create"
 
static const char * BENCH_BUILD = "Build"
 

Protected Attributes

core::ContextmContext = nullptr
 
const scene::MeshmMesh = nullptr
 
core::ManagedBuffer mBlasMemory
 
VkAccelerationStructureKHR mAccelerationStructure {}
 
VkDeviceAddress mBlasAddress {}
 
- Protected Attributes inherited from foray::core::ManagedResource
std::string mName
 This objects custom name.
 

Additional Inherited Members

- Static Public Member Functions inherited from foray::core::ManagedResource
static void sPrintAllocatedResources (bool printAsWarning)
 Print a list of all registered existing resources.
 
static const std::unordered_set< ManagedResource * > * GetTotalAllocatedResources ()
 
- Protected Member Functions inherited from foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR >
virtual void SetObjectName (core::Context *context, const void *handle, std::string_view name, bool updateResourceName=true)
 Set the object name. Sets both ManagedResource::mName aswell as vulkan debug object name.
 

Detailed Description

A Blas (Bottom Level Acceleration Structure) is the raytracing equivalent concept of a mesh.

This class takes the geometry referenced by a mesh from a geometrystore, and builds a bottom level acceleration structure from it. It manages (owns) both the BLAs buffer aswell as the handle and exposes the Blas' device address.

Constructor & Destructor Documentation

◆ ~Blas()

virtual foray::as::Blas::~Blas ( )
inlinevirtual

Member Function Documentation

◆ CreateOrUpdate()

virtual void foray::as::Blas::CreateOrUpdate ( core::Context context,
const scene::Mesh mesh,
const scene::gcomp::GeometryStore store,
bench::HostBenchmark benchmark = nullptr 
)
virtual

Recreates the acceleration structure.

For each primitive in mesh, creates a geometry structure and corresponding build range. See static BENCH_... members for benchmark timestamps

Parameters
contextRequires DispatchTable, PhysicalDevice, LogicalDevice
meshRequired mesh object referencing the geometry
storeRequired GeometryStore owning the Vertex+Index buffers
benchmarkOptional benchmark for timing the build process

◆ Destroy()

virtual void foray::as::Blas::Destroy ( )
overridevirtual

Destroy the resource.

Remarks
This method must be callable even if the resource has not been initialized yet. This method must call any Destroy() overloads of child objects and of base classes

Implements foray::core::ManagedResource.

◆ Exists()

virtual bool foray::as::Blas::Exists ( ) const
inlineoverridevirtual

Return true, if the managed resource is allocated.

Example: Vulkan object stored could be nullptr or instantiated

Implements foray::core::ManagedResource.

◆ GetTypeName()

virtual std::string_view foray::as::Blas::GetTypeName ( ) const
inlineoverridevirtual

Member Data Documentation

◆ BENCH_BUILD

const char* foray::as::Blas::BENCH_BUILD = "Build"
inlinestatic

◆ BENCH_CREATE

const char* foray::as::Blas::BENCH_CREATE = "Create"
inlinestatic

◆ BENCH_CREATESTRUCTS

const char* foray::as::Blas::BENCH_CREATESTRUCTS = "Create Build Structs"
inlinestatic

◆ BENCH_GETSIZES

const char* foray::as::Blas::BENCH_GETSIZES = "Get Build Sizes"
inlinestatic

◆ BENCH_RESET

const char* foray::as::Blas::BENCH_RESET = "Reset"
inlinestatic

◆ mAccelerationStructure

VkAccelerationStructureKHR foray::as::Blas::mAccelerationStructure {}
protected

◆ mBlasAddress

VkDeviceAddress foray::as::Blas::mBlasAddress {}
protected

◆ mBlasMemory

core::ManagedBuffer foray::as::Blas::mBlasMemory
protected

◆ mContext

core::Context* foray::as::Blas::mContext = nullptr
protected

◆ mMesh

const scene::Mesh* foray::as::Blas::mMesh = nullptr
protected

The documentation for this class was generated from the following file: