Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
foray_geometrymetabuffer.hpp
Go to the documentation of this file.
1#pragma once
2#include "../core/foray_managedbuffer.hpp"
4#include <unordered_map>
5#include <unordered_set>
6
7namespace foray::as {
10 {
12 int32_t MaterialIndex = 0;
14 uint32_t IndexBufferOffset = 0U;
15 };
16
53 {
54 public:
56 const std::unordered_map<const Blas*, uint32_t>& CreateOrUpdate(core::Context* context, const std::unordered_set<const Blas*>& entries);
57
58 FORAY_GETTER_CR(Buffer)
59 FORAY_GETTER_MR(BufferOffsets)
60
61 inline VkDescriptorBufferInfo GetVkDescriptorInfo() const { return mBuffer.GetVkDescriptorBufferInfo(); }
62
63 protected:
66 std::unordered_map<const Blas*, uint32_t> mBufferOffsets;
69 };
70} // namespace foray::as
Device local buffer maintaining GeometryMeta structs for all primitives/geometries for multiple BLAS.
Definition foray_geometrymetabuffer.hpp:53
core::Context * mContext
Definition foray_geometrymetabuffer.hpp:64
core::ManagedBuffer mBuffer
The device local buffer holding the array.
Definition foray_geometrymetabuffer.hpp:68
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
Definition foray_geometrymetabuffer.hpp:61
std::unordered_map< const Blas *, uint32_t > mBufferOffsets
Maps BLAS to their offsets into the BlasMetaBuffers GeometryMeta array.
Definition foray_geometrymetabuffer.hpp:66
Wraps allocation and lifetime functionality of a VkBuffer.
Definition foray_managedbuffer.hpp:12
VkDescriptorBufferInfo GetVkDescriptorBufferInfo() const
Fills VkDescriptorBufferInfo object with zero offset and full buffer size.
Definition foray_managedbuffer.hpp:93
#define FORAY_GETTER_CR(member)
Return constant reference.
Definition foray_basics.hpp:60
#define FORAY_GETTER_MR(member)
Return mutable reference.
Definition foray_basics.hpp:54
Definition foray_as_declares.hpp:3
Meta information for a Geometry (gltf equivalent = Primitive). For use in raytracing shaders.
Definition foray_geometrymetabuffer.hpp:10
uint32_t IndexBufferOffset
Index into the vertex buffer (combine with gl_PrimitiveID to get the correct indices from the indexbu...
Definition foray_geometrymetabuffer.hpp:14
int32_t MaterialIndex
Index into the materialbuffer.
Definition foray_geometrymetabuffer.hpp:12
Non owning context object.
Definition foray_context.hpp:16