Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
|
Device local buffer maintaining GeometryMeta structs for all primitives/geometries for multiple BLAS. More...
#include <foray_geometrymetabuffer.hpp>
Public Member Functions | |
const std::unordered_map< const Blas *, uint32_t > & | CreateOrUpdate (core::Context *context, const std::unordered_set< const Blas * > &entries) |
(re)creates the meta buffer | |
VkDescriptorBufferInfo | GetVkDescriptorInfo () const |
Protected Attributes | |
core::Context * | mContext = nullptr |
std::unordered_map< const Blas *, uint32_t > | mBufferOffsets |
Maps BLAS to their offsets into the BlasMetaBuffers GeometryMeta array. | |
core::ManagedBuffer | mBuffer |
The device local buffer holding the array. | |
Device local buffer maintaining GeometryMeta structs for all primitives/geometries for multiple BLAS.
DATA LAYOUT / USAGE
initialize with a set of BLAS. BLAS are assigned sections in the buffer consecutively:
The amount of space assigned per BLAS is GeometryCount * sizeof(GeometryMeta)
The buffer maintains the offsets into this buffer for each BLAS
These offsets are the return value of GeometryMetaBuffer::CreateOrUpdate and can be later retrieved via GeometryMetaBuffer::GetBufferOffsets()
Intended use for these offsets is to set them as VkAccelerationStructureInstanceKHR::instanceCustomIndex in BLAS instances installed into a TLAS. In rt shaders the correct meta struct can be accessed by geoMetaindex = gl_InstanceCustomIndexEXT + gl_GeometryIndexEXT;
gl_InstanceCustomIndexEXT: The custom index returned by the GeometryMetaBuffer and set as part of the BLAS instance struct in the TLAS gl_GeometryIndexEXT: The index of the geometry within the current BLAS
const std::unordered_map< const Blas *, uint32_t > & foray::as::GeometryMetaBuffer::CreateOrUpdate | ( | core::Context * | context, |
const std::unordered_set< const Blas * > & | entries | ||
) |
(re)creates the meta buffer
|
inline |
|
protected |
The device local buffer holding the array.
|
protected |
Maps BLAS to their offsets into the BlasMetaBuffers GeometryMeta array.
|
protected |