17#include <Metal/Metal.h>
24 NSMutableArray<MTLAccelerationStructureGeometryDescriptor *> *geometry_ = nil;
31 void build()
override;
35 return acceleration_structure_;
39 MEM_CXX_CLASS_ALLOC_FUNCS(
"MTLBottomLevelAS");
52 bool is_dirty_ =
true;
54 bool needs_rebuild_ =
true;
62 void build()
override;
63 void bind(
int slot)
override;
67 return acceleration_structure_;
73 if (acceleration_structure_ != nil) {
74 enc.use_resource(acceleration_structure_, MTLResourceUsageRead);
76 for (
const Instance &inst : instances_) {
79 enc.use_resource(blas, MTLResourceUsageRead);
85 MEM_CXX_CLASS_ALLOC_FUNCS(
"MTLTopLevelAS");
Read Blender memory allocation and freeing.
BottomLevelAS(const char *name)
void add_geometry(IndexBuf &index_buffer, VertBuf &vertex_buffer) override
MTLBottomLevelAS(const char *name)
id< MTLAccelerationStructure > acceleration_structure() const
InstanceID add_instance(const BottomLevelAS &blas, const float4x4 &mat, uint8_t mask) override
void bind(int slot) override
void make_resident(Encoder &enc)
id< MTLAccelerationStructure > acceleration_structure() const
MTLTopLevelAS(const char *name)
void update_instance(InstanceID instance_id, const float4x4 &mat, uint8_t mask) override
TopLevelAS(const char *name)
MatBase< float, 4, 4 > float4x4