Nebula
Loading...
Searching...
No Matches
accelerationstructure.h
Go to the documentation of this file.
1
2#pragma once
3//------------------------------------------------------------------------------
21//------------------------------------------------------------------------------
22#include "mesh.h"
23namespace CoreGraphics
24{
25
27{
28 FastBuild = 0x1, // Create and recreate structure swiftly but suffer worse trace performance
29 FastTrace = 0x2, // Vice versa of FastBuild, and is exclusive of it
30 Dynamic = 0x4, // Allow updates
31 Compact = 0x8, // Hint to make the structure compact, which can make copys faster
32 Small = 0x10, // Hint to minimize memory spent
33};
36
47
50
54void DestroyBlas(const BlasId blac);
55
65
69{
72 uint instanceIndex; // Readable in the shader as gl_InstanceCustomIndexKHR
73 uchar mask; // 8 bit visibility mask
74 uint shaderOffset; // Offset into the shader binding table
76};
77
87void BlasInstanceSetMask(const BlasInstanceId id, uint mask);
90
97
99
101TlasId CreateTlas(const TlasCreateInfo& info);
103void DestroyTlas(const TlasId tlas);
104
106void TlasInitBuild(const TlasId tlas);
108void TlasInitUpdate(const TlasId tlas);
109
110} // namespace CoreGraphics
Code
index types enum
Definition indextype.h:22
Format
component format
Definition vertexcomponent.h:25
Simple transform using position, quaternion, and scale.
Definition transform.h:18
Nebula's dynamic array class.
Definition array.h:60
#define _DECL_ACQUIRE_RELEASE(ty)
Definition idallocator.h:88
#define ID_24_8_TYPE(x)
Definition id.h:132
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
const SizeT BlasInstanceGetSize()
Get instance size (platform dependent)
Definition vkaccelerationstructure.cc:375
BlasInstanceId CreateBlasInstance(const BlasInstanceCreateInfo &info)
Create an instance to a bottom level acceleration structure.
Definition vkaccelerationstructure.cc:283
TlasId CreateTlas(const TlasCreateInfo &info)
Create top level acceleration structure.
Definition vkaccelerationstructure.cc:384
AccelerationStructureBuildFlags
Definition accelerationstructure.h:27
void DestroyBlasInstance(const BlasInstanceId id)
Destroy blas instance.
Definition vkaccelerationstructure.cc:329
void BlasInstanceUpdate(const BlasInstanceId id, const Math::mat4 &transform, CoreGraphics::BufferId buf, uint offset)
Update blas instance and write to buffer.
Definition vkaccelerationstructure.cc:340
BlasInstanceFlags
Definition accelerationstructure.h:57
@ ForceOpaque
Definition accelerationstructure.h:61
@ NoOpaque
Definition accelerationstructure.h:62
@ InvertFace
Definition accelerationstructure.h:60
@ NoFlags
Definition accelerationstructure.h:58
@ FaceCullingDisabled
Definition accelerationstructure.h:59
void TlasInitUpdate(const TlasId tlas)
Initiate Tlas for update.
Definition vkaccelerationstructure.cc:556
BlasId CreateBlas(const BlasCreateInfo &info)
Create bottom level acceleration structure.
Definition vkaccelerationstructure.cc:124
void DestroyBlas(const BlasId blac)
Destroy bottom level acceleration structure.
Definition vkaccelerationstructure.cc:271
void DestroyTlas(const TlasId tlas)
Destroy top level acceleration structure.
Definition vkaccelerationstructure.cc:532
void BlasInstanceSetMask(const BlasInstanceId id, uint mask)
Set blas instance mask, setting it to 0x0 will disable it.
Definition vkaccelerationstructure.cc:365
void TlasInitBuild(const TlasId tlas)
Initiate Tlas for build.
Definition vkaccelerationstructure.cc:545
#define __ImplementEnumComparisonOperators(type)
#define __ImplementEnumBitOperators(type)
Definition accelerationstructure.h:38
IndexT indexOffset
Definition accelerationstructure.h:43
CoreGraphics::BufferId ibo
Definition accelerationstructure.h:39
CoreGraphics::IndexType::Code indexType
Definition accelerationstructure.h:40
CoreGraphics::VertexComponent::Format positionsFormat
Definition accelerationstructure.h:41
Util::Array< CoreGraphics::PrimitiveGroup > primitiveGroups
Definition accelerationstructure.h:44
AccelerationStructureBuildFlags flags
Definition accelerationstructure.h:45
IndexT stride
Definition accelerationstructure.h:42
CoreGraphics::BufferId vbo
Definition accelerationstructure.h:39
IndexT vertexOffset
Definition accelerationstructure.h:43
Definition accelerationstructure.h:48
Definition accelerationstructure.h:69
uchar mask
Definition accelerationstructure.h:73
uint shaderOffset
Definition accelerationstructure.h:74
uint instanceIndex
Definition accelerationstructure.h:72
BlasInstanceFlags flags
Definition accelerationstructure.h:75
Math::mat4 transform
Definition accelerationstructure.h:71
CoreGraphics::BlasId blas
Definition accelerationstructure.h:70
Definition accelerationstructure.h:66
Definition buffer.h:23
Definition accelerationstructure.h:92
CoreGraphics::BufferId instanceBuffer
Definition accelerationstructure.h:94
SizeT numInstances
Definition accelerationstructure.h:93
AccelerationStructureBuildFlags flags
Definition accelerationstructure.h:95
Definition accelerationstructure.h:98
A 4x4 single point precision float matrix.
Definition mat4.h:49
unsigned char uchar
Definition types.h:33
int SizeT
Definition types.h:49
unsigned int uint
Definition types.h:31
int IndexT
Definition types.h:48