nv-sgl 0.6.0__cp313-cp313-win_amd64.whl
Sign up to get free protection for your applications and to get access to all the features.
- include/tevclient.h +393 -0
- nv_sgl-0.6.0.dist-info/LICENSE +29 -0
- nv_sgl-0.6.0.dist-info/METADATA +21 -0
- nv_sgl-0.6.0.dist-info/RECORD +142 -0
- nv_sgl-0.6.0.dist-info/WHEEL +5 -0
- nv_sgl-0.6.0.dist-info/top_level.txt +1 -0
- sgl/__init__.py +15 -0
- sgl/__init__.pyi +6738 -0
- sgl/d3d12/D3D12Core.dll +0 -0
- sgl/d3d12/d3d12SDKLayers.dll +0 -0
- sgl/dxcompiler.dll +0 -0
- sgl/dxil.dll +0 -0
- sgl/gfx.dll +0 -0
- sgl/include/sgl/app/app.h +113 -0
- sgl/include/sgl/core/bitmap.h +302 -0
- sgl/include/sgl/core/crypto.h +89 -0
- sgl/include/sgl/core/data_type.h +46 -0
- sgl/include/sgl/core/dds_file.h +103 -0
- sgl/include/sgl/core/enum.h +201 -0
- sgl/include/sgl/core/error.h +161 -0
- sgl/include/sgl/core/file_stream.h +77 -0
- sgl/include/sgl/core/file_system_watcher.h +141 -0
- sgl/include/sgl/core/format.h +36 -0
- sgl/include/sgl/core/fwd.h +90 -0
- sgl/include/sgl/core/hash.h +45 -0
- sgl/include/sgl/core/input.h +522 -0
- sgl/include/sgl/core/logger.h +214 -0
- sgl/include/sgl/core/macros.h +184 -0
- sgl/include/sgl/core/maths.h +45 -0
- sgl/include/sgl/core/memory_mapped_file.h +112 -0
- sgl/include/sgl/core/memory_mapped_file_stream.h +32 -0
- sgl/include/sgl/core/memory_stream.h +74 -0
- sgl/include/sgl/core/object.h +683 -0
- sgl/include/sgl/core/platform.h +239 -0
- sgl/include/sgl/core/plugin.h +331 -0
- sgl/include/sgl/core/resolver.h +39 -0
- sgl/include/sgl/core/short_vector.h +141 -0
- sgl/include/sgl/core/static_vector.h +111 -0
- sgl/include/sgl/core/stream.h +54 -0
- sgl/include/sgl/core/string.h +276 -0
- sgl/include/sgl/core/struct.h +360 -0
- sgl/include/sgl/core/thread.h +28 -0
- sgl/include/sgl/core/timer.h +52 -0
- sgl/include/sgl/core/traits.h +15 -0
- sgl/include/sgl/core/type_utils.h +19 -0
- sgl/include/sgl/core/window.h +177 -0
- sgl/include/sgl/device/agility_sdk.h +24 -0
- sgl/include/sgl/device/blit.h +88 -0
- sgl/include/sgl/device/buffer_cursor.h +162 -0
- sgl/include/sgl/device/command.h +539 -0
- sgl/include/sgl/device/cuda_api.h +766 -0
- sgl/include/sgl/device/cuda_interop.h +39 -0
- sgl/include/sgl/device/cuda_utils.h +107 -0
- sgl/include/sgl/device/cursor_utils.h +129 -0
- sgl/include/sgl/device/device.h +668 -0
- sgl/include/sgl/device/device_resource.h +37 -0
- sgl/include/sgl/device/fence.h +91 -0
- sgl/include/sgl/device/formats.h +330 -0
- sgl/include/sgl/device/framebuffer.h +85 -0
- sgl/include/sgl/device/fwd.h +164 -0
- sgl/include/sgl/device/helpers.h +20 -0
- sgl/include/sgl/device/hot_reload.h +75 -0
- sgl/include/sgl/device/input_layout.h +74 -0
- sgl/include/sgl/device/kernel.h +69 -0
- sgl/include/sgl/device/memory_heap.h +155 -0
- sgl/include/sgl/device/native_formats.h +342 -0
- sgl/include/sgl/device/native_handle.h +73 -0
- sgl/include/sgl/device/native_handle_traits.h +65 -0
- sgl/include/sgl/device/pipeline.h +138 -0
- sgl/include/sgl/device/print.h +45 -0
- sgl/include/sgl/device/python/cursor_utils.h +853 -0
- sgl/include/sgl/device/query.h +52 -0
- sgl/include/sgl/device/raytracing.h +84 -0
- sgl/include/sgl/device/reflection.h +1254 -0
- sgl/include/sgl/device/resource.h +705 -0
- sgl/include/sgl/device/sampler.h +57 -0
- sgl/include/sgl/device/shader.h +516 -0
- sgl/include/sgl/device/shader_cursor.h +85 -0
- sgl/include/sgl/device/shader_object.h +94 -0
- sgl/include/sgl/device/shader_offset.h +67 -0
- sgl/include/sgl/device/shared_handle.h +12 -0
- sgl/include/sgl/device/slang_utils.h +54 -0
- sgl/include/sgl/device/swapchain.h +74 -0
- sgl/include/sgl/device/types.h +782 -0
- sgl/include/sgl/math/colorspace.h +56 -0
- sgl/include/sgl/math/constants.h +7 -0
- sgl/include/sgl/math/float16.h +146 -0
- sgl/include/sgl/math/matrix.h +6 -0
- sgl/include/sgl/math/matrix_math.h +746 -0
- sgl/include/sgl/math/matrix_types.h +207 -0
- sgl/include/sgl/math/python/primitivetype.h +33 -0
- sgl/include/sgl/math/quaternion.h +6 -0
- sgl/include/sgl/math/quaternion_math.h +484 -0
- sgl/include/sgl/math/quaternion_types.h +83 -0
- sgl/include/sgl/math/ray.h +47 -0
- sgl/include/sgl/math/scalar_math.h +249 -0
- sgl/include/sgl/math/scalar_types.h +107 -0
- sgl/include/sgl/math/vector.h +6 -0
- sgl/include/sgl/math/vector_math.h +1796 -0
- sgl/include/sgl/math/vector_types.h +336 -0
- sgl/include/sgl/python/nanobind.h +489 -0
- sgl/include/sgl/python/py_doc.h +11600 -0
- sgl/include/sgl/python/sgl_ext_pch.h +8 -0
- sgl/include/sgl/sgl.h +21 -0
- sgl/include/sgl/sgl_pch.h +6 -0
- sgl/include/sgl/stl/bit.h +377 -0
- sgl/include/sgl/tests/testing.h +54 -0
- sgl/include/sgl/ui/fwd.h +34 -0
- sgl/include/sgl/ui/imgui_config.h +43 -0
- sgl/include/sgl/ui/ui.h +71 -0
- sgl/include/sgl/ui/widgets.h +918 -0
- sgl/include/sgl/utils/python/slangpy.h +366 -0
- sgl/include/sgl/utils/renderdoc.h +50 -0
- sgl/include/sgl/utils/slangpy.h +153 -0
- sgl/include/sgl/utils/tev.h +93 -0
- sgl/include/sgl/utils/texture_loader.h +106 -0
- sgl/math/__init__.pyi +5083 -0
- sgl/platform/__init__.pyi +102 -0
- sgl/renderdoc/__init__.pyi +51 -0
- sgl/sgl.dll +0 -0
- sgl/sgl_ext.cp313-win_amd64.pyd +0 -0
- sgl/shaders/nvapi/nvHLSLExtns.h +2315 -0
- sgl/shaders/nvapi/nvHLSLExtnsInternal.h +758 -0
- sgl/shaders/nvapi/nvShaderExtnEnums.h +142 -0
- sgl/shaders/sgl/device/blit.slang +93 -0
- sgl/shaders/sgl/device/nvapi.slang +5 -0
- sgl/shaders/sgl/device/nvapi.slangh +7 -0
- sgl/shaders/sgl/device/print.slang +445 -0
- sgl/shaders/sgl/math/constants.slang +4 -0
- sgl/shaders/sgl/math/ray.slang +29 -0
- sgl/shaders/sgl/ui/imgui.slang +49 -0
- sgl/slang-glslang.dll +0 -0
- sgl/slang-llvm.dll +0 -0
- sgl/slang-rt.dll +0 -0
- sgl/slang.dll +0 -0
- sgl/slangpy/__init__.pyi +268 -0
- sgl/tev/__init__.pyi +108 -0
- sgl/tevclient.lib +0 -0
- sgl/thread/__init__.pyi +4 -0
- sgl/ui/__init__.pyi +1118 -0
- share/cmake/tevclient/tevclient-config-release.cmake +19 -0
- share/cmake/tevclient/tevclient-config.cmake +108 -0
@@ -0,0 +1,782 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include "sgl/device/formats.h"
|
6
|
+
|
7
|
+
#include "sgl/core/macros.h"
|
8
|
+
#include "sgl/core/enum.h"
|
9
|
+
|
10
|
+
#include "sgl/math/vector_types.h"
|
11
|
+
#include "sgl/math/matrix_types.h"
|
12
|
+
|
13
|
+
#include <slang-gfx.h>
|
14
|
+
|
15
|
+
namespace sgl {
|
16
|
+
|
17
|
+
/// Represents an address in device memory.
|
18
|
+
using DeviceAddress = uint64_t;
|
19
|
+
/// Represents an offset in device memory (in bytes).
|
20
|
+
using DeviceOffset = uint64_t;
|
21
|
+
/// Represents a size in device memory (in bytes).
|
22
|
+
using DeviceSize = uint64_t;
|
23
|
+
|
24
|
+
enum CommandQueueType : uint32_t {
|
25
|
+
graphics = static_cast<uint32_t>(gfx::ICommandQueue::QueueType::Graphics),
|
26
|
+
};
|
27
|
+
|
28
|
+
SGL_ENUM_INFO(
|
29
|
+
CommandQueueType,
|
30
|
+
{
|
31
|
+
{CommandQueueType::graphics, "graphics"},
|
32
|
+
}
|
33
|
+
);
|
34
|
+
SGL_ENUM_REGISTER(CommandQueueType);
|
35
|
+
|
36
|
+
enum class ShaderModel : uint32_t {
|
37
|
+
unknown = 0,
|
38
|
+
sm_6_0 = 60,
|
39
|
+
sm_6_1 = 61,
|
40
|
+
sm_6_2 = 62,
|
41
|
+
sm_6_3 = 63,
|
42
|
+
sm_6_4 = 64,
|
43
|
+
sm_6_5 = 65,
|
44
|
+
sm_6_6 = 66,
|
45
|
+
sm_6_7 = 67,
|
46
|
+
};
|
47
|
+
|
48
|
+
SGL_ENUM_INFO(
|
49
|
+
ShaderModel,
|
50
|
+
{
|
51
|
+
{ShaderModel::unknown, "unknown"},
|
52
|
+
{ShaderModel::sm_6_0, "sm_6_0"},
|
53
|
+
{ShaderModel::sm_6_1, "sm_6_1"},
|
54
|
+
{ShaderModel::sm_6_2, "sm_6_2"},
|
55
|
+
{ShaderModel::sm_6_3, "sm_6_3"},
|
56
|
+
{ShaderModel::sm_6_4, "sm_6_4"},
|
57
|
+
{ShaderModel::sm_6_5, "sm_6_5"},
|
58
|
+
{ShaderModel::sm_6_6, "sm_6_6"},
|
59
|
+
{ShaderModel::sm_6_7, "sm_6_7"},
|
60
|
+
}
|
61
|
+
);
|
62
|
+
SGL_ENUM_REGISTER(ShaderModel);
|
63
|
+
|
64
|
+
inline uint32_t get_shader_model_major_version(ShaderModel sm)
|
65
|
+
{
|
66
|
+
return static_cast<uint32_t>(sm) / 10;
|
67
|
+
}
|
68
|
+
|
69
|
+
inline uint32_t get_shader_model_minor_version(ShaderModel sm)
|
70
|
+
{
|
71
|
+
return static_cast<uint32_t>(sm) % 10;
|
72
|
+
}
|
73
|
+
|
74
|
+
enum class ShaderStage : uint32_t {
|
75
|
+
none = SLANG_STAGE_NONE,
|
76
|
+
vertex = SLANG_STAGE_VERTEX,
|
77
|
+
hull = SLANG_STAGE_HULL,
|
78
|
+
domain = SLANG_STAGE_DOMAIN,
|
79
|
+
geometry = SLANG_STAGE_GEOMETRY,
|
80
|
+
fragment = SLANG_STAGE_FRAGMENT,
|
81
|
+
compute = SLANG_STAGE_COMPUTE,
|
82
|
+
ray_generation = SLANG_STAGE_RAY_GENERATION,
|
83
|
+
intersection = SLANG_STAGE_INTERSECTION,
|
84
|
+
any_hit = SLANG_STAGE_ANY_HIT,
|
85
|
+
closest_hit = SLANG_STAGE_CLOSEST_HIT,
|
86
|
+
miss = SLANG_STAGE_MISS,
|
87
|
+
callable = SLANG_STAGE_CALLABLE,
|
88
|
+
mesh = SLANG_STAGE_MESH,
|
89
|
+
amplification = SLANG_STAGE_AMPLIFICATION,
|
90
|
+
};
|
91
|
+
|
92
|
+
SGL_ENUM_INFO(
|
93
|
+
ShaderStage,
|
94
|
+
{
|
95
|
+
{ShaderStage::none, "none"},
|
96
|
+
{ShaderStage::vertex, "vertex"},
|
97
|
+
{ShaderStage::hull, "hull"},
|
98
|
+
{ShaderStage::domain, "domain"},
|
99
|
+
{ShaderStage::geometry, "geometry"},
|
100
|
+
{ShaderStage::fragment, "fragment"},
|
101
|
+
{ShaderStage::compute, "compute"},
|
102
|
+
{ShaderStage::ray_generation, "ray_generation"},
|
103
|
+
{ShaderStage::intersection, "intersection"},
|
104
|
+
{ShaderStage::any_hit, "any_hit"},
|
105
|
+
{ShaderStage::closest_hit, "closest_hit"},
|
106
|
+
{ShaderStage::miss, "miss"},
|
107
|
+
{ShaderStage::callable, "callable"},
|
108
|
+
{ShaderStage::mesh, "mesh"},
|
109
|
+
{ShaderStage::amplification, "amplification"},
|
110
|
+
}
|
111
|
+
);
|
112
|
+
SGL_ENUM_REGISTER(ShaderStage);
|
113
|
+
|
114
|
+
enum class ComparisonFunc : uint32_t {
|
115
|
+
never = static_cast<uint32_t>(gfx::ComparisonFunc::Never),
|
116
|
+
less = static_cast<uint32_t>(gfx::ComparisonFunc::Less),
|
117
|
+
equal = static_cast<uint32_t>(gfx::ComparisonFunc::Equal),
|
118
|
+
less_equal = static_cast<uint32_t>(gfx::ComparisonFunc::LessEqual),
|
119
|
+
greater = static_cast<uint32_t>(gfx::ComparisonFunc::Greater),
|
120
|
+
not_equal = static_cast<uint32_t>(gfx::ComparisonFunc::NotEqual),
|
121
|
+
greater_equal = static_cast<uint32_t>(gfx::ComparisonFunc::GreaterEqual),
|
122
|
+
always = static_cast<uint32_t>(gfx::ComparisonFunc::Always),
|
123
|
+
};
|
124
|
+
|
125
|
+
SGL_ENUM_INFO(
|
126
|
+
ComparisonFunc,
|
127
|
+
{
|
128
|
+
{ComparisonFunc::never, "never"},
|
129
|
+
{ComparisonFunc::less, "less"},
|
130
|
+
{ComparisonFunc::equal, "equal"},
|
131
|
+
{ComparisonFunc::less_equal, "less_equal"},
|
132
|
+
{ComparisonFunc::greater, "greater"},
|
133
|
+
{ComparisonFunc::not_equal, "not_equal"},
|
134
|
+
{ComparisonFunc::greater_equal, "greater_equal"},
|
135
|
+
{ComparisonFunc::always, "always"},
|
136
|
+
}
|
137
|
+
);
|
138
|
+
SGL_ENUM_REGISTER(ComparisonFunc);
|
139
|
+
|
140
|
+
// ----------------------------------------------------------------------------
|
141
|
+
// Sampler
|
142
|
+
// ----------------------------------------------------------------------------
|
143
|
+
|
144
|
+
enum class TextureFilteringMode : uint32_t {
|
145
|
+
point = static_cast<uint32_t>(gfx::TextureFilteringMode::Point),
|
146
|
+
linear = static_cast<uint32_t>(gfx::TextureFilteringMode::Linear),
|
147
|
+
};
|
148
|
+
|
149
|
+
SGL_ENUM_INFO(
|
150
|
+
TextureFilteringMode,
|
151
|
+
{
|
152
|
+
{TextureFilteringMode::point, "point"},
|
153
|
+
{TextureFilteringMode::linear, "linear"},
|
154
|
+
}
|
155
|
+
);
|
156
|
+
SGL_ENUM_REGISTER(TextureFilteringMode);
|
157
|
+
|
158
|
+
enum class TextureAddressingMode : uint32_t {
|
159
|
+
wrap = static_cast<uint32_t>(gfx::TextureAddressingMode::Wrap),
|
160
|
+
clamp_to_edge = static_cast<uint32_t>(gfx::TextureAddressingMode::ClampToEdge),
|
161
|
+
clamp_to_border = static_cast<uint32_t>(gfx::TextureAddressingMode::ClampToBorder),
|
162
|
+
mirror_repeat = static_cast<uint32_t>(gfx::TextureAddressingMode::MirrorRepeat),
|
163
|
+
mirror_once = static_cast<uint32_t>(gfx::TextureAddressingMode::MirrorOnce),
|
164
|
+
};
|
165
|
+
|
166
|
+
SGL_ENUM_INFO(
|
167
|
+
TextureAddressingMode,
|
168
|
+
{
|
169
|
+
{TextureAddressingMode::wrap, "wrap"},
|
170
|
+
{TextureAddressingMode::clamp_to_edge, "clamp_to_edge"},
|
171
|
+
{TextureAddressingMode::clamp_to_border, "clamp_to_border"},
|
172
|
+
{TextureAddressingMode::mirror_repeat, "mirror_repeat"},
|
173
|
+
{TextureAddressingMode::mirror_once, "mirror_once"},
|
174
|
+
}
|
175
|
+
);
|
176
|
+
SGL_ENUM_REGISTER(TextureAddressingMode);
|
177
|
+
|
178
|
+
enum class TextureReductionOp : uint32_t {
|
179
|
+
average = static_cast<uint32_t>(gfx::TextureReductionOp::Average),
|
180
|
+
comparison = static_cast<uint32_t>(gfx::TextureReductionOp::Comparison),
|
181
|
+
minimum = static_cast<uint32_t>(gfx::TextureReductionOp::Minimum),
|
182
|
+
maximum = static_cast<uint32_t>(gfx::TextureReductionOp::Maximum),
|
183
|
+
};
|
184
|
+
|
185
|
+
SGL_ENUM_INFO(
|
186
|
+
TextureReductionOp,
|
187
|
+
{
|
188
|
+
{TextureReductionOp::average, "average"},
|
189
|
+
{TextureReductionOp::comparison, "comparison"},
|
190
|
+
{TextureReductionOp::minimum, "minimum"},
|
191
|
+
{TextureReductionOp::maximum, "maximum"},
|
192
|
+
}
|
193
|
+
);
|
194
|
+
SGL_ENUM_REGISTER(TextureReductionOp);
|
195
|
+
|
196
|
+
// ----------------------------------------------------------------------------
|
197
|
+
// Graphics
|
198
|
+
// ----------------------------------------------------------------------------
|
199
|
+
|
200
|
+
struct IndirectDispatchArguments {
|
201
|
+
uint32_t thread_group_count_x;
|
202
|
+
uint32_t thread_group_count_y;
|
203
|
+
uint32_t thread_group_count_z;
|
204
|
+
};
|
205
|
+
|
206
|
+
// ----------------------------------------------------------------------------
|
207
|
+
// Graphics
|
208
|
+
// ----------------------------------------------------------------------------
|
209
|
+
|
210
|
+
struct IndirectDrawArguments {
|
211
|
+
uint32_t vertex_count_per_instance{0};
|
212
|
+
uint32_t instance_count{1};
|
213
|
+
uint32_t start_vertex_location{0};
|
214
|
+
uint32_t start_instance_location{0};
|
215
|
+
};
|
216
|
+
|
217
|
+
struct IndirectDrawIndexedArguments {
|
218
|
+
uint32_t index_count_per_instance{0};
|
219
|
+
uint32_t instance_count{1};
|
220
|
+
uint32_t start_index_location{0};
|
221
|
+
int32_t base_vertex_location{0};
|
222
|
+
uint32_t start_instance_location{0};
|
223
|
+
};
|
224
|
+
|
225
|
+
struct Viewport {
|
226
|
+
float x{0.f};
|
227
|
+
float y{0.f};
|
228
|
+
float width{0.f};
|
229
|
+
float height{0.f};
|
230
|
+
float min_depth{0.f};
|
231
|
+
float max_depth{1.f};
|
232
|
+
};
|
233
|
+
|
234
|
+
static_assert(
|
235
|
+
(sizeof(Viewport) == sizeof(gfx::Viewport)) && (offsetof(Viewport, x) == offsetof(gfx::Viewport, originX))
|
236
|
+
&& (offsetof(Viewport, y) == offsetof(gfx::Viewport, originY))
|
237
|
+
&& (offsetof(Viewport, width) == offsetof(gfx::Viewport, extentX))
|
238
|
+
&& (offsetof(Viewport, height) == offsetof(gfx::Viewport, extentY))
|
239
|
+
&& (offsetof(Viewport, min_depth) == offsetof(gfx::Viewport, minZ))
|
240
|
+
&& (offsetof(Viewport, max_depth) == offsetof(gfx::Viewport, maxZ)),
|
241
|
+
"Viewport struct mismatch"
|
242
|
+
);
|
243
|
+
|
244
|
+
struct ScissorRect {
|
245
|
+
int32_t min_x{0};
|
246
|
+
int32_t min_y{0};
|
247
|
+
int32_t max_x{0};
|
248
|
+
int32_t max_y{0};
|
249
|
+
};
|
250
|
+
|
251
|
+
static_assert(
|
252
|
+
(sizeof(ScissorRect) == sizeof(gfx::ScissorRect))
|
253
|
+
&& (offsetof(ScissorRect, min_x) == offsetof(gfx::ScissorRect, minX))
|
254
|
+
&& (offsetof(ScissorRect, min_y) == offsetof(gfx::ScissorRect, minY))
|
255
|
+
&& (offsetof(ScissorRect, max_x) == offsetof(gfx::ScissorRect, maxX))
|
256
|
+
&& (offsetof(ScissorRect, max_y) == offsetof(gfx::ScissorRect, maxY)),
|
257
|
+
"ScissorRect struct mismatch"
|
258
|
+
);
|
259
|
+
|
260
|
+
enum class PrimitiveType : uint8_t {
|
261
|
+
point = static_cast<uint8_t>(gfx::PrimitiveType::Point),
|
262
|
+
line = static_cast<uint8_t>(gfx::PrimitiveType::Line),
|
263
|
+
triangle = static_cast<uint8_t>(gfx::PrimitiveType::Triangle),
|
264
|
+
patch = static_cast<uint8_t>(gfx::PrimitiveType::Patch),
|
265
|
+
};
|
266
|
+
|
267
|
+
SGL_ENUM_INFO(
|
268
|
+
PrimitiveType,
|
269
|
+
{
|
270
|
+
{PrimitiveType::point, "point"},
|
271
|
+
{PrimitiveType::line, "line"},
|
272
|
+
{PrimitiveType::triangle, "triangle"},
|
273
|
+
{PrimitiveType::patch, "patch"},
|
274
|
+
}
|
275
|
+
);
|
276
|
+
SGL_ENUM_REGISTER(PrimitiveType);
|
277
|
+
|
278
|
+
enum class PrimitiveTopology : uint8_t {
|
279
|
+
triangle_list = static_cast<uint8_t>(gfx::PrimitiveTopology::TriangleList),
|
280
|
+
triangle_strip = static_cast<uint8_t>(gfx::PrimitiveTopology::TriangleStrip),
|
281
|
+
point_list = static_cast<uint8_t>(gfx::PrimitiveTopology::PointList),
|
282
|
+
line_list = static_cast<uint8_t>(gfx::PrimitiveTopology::LineList),
|
283
|
+
line_strip = static_cast<uint8_t>(gfx::PrimitiveTopology::LineStrip),
|
284
|
+
};
|
285
|
+
|
286
|
+
SGL_ENUM_INFO(
|
287
|
+
PrimitiveTopology,
|
288
|
+
{
|
289
|
+
{PrimitiveTopology::triangle_list, "triangle_list"},
|
290
|
+
{PrimitiveTopology::triangle_strip, "triangle_strip"},
|
291
|
+
{PrimitiveTopology::point_list, "point_list"},
|
292
|
+
{PrimitiveTopology::line_list, "line_list"},
|
293
|
+
{PrimitiveTopology::line_strip, "line_strip"},
|
294
|
+
}
|
295
|
+
);
|
296
|
+
SGL_ENUM_REGISTER(PrimitiveTopology);
|
297
|
+
|
298
|
+
enum class StencilOp : uint8_t {
|
299
|
+
keep = static_cast<uint8_t>(gfx::StencilOp::Keep),
|
300
|
+
zero = static_cast<uint8_t>(gfx::StencilOp::Keep),
|
301
|
+
replace = static_cast<uint8_t>(gfx::StencilOp::Keep),
|
302
|
+
increment_saturate = static_cast<uint8_t>(gfx::StencilOp::Keep),
|
303
|
+
decrement_saturate = static_cast<uint8_t>(gfx::StencilOp::Keep),
|
304
|
+
invert = static_cast<uint8_t>(gfx::StencilOp::Keep),
|
305
|
+
increment_wrap = static_cast<uint8_t>(gfx::StencilOp::Keep),
|
306
|
+
decrement_wrap = static_cast<uint8_t>(gfx::StencilOp::Keep),
|
307
|
+
};
|
308
|
+
|
309
|
+
SGL_ENUM_INFO(
|
310
|
+
StencilOp,
|
311
|
+
{
|
312
|
+
{StencilOp::keep, "keep"},
|
313
|
+
{StencilOp::zero, "zero"},
|
314
|
+
{StencilOp::replace, "replace"},
|
315
|
+
{StencilOp::increment_saturate, "increment_saturate"},
|
316
|
+
{StencilOp::decrement_saturate, "decrement_saturate"},
|
317
|
+
{StencilOp::invert, "invert"},
|
318
|
+
{StencilOp::increment_wrap, "increment_wrap"},
|
319
|
+
{StencilOp::decrement_wrap, "decrement_wrap"},
|
320
|
+
}
|
321
|
+
);
|
322
|
+
SGL_ENUM_REGISTER(StencilOp);
|
323
|
+
|
324
|
+
enum class FillMode : uint8_t {
|
325
|
+
solid = static_cast<uint8_t>(gfx::FillMode::Solid),
|
326
|
+
wireframe = static_cast<uint8_t>(gfx::FillMode::Wireframe),
|
327
|
+
};
|
328
|
+
|
329
|
+
SGL_ENUM_INFO(
|
330
|
+
FillMode,
|
331
|
+
{
|
332
|
+
{FillMode::solid, "solid"},
|
333
|
+
{FillMode::wireframe, "wireframe"},
|
334
|
+
}
|
335
|
+
);
|
336
|
+
SGL_ENUM_REGISTER(FillMode);
|
337
|
+
|
338
|
+
enum class CullMode : uint8_t {
|
339
|
+
none = static_cast<uint8_t>(gfx::CullMode::None),
|
340
|
+
front = static_cast<uint8_t>(gfx::CullMode::Front),
|
341
|
+
back = static_cast<uint8_t>(gfx::CullMode::Back),
|
342
|
+
};
|
343
|
+
|
344
|
+
SGL_ENUM_INFO(
|
345
|
+
CullMode,
|
346
|
+
{
|
347
|
+
{CullMode::none, "none"},
|
348
|
+
{CullMode::front, "front"},
|
349
|
+
{CullMode::back, "back"},
|
350
|
+
}
|
351
|
+
);
|
352
|
+
SGL_ENUM_REGISTER(CullMode);
|
353
|
+
|
354
|
+
enum class FrontFaceMode : uint8_t {
|
355
|
+
counter_clockwise = static_cast<uint8_t>(gfx::FrontFaceMode::CounterClockwise),
|
356
|
+
clockwise = static_cast<uint8_t>(gfx::FrontFaceMode::Clockwise),
|
357
|
+
};
|
358
|
+
|
359
|
+
SGL_ENUM_INFO(
|
360
|
+
FrontFaceMode,
|
361
|
+
{
|
362
|
+
{FrontFaceMode::counter_clockwise, "counter_clockwise"},
|
363
|
+
{FrontFaceMode::clockwise, "clockwise"},
|
364
|
+
}
|
365
|
+
);
|
366
|
+
SGL_ENUM_REGISTER(FrontFaceMode);
|
367
|
+
|
368
|
+
struct DepthStencilOpDesc {
|
369
|
+
StencilOp stencil_fail_op{StencilOp::keep};
|
370
|
+
StencilOp stencil_depth_fail_op{StencilOp::keep};
|
371
|
+
StencilOp stencil_pass_op{StencilOp::keep};
|
372
|
+
ComparisonFunc stencil_func{ComparisonFunc::always};
|
373
|
+
};
|
374
|
+
|
375
|
+
struct DepthStencilDesc {
|
376
|
+
bool depth_test_enable{false};
|
377
|
+
bool depth_write_enable{true};
|
378
|
+
ComparisonFunc depth_func = ComparisonFunc::less;
|
379
|
+
|
380
|
+
bool stencil_enable{false};
|
381
|
+
uint32_t stencil_read_mask{0xffffffff};
|
382
|
+
uint32_t stencil_write_mask{0xffffffff};
|
383
|
+
DepthStencilOpDesc front_face;
|
384
|
+
DepthStencilOpDesc back_face;
|
385
|
+
|
386
|
+
uint32_t stencil_ref = 0;
|
387
|
+
};
|
388
|
+
|
389
|
+
struct RasterizerDesc {
|
390
|
+
FillMode fill_mode{FillMode::solid};
|
391
|
+
CullMode cull_mode{CullMode::none};
|
392
|
+
FrontFaceMode front_face{FrontFaceMode::counter_clockwise};
|
393
|
+
int32_t depth_bias{0};
|
394
|
+
float depth_bias_clamp{0.0f};
|
395
|
+
float slope_scaled_depth_bias{0.0f};
|
396
|
+
bool depth_clip_enable{true};
|
397
|
+
bool scissor_enable{false};
|
398
|
+
bool multisample_enable{false};
|
399
|
+
bool antialiased_line_enable{false};
|
400
|
+
bool enable_conservative_rasterization{false};
|
401
|
+
uint32_t forced_sample_count{0};
|
402
|
+
};
|
403
|
+
|
404
|
+
enum class LogicOp : uint8_t {
|
405
|
+
no_op = static_cast<uint8_t>(gfx::LogicOp::NoOp),
|
406
|
+
};
|
407
|
+
|
408
|
+
SGL_ENUM_INFO(
|
409
|
+
LogicOp,
|
410
|
+
{
|
411
|
+
{LogicOp::no_op, "no_op"},
|
412
|
+
}
|
413
|
+
);
|
414
|
+
SGL_ENUM_REGISTER(LogicOp);
|
415
|
+
|
416
|
+
enum class BlendOp : uint8_t {
|
417
|
+
add = static_cast<uint8_t>(gfx::BlendOp::Add),
|
418
|
+
subtract = static_cast<uint8_t>(gfx::BlendOp::Subtract),
|
419
|
+
reverse_subtract = static_cast<uint8_t>(gfx::BlendOp::ReverseSubtract),
|
420
|
+
min = static_cast<uint8_t>(gfx::BlendOp::Min),
|
421
|
+
max = static_cast<uint8_t>(gfx::BlendOp::Max),
|
422
|
+
};
|
423
|
+
|
424
|
+
SGL_ENUM_INFO(
|
425
|
+
BlendOp,
|
426
|
+
{
|
427
|
+
{BlendOp::add, "add"},
|
428
|
+
{BlendOp::subtract, "subtract"},
|
429
|
+
{BlendOp::reverse_subtract, "reverse_subtract"},
|
430
|
+
{BlendOp::min, "min"},
|
431
|
+
{BlendOp::max, "max"},
|
432
|
+
}
|
433
|
+
);
|
434
|
+
SGL_ENUM_REGISTER(BlendOp);
|
435
|
+
|
436
|
+
enum class BlendFactor : uint8_t {
|
437
|
+
zero = static_cast<uint8_t>(gfx::BlendFactor::Zero),
|
438
|
+
one = static_cast<uint8_t>(gfx::BlendFactor::One),
|
439
|
+
src_color = static_cast<uint8_t>(gfx::BlendFactor::SrcColor),
|
440
|
+
inv_src_color = static_cast<uint8_t>(gfx::BlendFactor::InvSrcColor),
|
441
|
+
src_alpha = static_cast<uint8_t>(gfx::BlendFactor::SrcAlpha),
|
442
|
+
inv_src_alpha = static_cast<uint8_t>(gfx::BlendFactor::InvSrcAlpha),
|
443
|
+
dest_alpha = static_cast<uint8_t>(gfx::BlendFactor::DestAlpha),
|
444
|
+
inv_dest_alpha = static_cast<uint8_t>(gfx::BlendFactor::InvDestAlpha),
|
445
|
+
dest_color = static_cast<uint8_t>(gfx::BlendFactor::DestColor),
|
446
|
+
inv_dest_color = static_cast<uint8_t>(gfx::BlendFactor::InvDestColor),
|
447
|
+
src_alpha_saturate = static_cast<uint8_t>(gfx::BlendFactor::SrcAlphaSaturate),
|
448
|
+
blend_color = static_cast<uint8_t>(gfx::BlendFactor::BlendColor),
|
449
|
+
inv_blend_color = static_cast<uint8_t>(gfx::BlendFactor::InvBlendColor),
|
450
|
+
secondary_src_color = static_cast<uint8_t>(gfx::BlendFactor::SecondarySrcColor),
|
451
|
+
inv_secondary_src_color = static_cast<uint8_t>(gfx::BlendFactor::InvSecondarySrcColor),
|
452
|
+
secondary_src_alpha = static_cast<uint8_t>(gfx::BlendFactor::SecondarySrcAlpha),
|
453
|
+
inv_secondary_src_alpha = static_cast<uint8_t>(gfx::BlendFactor::InvSecondarySrcAlpha),
|
454
|
+
};
|
455
|
+
|
456
|
+
SGL_ENUM_INFO(
|
457
|
+
BlendFactor,
|
458
|
+
{
|
459
|
+
{BlendFactor::zero, "zero"},
|
460
|
+
{BlendFactor::one, "one"},
|
461
|
+
{BlendFactor::src_color, "src_color"},
|
462
|
+
{BlendFactor::inv_src_color, "inv_src_color"},
|
463
|
+
{BlendFactor::src_alpha, "src_alpha"},
|
464
|
+
{BlendFactor::inv_src_alpha, "inv_src_alpha"},
|
465
|
+
{BlendFactor::dest_alpha, "dest_alpha"},
|
466
|
+
{BlendFactor::inv_dest_alpha, "inv_dest_alpha"},
|
467
|
+
{BlendFactor::dest_color, "dest_color"},
|
468
|
+
{BlendFactor::inv_dest_color, "inv_dest_color"},
|
469
|
+
{BlendFactor::src_alpha_saturate, "src_alpha_saturate"},
|
470
|
+
{BlendFactor::blend_color, "blend_color"},
|
471
|
+
{BlendFactor::inv_blend_color, "inv_blend_color"},
|
472
|
+
{BlendFactor::secondary_src_color, "secondary_src_color"},
|
473
|
+
{BlendFactor::inv_secondary_src_color, "inv_secondary_src_color"},
|
474
|
+
{BlendFactor::secondary_src_alpha, "secondary_src_alpha"},
|
475
|
+
{BlendFactor::inv_secondary_src_alpha, "inv_secondary_src_alpha"},
|
476
|
+
}
|
477
|
+
);
|
478
|
+
SGL_ENUM_REGISTER(BlendFactor);
|
479
|
+
|
480
|
+
enum class RenderTargetWriteMask : uint8_t {
|
481
|
+
enable_none = static_cast<uint8_t>(gfx::RenderTargetWriteMask::EnableNone),
|
482
|
+
enable_red = static_cast<uint8_t>(gfx::RenderTargetWriteMask::EnableRed),
|
483
|
+
enable_green = static_cast<uint8_t>(gfx::RenderTargetWriteMask::EnableGreen),
|
484
|
+
enable_blue = static_cast<uint8_t>(gfx::RenderTargetWriteMask::EnableBlue),
|
485
|
+
enable_alpha = static_cast<uint8_t>(gfx::RenderTargetWriteMask::EnableAlpha),
|
486
|
+
enable_all = static_cast<uint8_t>(gfx::RenderTargetWriteMask::EnableAll),
|
487
|
+
};
|
488
|
+
|
489
|
+
SGL_ENUM_CLASS_OPERATORS(RenderTargetWriteMask);
|
490
|
+
SGL_ENUM_INFO(
|
491
|
+
RenderTargetWriteMask,
|
492
|
+
{
|
493
|
+
{RenderTargetWriteMask::enable_none, "enable_none"},
|
494
|
+
{RenderTargetWriteMask::enable_red, "enable_red"},
|
495
|
+
{RenderTargetWriteMask::enable_green, "enable_green"},
|
496
|
+
{RenderTargetWriteMask::enable_blue, "enable_blue"},
|
497
|
+
{RenderTargetWriteMask::enable_alpha, "enable_alpha"},
|
498
|
+
{RenderTargetWriteMask::enable_all, "enable_all"},
|
499
|
+
}
|
500
|
+
);
|
501
|
+
SGL_ENUM_REGISTER(RenderTargetWriteMask);
|
502
|
+
|
503
|
+
struct AspectBlendDesc {
|
504
|
+
BlendFactor src_factor{BlendFactor::one};
|
505
|
+
BlendFactor dst_factor{BlendFactor::zero};
|
506
|
+
BlendOp op{BlendOp::add};
|
507
|
+
};
|
508
|
+
|
509
|
+
struct TargetBlendDesc {
|
510
|
+
bool enable_blend{false};
|
511
|
+
AspectBlendDesc color;
|
512
|
+
AspectBlendDesc alpha;
|
513
|
+
LogicOp logic_op{LogicOp::no_op};
|
514
|
+
RenderTargetWriteMask write_mask{RenderTargetWriteMask::enable_all};
|
515
|
+
};
|
516
|
+
|
517
|
+
struct BlendDesc {
|
518
|
+
std::vector<TargetBlendDesc> targets;
|
519
|
+
bool alpha_to_coverage_enable{false};
|
520
|
+
};
|
521
|
+
|
522
|
+
// ----------------------------------------------------------------------------
|
523
|
+
// Queries
|
524
|
+
// ----------------------------------------------------------------------------
|
525
|
+
|
526
|
+
enum class QueryType : uint32_t {
|
527
|
+
timestamp = static_cast<uint32_t>(gfx::QueryType::Timestamp),
|
528
|
+
acceleration_structure_compacted_size = static_cast<uint32_t>(gfx::QueryType::AccelerationStructureCompactedSize),
|
529
|
+
acceleration_structure_serialized_size = static_cast<uint32_t>(gfx::QueryType::AccelerationStructureSerializedSize),
|
530
|
+
acceleration_structure_current_size = static_cast<uint32_t>(gfx::QueryType::AccelerationStructureCurrentSize),
|
531
|
+
};
|
532
|
+
|
533
|
+
SGL_ENUM_INFO(
|
534
|
+
QueryType,
|
535
|
+
{
|
536
|
+
{QueryType::timestamp, "timestamp"},
|
537
|
+
{QueryType::acceleration_structure_compacted_size, "acceleration_structure_compacted_size"},
|
538
|
+
{QueryType::acceleration_structure_serialized_size, "acceleration_structure_serialized_size"},
|
539
|
+
{QueryType::acceleration_structure_current_size, "acceleration_structure_current_size"},
|
540
|
+
}
|
541
|
+
);
|
542
|
+
SGL_ENUM_REGISTER(QueryType);
|
543
|
+
|
544
|
+
// ----------------------------------------------------------------------------
|
545
|
+
// RayTracing
|
546
|
+
// ----------------------------------------------------------------------------
|
547
|
+
|
548
|
+
|
549
|
+
enum class RayTracingPipelineFlags : uint8_t {
|
550
|
+
none = static_cast<uint8_t>(gfx::RayTracingPipelineFlags::None),
|
551
|
+
skip_triangles = static_cast<uint8_t>(gfx::RayTracingPipelineFlags::SkipTriangles),
|
552
|
+
skip_procedurals = static_cast<uint8_t>(gfx::RayTracingPipelineFlags::SkipProcedurals),
|
553
|
+
};
|
554
|
+
|
555
|
+
SGL_ENUM_CLASS_OPERATORS(RayTracingPipelineFlags);
|
556
|
+
SGL_ENUM_INFO(
|
557
|
+
RayTracingPipelineFlags,
|
558
|
+
{
|
559
|
+
{RayTracingPipelineFlags::none, "none"},
|
560
|
+
{RayTracingPipelineFlags::skip_triangles, "skip_triangles"},
|
561
|
+
{RayTracingPipelineFlags::skip_procedurals, "skip_procedurals"},
|
562
|
+
}
|
563
|
+
);
|
564
|
+
SGL_ENUM_REGISTER(RayTracingPipelineFlags);
|
565
|
+
|
566
|
+
enum class RayTracingGeometryType : uint32_t {
|
567
|
+
triangles = static_cast<uint32_t>(gfx::IAccelerationStructure::GeometryType::Triangles),
|
568
|
+
procedural_primitives = static_cast<uint32_t>(gfx::IAccelerationStructure::GeometryType::ProcedurePrimitives),
|
569
|
+
};
|
570
|
+
|
571
|
+
SGL_ENUM_INFO(
|
572
|
+
RayTracingGeometryType,
|
573
|
+
{
|
574
|
+
{RayTracingGeometryType::triangles, "triangles"},
|
575
|
+
{RayTracingGeometryType::procedural_primitives, "procedural_primitives"},
|
576
|
+
}
|
577
|
+
);
|
578
|
+
SGL_ENUM_REGISTER(RayTracingGeometryType);
|
579
|
+
|
580
|
+
enum class RayTracingGeometryFlags : uint32_t {
|
581
|
+
none = static_cast<uint32_t>(gfx::IAccelerationStructure::GeometryFlags::None),
|
582
|
+
opaque = static_cast<uint32_t>(gfx::IAccelerationStructure::GeometryFlags::Opaque),
|
583
|
+
no_duplicate_any_hit_invocation
|
584
|
+
= static_cast<uint32_t>(gfx::IAccelerationStructure::GeometryFlags::NoDuplicateAnyHitInvocation),
|
585
|
+
};
|
586
|
+
|
587
|
+
SGL_ENUM_CLASS_OPERATORS(RayTracingGeometryFlags);
|
588
|
+
SGL_ENUM_INFO(
|
589
|
+
RayTracingGeometryFlags,
|
590
|
+
{
|
591
|
+
{RayTracingGeometryFlags::none, "none"},
|
592
|
+
{RayTracingGeometryFlags::opaque, "opaque"},
|
593
|
+
{RayTracingGeometryFlags::no_duplicate_any_hit_invocation, "no_duplicate_any_hit_invocation"},
|
594
|
+
}
|
595
|
+
);
|
596
|
+
SGL_ENUM_REGISTER(RayTracingGeometryFlags);
|
597
|
+
|
598
|
+
struct RayTracingTrianglesDesc {
|
599
|
+
DeviceAddress transform3x4;
|
600
|
+
Format index_format;
|
601
|
+
Format vertex_format;
|
602
|
+
uint32_t index_count;
|
603
|
+
uint32_t vertex_count;
|
604
|
+
DeviceAddress index_data;
|
605
|
+
DeviceAddress vertex_data;
|
606
|
+
DeviceSize vertex_stride;
|
607
|
+
};
|
608
|
+
// clang-format off
|
609
|
+
static_assert(sizeof(RayTracingTrianglesDesc) == sizeof(gfx::IAccelerationStructure::TriangleDesc));
|
610
|
+
static_assert(offsetof(RayTracingTrianglesDesc, transform3x4) == offsetof(gfx::IAccelerationStructure::TriangleDesc, transform3x4));
|
611
|
+
static_assert(offsetof(RayTracingTrianglesDesc, index_format) == offsetof(gfx::IAccelerationStructure::TriangleDesc, indexFormat));
|
612
|
+
static_assert(offsetof(RayTracingTrianglesDesc, vertex_format) == offsetof(gfx::IAccelerationStructure::TriangleDesc, vertexFormat));
|
613
|
+
static_assert(offsetof(RayTracingTrianglesDesc, index_count) == offsetof(gfx::IAccelerationStructure::TriangleDesc, indexCount));
|
614
|
+
static_assert(offsetof(RayTracingTrianglesDesc, vertex_count) == offsetof(gfx::IAccelerationStructure::TriangleDesc, vertexCount));
|
615
|
+
static_assert(offsetof(RayTracingTrianglesDesc, index_data) == offsetof(gfx::IAccelerationStructure::TriangleDesc, indexData));
|
616
|
+
static_assert(offsetof(RayTracingTrianglesDesc, vertex_data) == offsetof(gfx::IAccelerationStructure::TriangleDesc, vertexData));
|
617
|
+
static_assert(offsetof(RayTracingTrianglesDesc, vertex_stride) == offsetof(gfx::IAccelerationStructure::TriangleDesc, vertexStride));
|
618
|
+
// clang-format on
|
619
|
+
|
620
|
+
struct RayTracingAABB {
|
621
|
+
float3 min;
|
622
|
+
float3 max;
|
623
|
+
};
|
624
|
+
static_assert(sizeof(RayTracingAABB) == 24);
|
625
|
+
static_assert(offsetof(RayTracingAABB, min) == offsetof(gfx::IAccelerationStructure::ProceduralAABB, minX));
|
626
|
+
static_assert(offsetof(RayTracingAABB, max) == offsetof(gfx::IAccelerationStructure::ProceduralAABB, maxX));
|
627
|
+
|
628
|
+
struct RayTracingAABBsDesc {
|
629
|
+
/// Number of AABBs.
|
630
|
+
uint32_t count;
|
631
|
+
|
632
|
+
/// Pointer to an array of `RayTracingAABB` values in device memory.
|
633
|
+
DeviceAddress data;
|
634
|
+
|
635
|
+
/// Stride in bytes of the AABB values array.
|
636
|
+
DeviceSize stride;
|
637
|
+
};
|
638
|
+
// clang-format off
|
639
|
+
static_assert(sizeof(RayTracingAABBsDesc) == sizeof(gfx::IAccelerationStructure::ProceduralAABBDesc));
|
640
|
+
static_assert(offsetof(RayTracingAABBsDesc, count) == offsetof(gfx::IAccelerationStructure::ProceduralAABBDesc, count));
|
641
|
+
static_assert(offsetof(RayTracingAABBsDesc, data) == offsetof(gfx::IAccelerationStructure::ProceduralAABBDesc, data));
|
642
|
+
static_assert(offsetof(RayTracingAABBsDesc, stride) == offsetof(gfx::IAccelerationStructure::ProceduralAABBDesc, stride));
|
643
|
+
// clang-format on
|
644
|
+
|
645
|
+
struct RayTracingGeometryDesc {
|
646
|
+
RayTracingGeometryType type;
|
647
|
+
RayTracingGeometryFlags flags;
|
648
|
+
union {
|
649
|
+
RayTracingTrianglesDesc triangles;
|
650
|
+
RayTracingAABBsDesc aabbs;
|
651
|
+
};
|
652
|
+
};
|
653
|
+
// clang-format off
|
654
|
+
static_assert(sizeof(RayTracingGeometryDesc) == sizeof(gfx::IAccelerationStructure::GeometryDesc));
|
655
|
+
static_assert(offsetof(RayTracingGeometryDesc, type) == offsetof(gfx::IAccelerationStructure::GeometryDesc, type));
|
656
|
+
static_assert(offsetof(RayTracingGeometryDesc, flags) == offsetof(gfx::IAccelerationStructure::GeometryDesc, flags));
|
657
|
+
static_assert(offsetof(RayTracingGeometryDesc, triangles) == offsetof(gfx::IAccelerationStructure::GeometryDesc, content));
|
658
|
+
static_assert(offsetof(RayTracingGeometryDesc, aabbs) == offsetof(gfx::IAccelerationStructure::GeometryDesc, content));
|
659
|
+
// clang-format on
|
660
|
+
|
661
|
+
enum class RayTracingInstanceFlags : uint32_t {
|
662
|
+
none = static_cast<uint32_t>(gfx::IAccelerationStructure::GeometryInstanceFlags::None),
|
663
|
+
triangle_facing_cull_disable
|
664
|
+
= static_cast<uint32_t>(gfx::IAccelerationStructure::GeometryInstanceFlags::TriangleFacingCullDisable),
|
665
|
+
triangle_front_counter_clockwise
|
666
|
+
= static_cast<uint32_t>(gfx::IAccelerationStructure::GeometryInstanceFlags::TriangleFrontCounterClockwise),
|
667
|
+
force_opaque = static_cast<uint32_t>(gfx::IAccelerationStructure::GeometryInstanceFlags::ForceOpaque),
|
668
|
+
no_opaque = static_cast<uint32_t>(gfx::IAccelerationStructure::GeometryInstanceFlags::NoOpaque),
|
669
|
+
};
|
670
|
+
|
671
|
+
SGL_ENUM_CLASS_OPERATORS(RayTracingInstanceFlags);
|
672
|
+
SGL_ENUM_INFO(
|
673
|
+
RayTracingInstanceFlags,
|
674
|
+
{
|
675
|
+
{RayTracingInstanceFlags::none, "none"},
|
676
|
+
{RayTracingInstanceFlags::triangle_facing_cull_disable, "triangle_facing_cull_disable"},
|
677
|
+
{RayTracingInstanceFlags::triangle_front_counter_clockwise, "triangle_front_counter_clockwise"},
|
678
|
+
{RayTracingInstanceFlags::force_opaque, "force_opaque"},
|
679
|
+
{RayTracingInstanceFlags::no_opaque, "no_opaque"},
|
680
|
+
}
|
681
|
+
);
|
682
|
+
SGL_ENUM_REGISTER(RayTracingInstanceFlags);
|
683
|
+
|
684
|
+
struct RayTracingInstanceDesc {
|
685
|
+
float3x4 transform;
|
686
|
+
uint32_t instance_id : 24;
|
687
|
+
uint32_t instance_mask : 8;
|
688
|
+
uint32_t instance_contribution_to_hit_group_index : 24;
|
689
|
+
uint32_t flags_ : 8; // Combination of RayTracingInstanceFlags values.
|
690
|
+
DeviceAddress acceleration_structure;
|
691
|
+
|
692
|
+
RayTracingInstanceFlags flags() const { return static_cast<RayTracingInstanceFlags>(flags_); }
|
693
|
+
void set_flags(RayTracingInstanceFlags flags) { flags_ = static_cast<uint32_t>(flags); }
|
694
|
+
};
|
695
|
+
static_assert(sizeof(RayTracingInstanceDesc) == 64);
|
696
|
+
|
697
|
+
enum class AccelerationStructureCopyMode : uint32_t {
|
698
|
+
clone = static_cast<uint32_t>(gfx::AccelerationStructureCopyMode::Clone),
|
699
|
+
compact = static_cast<uint32_t>(gfx::AccelerationStructureCopyMode::Compact),
|
700
|
+
};
|
701
|
+
|
702
|
+
SGL_ENUM_INFO(
|
703
|
+
AccelerationStructureCopyMode,
|
704
|
+
{
|
705
|
+
{AccelerationStructureCopyMode::clone, "clone"},
|
706
|
+
{AccelerationStructureCopyMode::compact, "compact"},
|
707
|
+
}
|
708
|
+
);
|
709
|
+
SGL_ENUM_REGISTER(AccelerationStructureCopyMode);
|
710
|
+
|
711
|
+
enum class AccelerationStructureKind : uint32_t {
|
712
|
+
top_level = static_cast<uint32_t>(gfx::IAccelerationStructure::Kind::TopLevel),
|
713
|
+
bottom_level = static_cast<uint32_t>(gfx::IAccelerationStructure::Kind::BottomLevel),
|
714
|
+
};
|
715
|
+
|
716
|
+
SGL_ENUM_INFO(
|
717
|
+
AccelerationStructureKind,
|
718
|
+
{
|
719
|
+
{AccelerationStructureKind::top_level, "top_level"},
|
720
|
+
{AccelerationStructureKind::bottom_level, "bottom_level"},
|
721
|
+
}
|
722
|
+
);
|
723
|
+
SGL_ENUM_REGISTER(AccelerationStructureKind);
|
724
|
+
|
725
|
+
enum class AccelerationStructureBuildFlags : uint32_t {
|
726
|
+
none = static_cast<uint32_t>(gfx::IAccelerationStructure::BuildFlags::None),
|
727
|
+
allow_update = static_cast<uint32_t>(gfx::IAccelerationStructure::BuildFlags::AllowUpdate),
|
728
|
+
allow_compaction = static_cast<uint32_t>(gfx::IAccelerationStructure::BuildFlags::AllowCompaction),
|
729
|
+
prefer_fast_trace = static_cast<uint32_t>(gfx::IAccelerationStructure::BuildFlags::PreferFastTrace),
|
730
|
+
prefer_fast_build = static_cast<uint32_t>(gfx::IAccelerationStructure::BuildFlags::PreferFastBuild),
|
731
|
+
minimize_memory = static_cast<uint32_t>(gfx::IAccelerationStructure::BuildFlags::MinimizeMemory),
|
732
|
+
perform_update = static_cast<uint32_t>(gfx::IAccelerationStructure::BuildFlags::PerformUpdate),
|
733
|
+
};
|
734
|
+
|
735
|
+
SGL_ENUM_CLASS_OPERATORS(AccelerationStructureBuildFlags);
|
736
|
+
SGL_ENUM_INFO(
|
737
|
+
AccelerationStructureBuildFlags,
|
738
|
+
{
|
739
|
+
{AccelerationStructureBuildFlags::none, "none"},
|
740
|
+
{AccelerationStructureBuildFlags::allow_update, "allow_update"},
|
741
|
+
{AccelerationStructureBuildFlags::allow_compaction, "allow_compaction"},
|
742
|
+
{AccelerationStructureBuildFlags::prefer_fast_trace, "prefer_fast_trace"},
|
743
|
+
{AccelerationStructureBuildFlags::prefer_fast_build, "prefer_fast_build"},
|
744
|
+
{AccelerationStructureBuildFlags::minimize_memory, "minimize_memory"},
|
745
|
+
{AccelerationStructureBuildFlags::perform_update, "perform_update"},
|
746
|
+
}
|
747
|
+
);
|
748
|
+
SGL_ENUM_REGISTER(AccelerationStructureBuildFlags);
|
749
|
+
|
750
|
+
|
751
|
+
struct AccelerationStructurePrebuildInfo {
|
752
|
+
DeviceSize result_data_max_size;
|
753
|
+
DeviceSize scratch_data_size;
|
754
|
+
DeviceSize update_scratch_data_size;
|
755
|
+
};
|
756
|
+
|
757
|
+
struct AccelerationStructureBuildInputs {
|
758
|
+
AccelerationStructureKind kind;
|
759
|
+
|
760
|
+
AccelerationStructureBuildFlags flags;
|
761
|
+
|
762
|
+
uint32_t desc_count{0};
|
763
|
+
|
764
|
+
/// Array of `RayTracingInstanceDesc` values in device memory.
|
765
|
+
/// Used when `kind` is `top_level`.
|
766
|
+
DeviceAddress instance_descs{0};
|
767
|
+
|
768
|
+
/// Array of `RayTracingGeometryDesc` values.
|
769
|
+
/// Used when `kind` is `bottom_level`.
|
770
|
+
const RayTracingGeometryDesc* geometry_descs{nullptr};
|
771
|
+
};
|
772
|
+
// clang-format off
|
773
|
+
static_assert(sizeof(AccelerationStructureBuildInputs) == sizeof(gfx::IAccelerationStructure::BuildInputs));
|
774
|
+
static_assert(offsetof(AccelerationStructureBuildInputs, kind) == offsetof(gfx::IAccelerationStructure::BuildInputs, kind));
|
775
|
+
static_assert(offsetof(AccelerationStructureBuildInputs, flags) == offsetof(gfx::IAccelerationStructure::BuildInputs, flags));
|
776
|
+
static_assert(offsetof(AccelerationStructureBuildInputs, desc_count) == offsetof(gfx::IAccelerationStructure::BuildInputs, descCount));
|
777
|
+
static_assert(offsetof(AccelerationStructureBuildInputs, instance_descs) == offsetof(gfx::IAccelerationStructure::BuildInputs, instanceDescs));
|
778
|
+
static_assert(offsetof(AccelerationStructureBuildInputs, geometry_descs) == offsetof(gfx::IAccelerationStructure::BuildInputs, geometryDescs));
|
779
|
+
// clang-format on
|
780
|
+
|
781
|
+
|
782
|
+
} // namespace sgl
|