Blender V5.3
GPU_ray_tracing.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
12
13#include <memory>
14#include <optional>
15
16namespace blender::gpu {
17class IndexBuf;
18class VertBuf;
19class BottomLevelAS;
20
21struct InstanceID {
23};
24
29 private:
30 const char *name_;
31
32 protected:
33 TopLevelAS(const char *name) : name_(name) {}
34
35 const char *name_get() const
36 {
37 return name_;
38 }
39
40 public:
41 virtual ~TopLevelAS() = default;
42
44 const float4x4 &mat,
45 uint8_t mask = 0xFF) = 0;
47 const float4x4 &mat,
48 uint8_t mask = 0xFF) = 0;
49 virtual void build() = 0;
50 virtual void bind(int slot) = 0;
51};
52
57 private:
58 const char *name_;
59
60 protected:
61 BottomLevelAS(const char *name) : name_(name) {}
62
63 const char *name_get() const
64 {
65 return name_;
66 }
67
68 public:
69 virtual ~BottomLevelAS() = default;
70
78 virtual void add_geometry(IndexBuf &index_buffer, VertBuf &vertex_buffer) = 0;
79 virtual void build() = 0;
80};
81} // namespace blender::gpu
82
87
88namespace blender::gpu {
90 public:
92 {
94 }
95};
97 public:
99 {
101 }
102};
103
104using TopLevelASPtr = std::unique_ptr<TopLevelAS, TopLevelASDeleter>;
105using BottomLevelASPtr = std::unique_ptr<BottomLevelAS, BottomLevelASDeleter>;
106} // namespace blender::gpu
void GPU_ray_tracing_tlas_discard(blender::gpu::TopLevelAS *tlas)
blender::gpu::TopLevelAS * GPU_ray_tracing_tlas_alloc(const char *name)
blender::gpu::BottomLevelAS * GPU_ray_tracing_blas_alloc(const char *name)
void GPU_ray_tracing_blas_discard(blender::gpu::BottomLevelAS *blas)
void operator()(BottomLevelAS *tlas)
const char * name_get() const
virtual ~BottomLevelAS()=default
virtual void add_geometry(IndexBuf &index_buffer, VertBuf &vertex_buffer)=0
BottomLevelAS(const char *name)
void operator()(TopLevelAS *tlas)
virtual void build()=0
const char * name_get() const
virtual ~TopLevelAS()=default
virtual void update_instance(InstanceID instance_id, const float4x4 &mat, uint8_t mask=0xFF)=0
TopLevelAS(const char *name)
virtual InstanceID add_instance(const BottomLevelAS &blas, const float4x4 &mat, uint8_t mask=0xFF)=0
virtual void bind(int slot)=0
#define instance_id
std::unique_ptr< BottomLevelAS, BottomLevelASDeleter > BottomLevelASPtr
std::unique_ptr< TopLevelAS, TopLevelASDeleter > TopLevelASPtr
__int64 int64_t
Definition BKE_text.h:90
MatBase< float, 4, 4 > float4x4
unsigned char uint8_t
Definition BKE_text.h:79