Diligent Engine  v.2.4.g
TopLevelAS.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2021 Diligent Graphics LLC
3  * Copyright 2015-2019 Egor Yusov
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * In no event and under no legal theory, whether in tort (including negligence),
18  * contract, or otherwise, unless required by applicable law (such as deliberate
19  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
20  * liable for any damages, including any direct, indirect, special, incidental,
21  * or consequential damages of any character arising as a result of this License or
22  * out of the use or inability to use the software (including but not limited to damages
23  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
24  * all other commercial damages or losses), even if such Contributor has been advised
25  * of the possibility of such damages.
26  */
27 
28 #pragma once
29 
32 
33 #include "../../../Primitives/interface/Object.h"
34 #include "../../../Primitives/interface/FlagEnum.h"
35 #include "GraphicsTypes.h"
36 #include "Constants.h"
37 #include "Buffer.h"
38 #include "BottomLevelAS.h"
39 
41 
42 // {16561861-294B-4804-96FA-1717333F769A}
43 static const INTERFACE_ID IID_TopLevelAS =
44  {0x16561861, 0x294b, 0x4804, {0x96, 0xfa, 0x17, 0x17, 0x33, 0x3f, 0x76, 0x9a}};
45 
46 // clang-format off
47 
50 
52  Uint32 MaxInstanceCount DEFAULT_INITIALIZER(0);
53 
56 
59  Uint32 CompactedSize DEFAULT_INITIALIZER(0);
60 
62  Uint64 CommandQueueMask DEFAULT_INITIALIZER(1);
63 
64 #if DILIGENT_CPP_INTERFACE
65  TopLevelASDesc() noexcept {}
66 #endif
67 };
69 
70 
73 {
79 
85 
91 
95 
97 };
98 
99 
102 {
104  Uint32 InstanceCount DEFAULT_INITIALIZER(0);
105 
107  Uint32 HitGroupStride DEFAULT_INITIALIZER(0);
108 
111 
113  Uint32 FirstContributionToHitGroupIndex DEFAULT_INITIALIZER(0);
114 
116  Uint32 LastContributionToHitGroupIndex DEFAULT_INITIALIZER(0);
117 };
119 
120 
123 {
125  Uint32 ContributionToHitGroupIndex DEFAULT_INITIALIZER(0);
126 
129  Uint32 InstanceIndex DEFAULT_INITIALIZER(0);
130 
133 
134 #if DILIGENT_CPP_INTERFACE
135  TLASInstanceDesc() noexcept {}
136 #endif
137 };
139 
140 
141 #define DILIGENT_INTERFACE_NAME ITopLevelAS
142 #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
143 
144 #define ITopLevelASInclusiveMethods \
145  IDeviceObjectInclusiveMethods; \
146  ITopLevelASMethods TopLevelAS
147 
149 
152 {
153 #if DILIGENT_CPP_INTERFACE
154  virtual const TopLevelASDesc& DILIGENT_CALL_TYPE GetDesc() const override = 0;
156 #endif
157 
159 
166  VIRTUAL TLASInstanceDesc METHOD(GetInstanceDesc)(THIS_
167  const char* Name) CONST PURE;
168 
169 
171 
175  VIRTUAL TLASBuildInfo METHOD(GetBuildInfo)(THIS) CONST PURE;
176 
177 
179 
181  VIRTUAL ScratchBufferSizes METHOD(GetScratchBufferSizes)(THIS) CONST PURE;
182 
183 
185 
188  VIRTUAL void* METHOD(GetNativeHandle)(THIS) PURE;
189 
190 
192 
198  VIRTUAL void METHOD(SetState)(THIS_
199  RESOURCE_STATE State) PURE;
200 
201 
204 };
206 
207 #include "../../../Primitives/interface/UndefInterfaceHelperMacros.h"
208 
209 #if DILIGENT_C_INTERFACE
210 
211 // clang-format off
212 
213 # define ITopLevelAS_GetInstanceDesc(This, ...) CALL_IFACE_METHOD(TopLevelAS, GetInstanceDesc, This, __VA_ARGS__)
214 # define ITopLevelAS_GetBuildInfo(This) CALL_IFACE_METHOD(TopLevelAS, GetBuildInfo, This)
215 # define ITopLevelAS_GetScratchBufferSizes(This) CALL_IFACE_METHOD(TopLevelAS, GetScratchBufferSizes, This)
216 # define ITopLevelAS_GetNativeHandle(This) CALL_IFACE_METHOD(TopLevelAS, GetNativeHandle, This)
217 # define ITopLevelAS_SetState(This, ...) CALL_IFACE_METHOD(TopLevelAS, SetState, This, __VA_ARGS__)
218 # define ITopLevelAS_GetState(This) CALL_IFACE_METHOD(TopLevelAS, GetState, This)
219 
220 // clang-format on
221 
222 #endif
223 
224 DILIGENT_END_NAMESPACE // namespace Diligent
DILIGENT_END_INTERFACE
#define DILIGENT_END_INTERFACE
Definition: DefineInterfaceHelperMacros.h:88
Diligent::INTERFACE_ID
struct INTERFACE_ID INTERFACE_ID
Definition: InterfaceID.h:54
VIRTUAL
#define VIRTUAL
Definition: DefineInterfaceHelperMacros.h:83
Diligent::TLASInstanceDesc::TLASInstanceDesc
TLASInstanceDesc() noexcept
Definition: TopLevelAS.h:135
Diligent::TopLevelASDesc
Top-level AS description.
Definition: TopLevelAS.h:49
DILIGENT_BEGIN_INTERFACE
#define DILIGENT_BEGIN_INTERFACE(Name, Base)
Definition: CommonDefinitions.h:97
Diligent::TLASBuildInfo
Defines TLAS state that was used in the last build.
Definition: TopLevelAS.h:101
Diligent::HIT_GROUP_BINDING_MODE_PER_GEOMETRY
@ HIT_GROUP_BINDING_MODE_PER_GEOMETRY
Each geometry in every instance may use a unique hit shader group. In this mode, the SBT reserves spa...
Definition: TopLevelAS.h:78
Flags
Uint32 Flags
Definition: DXBCUtils.cpp:71
Diligent::HIT_GROUP_BINDING_MODE_USER_DEFINED
@ HIT_GROUP_BINDING_MODE_USER_DEFINED
The user must specify TLASBuildInstanceData::ContributionToHitGroupIndex and only use IShaderBindingT...
Definition: TopLevelAS.h:94
Diligent::Uint64
uint64_t Uint64
64-bit unsigned integer
Definition: BasicTypes.h:50
Diligent::ITopLevelAS
Top-level AS interface.
Definition: TopLevelAS.h:151
Diligent::ScratchBufferSizes
Defines the scratch buffer info for acceleration structure.
Definition: BottomLevelAS.h:177
Diligent::HIT_GROUP_BINDING_MODE_LAST
@ HIT_GROUP_BINDING_MODE_LAST
Definition: TopLevelAS.h:96
Diligent::IDeviceObject
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:52
Diligent::RAYTRACING_BUILD_AS_NONE
@ RAYTRACING_BUILD_AS_NONE
Definition: BottomLevelAS.h:116
THIS
#define THIS
Definition: DefineInterfaceHelperMacros.h:81
Constants.h
PURE
#define PURE
Definition: DefineInterfaceHelperMacros.h:85
Diligent::DeviceObjectAttribs
Describes common device object attributes.
Definition: GraphicsTypes.h:1196
Diligent::TLASInstanceDesc
Top-level AS instance description.
Definition: TopLevelAS.h:122
Diligent::TopLevelASDesc::TopLevelASDesc
TopLevelASDesc() noexcept
Definition: TopLevelAS.h:65
DILIGENT_END_NAMESPACE
#define DILIGENT_END_NAMESPACE
Definition: CommonDefinitions.h:86
CONST
#define CONST
Definition: DefineInterfaceHelperMacros.h:84
DILIGENT_DERIVE
#define DILIGENT_DERIVE(TypeName)
Definition: CommonDefinitions.h:90
DILIGENT_CALL_TYPE
#define DILIGENT_CALL_TYPE
Definition: CommonDefinitions.h:45
Diligent::Uint32
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
Buffer.h
DEFAULT_INITIALIZER
#define DEFAULT_INITIALIZER(x)
Definition: CommonDefinitions.h:93
Diligent::RAYTRACING_BUILD_AS_FLAGS
RAYTRACING_BUILD_AS_FLAGS
Defines acceleration structures build flags.
Definition: BottomLevelAS.h:114
METHOD
#define METHOD(Name)
Definition: DefineInterfaceHelperMacros.h:87
DILIGENT_TYPED_ENUM
#define DILIGENT_TYPED_ENUM(EnumName, EnumType)
Definition: CommonDefinitions.h:88
Diligent::HIT_GROUP_BINDING_MODE_PER_TLAS
@ HIT_GROUP_BINDING_MODE_PER_TLAS
All instances in each TLAS will use the same hit group. In this mode, the SBT reserves a single slot ...
Definition: TopLevelAS.h:90
Diligent::HIT_GROUP_BINDING_MODE
HIT_GROUP_BINDING_MODE
Defines hit group binding mode used by the top-level AS.
Definition: TopLevelAS.h:72
Diligent::Uint8
uint8_t Uint8
8-bit unsigned integer
Definition: BasicTypes.h:53
DILIGENT_BEGIN_NAMESPACE
#define DILIGENT_BEGIN_NAMESPACE(Name)
Definition: CommonDefinitions.h:82
GraphicsTypes.h
Diligent::IBottomLevelAS
Bottom-level AS interface.
Definition: BottomLevelAS.h:207
Diligent::RESOURCE_STATE
RESOURCE_STATE
Resource usage state.
Definition: GraphicsTypes.h:2814
Diligent::HIT_GROUP_BINDING_MODE_PER_INSTANCE
@ HIT_GROUP_BINDING_MODE_PER_INSTANCE
Each instance may use a unique hit shader group. In this mode, the SBT reserves one slot for each ins...
Definition: TopLevelAS.h:84
Diligent
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
THIS_
#define THIS_
Definition: DefineInterfaceHelperMacros.h:82
BottomLevelAS.h