nv-sgl 0.6.0__cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.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 +133 -0
- nv_sgl-0.6.0.dist-info/WHEEL +6 -0
- nv_sgl-0.6.0.dist-info/top_level.txt +1 -0
- sgl/__init__.py +15 -0
- sgl/__init__.pyi +6738 -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/libgfx.so +0 -0
- sgl/libsgl.so +0 -0
- sgl/libslang-glslang.so +0 -0
- sgl/libslang.so +0 -0
- sgl/libtevclient.a +0 -0
- sgl/math/__init__.pyi +5083 -0
- sgl/platform/__init__.pyi +102 -0
- sgl/renderdoc/__init__.pyi +51 -0
- sgl/sgl_ext.cpython-313-x86_64-linux-gnu.so +0 -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/slangpy/__init__.pyi +268 -0
- sgl/tev/__init__.pyi +108 -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 +103 -0
@@ -0,0 +1,342 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#pragma once
|
4
|
+
#include "sgl/device/formats.h"
|
5
|
+
#include "sgl/core/macros.h"
|
6
|
+
|
7
|
+
#if __has_include(<dxgiformat.h>)
|
8
|
+
#include <dxgiformat.h>
|
9
|
+
#else
|
10
|
+
enum DXGI_FORMAT {
|
11
|
+
DXGI_FORMAT_UNKNOWN = 0,
|
12
|
+
DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
|
13
|
+
DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
|
14
|
+
DXGI_FORMAT_R32G32B32A32_UINT = 3,
|
15
|
+
DXGI_FORMAT_R32G32B32A32_SINT = 4,
|
16
|
+
DXGI_FORMAT_R32G32B32_TYPELESS = 5,
|
17
|
+
DXGI_FORMAT_R32G32B32_FLOAT = 6,
|
18
|
+
DXGI_FORMAT_R32G32B32_UINT = 7,
|
19
|
+
DXGI_FORMAT_R32G32B32_SINT = 8,
|
20
|
+
DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
|
21
|
+
DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
|
22
|
+
DXGI_FORMAT_R16G16B16A16_UNORM = 11,
|
23
|
+
DXGI_FORMAT_R16G16B16A16_UINT = 12,
|
24
|
+
DXGI_FORMAT_R16G16B16A16_SNORM = 13,
|
25
|
+
DXGI_FORMAT_R16G16B16A16_SINT = 14,
|
26
|
+
DXGI_FORMAT_R32G32_TYPELESS = 15,
|
27
|
+
DXGI_FORMAT_R32G32_FLOAT = 16,
|
28
|
+
DXGI_FORMAT_R32G32_UINT = 17,
|
29
|
+
DXGI_FORMAT_R32G32_SINT = 18,
|
30
|
+
DXGI_FORMAT_R32G8X24_TYPELESS = 19,
|
31
|
+
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
|
32
|
+
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
|
33
|
+
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
|
34
|
+
DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
|
35
|
+
DXGI_FORMAT_R10G10B10A2_UNORM = 24,
|
36
|
+
DXGI_FORMAT_R10G10B10A2_UINT = 25,
|
37
|
+
DXGI_FORMAT_R11G11B10_FLOAT = 26,
|
38
|
+
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
|
39
|
+
DXGI_FORMAT_R8G8B8A8_UNORM = 28,
|
40
|
+
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
|
41
|
+
DXGI_FORMAT_R8G8B8A8_UINT = 30,
|
42
|
+
DXGI_FORMAT_R8G8B8A8_SNORM = 31,
|
43
|
+
DXGI_FORMAT_R8G8B8A8_SINT = 32,
|
44
|
+
DXGI_FORMAT_R16G16_TYPELESS = 33,
|
45
|
+
DXGI_FORMAT_R16G16_FLOAT = 34,
|
46
|
+
DXGI_FORMAT_R16G16_UNORM = 35,
|
47
|
+
DXGI_FORMAT_R16G16_UINT = 36,
|
48
|
+
DXGI_FORMAT_R16G16_SNORM = 37,
|
49
|
+
DXGI_FORMAT_R16G16_SINT = 38,
|
50
|
+
DXGI_FORMAT_R32_TYPELESS = 39,
|
51
|
+
DXGI_FORMAT_D32_FLOAT = 40,
|
52
|
+
DXGI_FORMAT_R32_FLOAT = 41,
|
53
|
+
DXGI_FORMAT_R32_UINT = 42,
|
54
|
+
DXGI_FORMAT_R32_SINT = 43,
|
55
|
+
DXGI_FORMAT_R24G8_TYPELESS = 44,
|
56
|
+
DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
|
57
|
+
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
|
58
|
+
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
|
59
|
+
DXGI_FORMAT_R8G8_TYPELESS = 48,
|
60
|
+
DXGI_FORMAT_R8G8_UNORM = 49,
|
61
|
+
DXGI_FORMAT_R8G8_UINT = 50,
|
62
|
+
DXGI_FORMAT_R8G8_SNORM = 51,
|
63
|
+
DXGI_FORMAT_R8G8_SINT = 52,
|
64
|
+
DXGI_FORMAT_R16_TYPELESS = 53,
|
65
|
+
DXGI_FORMAT_R16_FLOAT = 54,
|
66
|
+
DXGI_FORMAT_D16_UNORM = 55,
|
67
|
+
DXGI_FORMAT_R16_UNORM = 56,
|
68
|
+
DXGI_FORMAT_R16_UINT = 57,
|
69
|
+
DXGI_FORMAT_R16_SNORM = 58,
|
70
|
+
DXGI_FORMAT_R16_SINT = 59,
|
71
|
+
DXGI_FORMAT_R8_TYPELESS = 60,
|
72
|
+
DXGI_FORMAT_R8_UNORM = 61,
|
73
|
+
DXGI_FORMAT_R8_UINT = 62,
|
74
|
+
DXGI_FORMAT_R8_SNORM = 63,
|
75
|
+
DXGI_FORMAT_R8_SINT = 64,
|
76
|
+
DXGI_FORMAT_A8_UNORM = 65,
|
77
|
+
DXGI_FORMAT_R1_UNORM = 66,
|
78
|
+
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
|
79
|
+
DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
|
80
|
+
DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
|
81
|
+
DXGI_FORMAT_BC1_TYPELESS = 70,
|
82
|
+
DXGI_FORMAT_BC1_UNORM = 71,
|
83
|
+
DXGI_FORMAT_BC1_UNORM_SRGB = 72,
|
84
|
+
DXGI_FORMAT_BC2_TYPELESS = 73,
|
85
|
+
DXGI_FORMAT_BC2_UNORM = 74,
|
86
|
+
DXGI_FORMAT_BC2_UNORM_SRGB = 75,
|
87
|
+
DXGI_FORMAT_BC3_TYPELESS = 76,
|
88
|
+
DXGI_FORMAT_BC3_UNORM = 77,
|
89
|
+
DXGI_FORMAT_BC3_UNORM_SRGB = 78,
|
90
|
+
DXGI_FORMAT_BC4_TYPELESS = 79,
|
91
|
+
DXGI_FORMAT_BC4_UNORM = 80,
|
92
|
+
DXGI_FORMAT_BC4_SNORM = 81,
|
93
|
+
DXGI_FORMAT_BC5_TYPELESS = 82,
|
94
|
+
DXGI_FORMAT_BC5_UNORM = 83,
|
95
|
+
DXGI_FORMAT_BC5_SNORM = 84,
|
96
|
+
DXGI_FORMAT_B5G6R5_UNORM = 85,
|
97
|
+
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
|
98
|
+
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
|
99
|
+
DXGI_FORMAT_B8G8R8X8_UNORM = 88,
|
100
|
+
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
|
101
|
+
DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
|
102
|
+
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
|
103
|
+
DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
|
104
|
+
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
|
105
|
+
DXGI_FORMAT_BC6H_TYPELESS = 94,
|
106
|
+
DXGI_FORMAT_BC6H_UF16 = 95,
|
107
|
+
DXGI_FORMAT_BC6H_SF16 = 96,
|
108
|
+
DXGI_FORMAT_BC7_TYPELESS = 97,
|
109
|
+
DXGI_FORMAT_BC7_UNORM = 98,
|
110
|
+
DXGI_FORMAT_BC7_UNORM_SRGB = 99,
|
111
|
+
DXGI_FORMAT_AYUV = 100,
|
112
|
+
DXGI_FORMAT_Y410 = 101,
|
113
|
+
DXGI_FORMAT_Y416 = 102,
|
114
|
+
DXGI_FORMAT_NV12 = 103,
|
115
|
+
DXGI_FORMAT_P010 = 104,
|
116
|
+
DXGI_FORMAT_P016 = 105,
|
117
|
+
DXGI_FORMAT_420_OPAQUE = 106,
|
118
|
+
DXGI_FORMAT_YUY2 = 107,
|
119
|
+
DXGI_FORMAT_Y210 = 108,
|
120
|
+
DXGI_FORMAT_Y216 = 109,
|
121
|
+
DXGI_FORMAT_NV11 = 110,
|
122
|
+
DXGI_FORMAT_AI44 = 111,
|
123
|
+
DXGI_FORMAT_IA44 = 112,
|
124
|
+
DXGI_FORMAT_P8 = 113,
|
125
|
+
DXGI_FORMAT_A8P8 = 114,
|
126
|
+
DXGI_FORMAT_B4G4R4A4_UNORM = 115,
|
127
|
+
DXGI_FORMAT_P208 = 130,
|
128
|
+
DXGI_FORMAT_V208 = 131,
|
129
|
+
DXGI_FORMAT_V408 = 132,
|
130
|
+
DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 189,
|
131
|
+
DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190,
|
132
|
+
DXGI_FORMAT_FORCE_UINT = 0xffffffff
|
133
|
+
};
|
134
|
+
#endif
|
135
|
+
|
136
|
+
#if __has_include(<vulkan/vulkan.h>)
|
137
|
+
#include <vulkan/vulkan.h>
|
138
|
+
#else
|
139
|
+
typedef enum VkFormat {
|
140
|
+
VK_FORMAT_UNDEFINED = 0,
|
141
|
+
VK_FORMAT_R4G4_UNORM_PACK8 = 1,
|
142
|
+
VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2,
|
143
|
+
VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3,
|
144
|
+
VK_FORMAT_R5G6B5_UNORM_PACK16 = 4,
|
145
|
+
VK_FORMAT_B5G6R5_UNORM_PACK16 = 5,
|
146
|
+
VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6,
|
147
|
+
VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7,
|
148
|
+
VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8,
|
149
|
+
VK_FORMAT_R8_UNORM = 9,
|
150
|
+
VK_FORMAT_R8_SNORM = 10,
|
151
|
+
VK_FORMAT_R8_USCALED = 11,
|
152
|
+
VK_FORMAT_R8_SSCALED = 12,
|
153
|
+
VK_FORMAT_R8_UINT = 13,
|
154
|
+
VK_FORMAT_R8_SINT = 14,
|
155
|
+
VK_FORMAT_R8_SRGB = 15,
|
156
|
+
VK_FORMAT_R8G8_UNORM = 16,
|
157
|
+
VK_FORMAT_R8G8_SNORM = 17,
|
158
|
+
VK_FORMAT_R8G8_USCALED = 18,
|
159
|
+
VK_FORMAT_R8G8_SSCALED = 19,
|
160
|
+
VK_FORMAT_R8G8_UINT = 20,
|
161
|
+
VK_FORMAT_R8G8_SINT = 21,
|
162
|
+
VK_FORMAT_R8G8_SRGB = 22,
|
163
|
+
VK_FORMAT_R8G8B8_UNORM = 23,
|
164
|
+
VK_FORMAT_R8G8B8_SNORM = 24,
|
165
|
+
VK_FORMAT_R8G8B8_USCALED = 25,
|
166
|
+
VK_FORMAT_R8G8B8_SSCALED = 26,
|
167
|
+
VK_FORMAT_R8G8B8_UINT = 27,
|
168
|
+
VK_FORMAT_R8G8B8_SINT = 28,
|
169
|
+
VK_FORMAT_R8G8B8_SRGB = 29,
|
170
|
+
VK_FORMAT_B8G8R8_UNORM = 30,
|
171
|
+
VK_FORMAT_B8G8R8_SNORM = 31,
|
172
|
+
VK_FORMAT_B8G8R8_USCALED = 32,
|
173
|
+
VK_FORMAT_B8G8R8_SSCALED = 33,
|
174
|
+
VK_FORMAT_B8G8R8_UINT = 34,
|
175
|
+
VK_FORMAT_B8G8R8_SINT = 35,
|
176
|
+
VK_FORMAT_B8G8R8_SRGB = 36,
|
177
|
+
VK_FORMAT_R8G8B8A8_UNORM = 37,
|
178
|
+
VK_FORMAT_R8G8B8A8_SNORM = 38,
|
179
|
+
VK_FORMAT_R8G8B8A8_USCALED = 39,
|
180
|
+
VK_FORMAT_R8G8B8A8_SSCALED = 40,
|
181
|
+
VK_FORMAT_R8G8B8A8_UINT = 41,
|
182
|
+
VK_FORMAT_R8G8B8A8_SINT = 42,
|
183
|
+
VK_FORMAT_R8G8B8A8_SRGB = 43,
|
184
|
+
VK_FORMAT_B8G8R8A8_UNORM = 44,
|
185
|
+
VK_FORMAT_B8G8R8A8_SNORM = 45,
|
186
|
+
VK_FORMAT_B8G8R8A8_USCALED = 46,
|
187
|
+
VK_FORMAT_B8G8R8A8_SSCALED = 47,
|
188
|
+
VK_FORMAT_B8G8R8A8_UINT = 48,
|
189
|
+
VK_FORMAT_B8G8R8A8_SINT = 49,
|
190
|
+
VK_FORMAT_B8G8R8A8_SRGB = 50,
|
191
|
+
VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51,
|
192
|
+
VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52,
|
193
|
+
VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53,
|
194
|
+
VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54,
|
195
|
+
VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55,
|
196
|
+
VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56,
|
197
|
+
VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57,
|
198
|
+
VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58,
|
199
|
+
VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59,
|
200
|
+
VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60,
|
201
|
+
VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61,
|
202
|
+
VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62,
|
203
|
+
VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63,
|
204
|
+
VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64,
|
205
|
+
VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65,
|
206
|
+
VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66,
|
207
|
+
VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67,
|
208
|
+
VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68,
|
209
|
+
VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69,
|
210
|
+
VK_FORMAT_R16_UNORM = 70,
|
211
|
+
VK_FORMAT_R16_SNORM = 71,
|
212
|
+
VK_FORMAT_R16_USCALED = 72,
|
213
|
+
VK_FORMAT_R16_SSCALED = 73,
|
214
|
+
VK_FORMAT_R16_UINT = 74,
|
215
|
+
VK_FORMAT_R16_SINT = 75,
|
216
|
+
VK_FORMAT_R16_SFLOAT = 76,
|
217
|
+
VK_FORMAT_R16G16_UNORM = 77,
|
218
|
+
VK_FORMAT_R16G16_SNORM = 78,
|
219
|
+
VK_FORMAT_R16G16_USCALED = 79,
|
220
|
+
VK_FORMAT_R16G16_SSCALED = 80,
|
221
|
+
VK_FORMAT_R16G16_UINT = 81,
|
222
|
+
VK_FORMAT_R16G16_SINT = 82,
|
223
|
+
VK_FORMAT_R16G16_SFLOAT = 83,
|
224
|
+
VK_FORMAT_R16G16B16_UNORM = 84,
|
225
|
+
VK_FORMAT_R16G16B16_SNORM = 85,
|
226
|
+
VK_FORMAT_R16G16B16_USCALED = 86,
|
227
|
+
VK_FORMAT_R16G16B16_SSCALED = 87,
|
228
|
+
VK_FORMAT_R16G16B16_UINT = 88,
|
229
|
+
VK_FORMAT_R16G16B16_SINT = 89,
|
230
|
+
VK_FORMAT_R16G16B16_SFLOAT = 90,
|
231
|
+
VK_FORMAT_R16G16B16A16_UNORM = 91,
|
232
|
+
VK_FORMAT_R16G16B16A16_SNORM = 92,
|
233
|
+
VK_FORMAT_R16G16B16A16_USCALED = 93,
|
234
|
+
VK_FORMAT_R16G16B16A16_SSCALED = 94,
|
235
|
+
VK_FORMAT_R16G16B16A16_UINT = 95,
|
236
|
+
VK_FORMAT_R16G16B16A16_SINT = 96,
|
237
|
+
VK_FORMAT_R16G16B16A16_SFLOAT = 97,
|
238
|
+
VK_FORMAT_R32_UINT = 98,
|
239
|
+
VK_FORMAT_R32_SINT = 99,
|
240
|
+
VK_FORMAT_R32_SFLOAT = 100,
|
241
|
+
VK_FORMAT_R32G32_UINT = 101,
|
242
|
+
VK_FORMAT_R32G32_SINT = 102,
|
243
|
+
VK_FORMAT_R32G32_SFLOAT = 103,
|
244
|
+
VK_FORMAT_R32G32B32_UINT = 104,
|
245
|
+
VK_FORMAT_R32G32B32_SINT = 105,
|
246
|
+
VK_FORMAT_R32G32B32_SFLOAT = 106,
|
247
|
+
VK_FORMAT_R32G32B32A32_UINT = 107,
|
248
|
+
VK_FORMAT_R32G32B32A32_SINT = 108,
|
249
|
+
VK_FORMAT_R32G32B32A32_SFLOAT = 109,
|
250
|
+
VK_FORMAT_R64_UINT = 110,
|
251
|
+
VK_FORMAT_R64_SINT = 111,
|
252
|
+
VK_FORMAT_R64_SFLOAT = 112,
|
253
|
+
VK_FORMAT_R64G64_UINT = 113,
|
254
|
+
VK_FORMAT_R64G64_SINT = 114,
|
255
|
+
VK_FORMAT_R64G64_SFLOAT = 115,
|
256
|
+
VK_FORMAT_R64G64B64_UINT = 116,
|
257
|
+
VK_FORMAT_R64G64B64_SINT = 117,
|
258
|
+
VK_FORMAT_R64G64B64_SFLOAT = 118,
|
259
|
+
VK_FORMAT_R64G64B64A64_UINT = 119,
|
260
|
+
VK_FORMAT_R64G64B64A64_SINT = 120,
|
261
|
+
VK_FORMAT_R64G64B64A64_SFLOAT = 121,
|
262
|
+
VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122,
|
263
|
+
VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123,
|
264
|
+
VK_FORMAT_D16_UNORM = 124,
|
265
|
+
VK_FORMAT_X8_D24_UNORM_PACK32 = 125,
|
266
|
+
VK_FORMAT_D32_SFLOAT = 126,
|
267
|
+
VK_FORMAT_S8_UINT = 127,
|
268
|
+
VK_FORMAT_D16_UNORM_S8_UINT = 128,
|
269
|
+
VK_FORMAT_D24_UNORM_S8_UINT = 129,
|
270
|
+
VK_FORMAT_D32_SFLOAT_S8_UINT = 130,
|
271
|
+
VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131,
|
272
|
+
VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132,
|
273
|
+
VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133,
|
274
|
+
VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134,
|
275
|
+
VK_FORMAT_BC2_UNORM_BLOCK = 135,
|
276
|
+
VK_FORMAT_BC2_SRGB_BLOCK = 136,
|
277
|
+
VK_FORMAT_BC3_UNORM_BLOCK = 137,
|
278
|
+
VK_FORMAT_BC3_SRGB_BLOCK = 138,
|
279
|
+
VK_FORMAT_BC4_UNORM_BLOCK = 139,
|
280
|
+
VK_FORMAT_BC4_SNORM_BLOCK = 140,
|
281
|
+
VK_FORMAT_BC5_UNORM_BLOCK = 141,
|
282
|
+
VK_FORMAT_BC5_SNORM_BLOCK = 142,
|
283
|
+
VK_FORMAT_BC6H_UFLOAT_BLOCK = 143,
|
284
|
+
VK_FORMAT_BC6H_SFLOAT_BLOCK = 144,
|
285
|
+
VK_FORMAT_BC7_UNORM_BLOCK = 145,
|
286
|
+
VK_FORMAT_BC7_SRGB_BLOCK = 146,
|
287
|
+
VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147,
|
288
|
+
VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148,
|
289
|
+
VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149,
|
290
|
+
VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150,
|
291
|
+
VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151,
|
292
|
+
VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152,
|
293
|
+
VK_FORMAT_EAC_R11_UNORM_BLOCK = 153,
|
294
|
+
VK_FORMAT_EAC_R11_SNORM_BLOCK = 154,
|
295
|
+
VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155,
|
296
|
+
VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156,
|
297
|
+
VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157,
|
298
|
+
VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158,
|
299
|
+
VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159,
|
300
|
+
VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160,
|
301
|
+
VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161,
|
302
|
+
VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162,
|
303
|
+
VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163,
|
304
|
+
VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164,
|
305
|
+
VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165,
|
306
|
+
VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166,
|
307
|
+
VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167,
|
308
|
+
VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168,
|
309
|
+
VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169,
|
310
|
+
VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170,
|
311
|
+
VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171,
|
312
|
+
VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172,
|
313
|
+
VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173,
|
314
|
+
VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174,
|
315
|
+
VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175,
|
316
|
+
VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176,
|
317
|
+
VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177,
|
318
|
+
VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178,
|
319
|
+
VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179,
|
320
|
+
VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180,
|
321
|
+
VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181,
|
322
|
+
VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182,
|
323
|
+
VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183,
|
324
|
+
VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184,
|
325
|
+
} VkFormat;
|
326
|
+
#endif
|
327
|
+
|
328
|
+
namespace sgl {
|
329
|
+
|
330
|
+
/// Convert from sgl to DXGI format.
|
331
|
+
DXGI_FORMAT SGL_API get_dxgi_format(Format format);
|
332
|
+
|
333
|
+
/// Convert from DXGI to sgl format.
|
334
|
+
Format SGL_API get_format(DXGI_FORMAT dxgi_format);
|
335
|
+
|
336
|
+
/// Convert from sgl to Vulkan format.
|
337
|
+
VkFormat SGL_API get_vulkan_format(Format format);
|
338
|
+
|
339
|
+
/// Convert from Vulkan to sgl format.
|
340
|
+
Format SGL_API get_format(VkFormat vk_format);
|
341
|
+
|
342
|
+
} // namespace sgl
|
@@ -0,0 +1,73 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include "sgl/core/error.h"
|
6
|
+
|
7
|
+
#include <cstdint>
|
8
|
+
|
9
|
+
namespace sgl {
|
10
|
+
|
11
|
+
enum class NativeHandleType {
|
12
|
+
unknown,
|
13
|
+
|
14
|
+
ID3D12Device,
|
15
|
+
ID3D12Resource,
|
16
|
+
ID3D12PipelineState,
|
17
|
+
ID3D12Fence,
|
18
|
+
ID3D12CommandQueue,
|
19
|
+
ID3D12GraphicsCommandList,
|
20
|
+
D3D12_CPU_DESCRIPTOR_HANDLE,
|
21
|
+
|
22
|
+
VkInstance,
|
23
|
+
VkPhysicalDevice,
|
24
|
+
VkDevice,
|
25
|
+
VkImage,
|
26
|
+
VkImageView,
|
27
|
+
VkBuffer,
|
28
|
+
VkBufferView,
|
29
|
+
VkPipeline,
|
30
|
+
VkFence,
|
31
|
+
VkQueue,
|
32
|
+
VkCommandBuffer,
|
33
|
+
VkSampler,
|
34
|
+
};
|
35
|
+
|
36
|
+
template<typename T>
|
37
|
+
struct NativeHandleTrait;
|
38
|
+
|
39
|
+
/// Represents a native graphics API handle (e.g. D3D12 or Vulkan).
|
40
|
+
/// Native handles are expected to fit into 64 bits.
|
41
|
+
/// Type information and conversion from/to native handles is done
|
42
|
+
/// using type traits from native_handle_traits.h which needs to be
|
43
|
+
/// included when creating and accessing NativeHandle.
|
44
|
+
/// This separation is done so we don't expose the heavy D3D12/Vulkan
|
45
|
+
/// headers everywhere.
|
46
|
+
class NativeHandle {
|
47
|
+
public:
|
48
|
+
NativeHandle() = default;
|
49
|
+
|
50
|
+
template<typename T>
|
51
|
+
explicit NativeHandle(T native)
|
52
|
+
{
|
53
|
+
m_type = NativeHandleTrait<T>::type;
|
54
|
+
m_value = NativeHandleTrait<T>::pack(native);
|
55
|
+
}
|
56
|
+
|
57
|
+
NativeHandleType type() const { return m_type; }
|
58
|
+
|
59
|
+
bool is_valid() const { return m_type != NativeHandleType::unknown; }
|
60
|
+
|
61
|
+
template<typename T>
|
62
|
+
T as() const
|
63
|
+
{
|
64
|
+
SGL_ASSERT(m_type == NativeHandleTrait<T>::type);
|
65
|
+
return NativeHandleTrait<T>::unpack(m_value);
|
66
|
+
}
|
67
|
+
|
68
|
+
private:
|
69
|
+
NativeHandleType m_type{NativeHandleType::unknown};
|
70
|
+
uint64_t m_value{0};
|
71
|
+
};
|
72
|
+
|
73
|
+
} // namespace sgl
|
@@ -0,0 +1,65 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include "native_handle.h"
|
6
|
+
|
7
|
+
#include "sgl/core/config.h"
|
8
|
+
|
9
|
+
#if SGL_HAS_D3D12
|
10
|
+
#include <d3d12.h>
|
11
|
+
#endif
|
12
|
+
|
13
|
+
#if SGL_HAS_VULKAN
|
14
|
+
#include <vulkan/vulkan.h>
|
15
|
+
#endif
|
16
|
+
|
17
|
+
#include "sgl/stl/bit.h" // Replace with <bit> when available on all platforms.
|
18
|
+
|
19
|
+
namespace sgl {
|
20
|
+
|
21
|
+
template<typename T>
|
22
|
+
struct NativeHandleTrait { };
|
23
|
+
|
24
|
+
#define SGL_NATIVE_HANDLE(T, TYPE) \
|
25
|
+
template<> \
|
26
|
+
struct NativeHandleTrait<T> { \
|
27
|
+
static const NativeHandleType type = TYPE; \
|
28
|
+
static uint64_t pack(T native) \
|
29
|
+
{ \
|
30
|
+
return stdx::bit_cast<uint64_t>(native); \
|
31
|
+
} \
|
32
|
+
static T unpack(uint64_t value) \
|
33
|
+
{ \
|
34
|
+
return stdx::bit_cast<T>(value); \
|
35
|
+
} \
|
36
|
+
};
|
37
|
+
|
38
|
+
#if SGL_HAS_D3D12
|
39
|
+
SGL_NATIVE_HANDLE(ID3D12Device*, NativeHandleType::ID3D12Device);
|
40
|
+
SGL_NATIVE_HANDLE(ID3D12Resource*, NativeHandleType::ID3D12Resource);
|
41
|
+
SGL_NATIVE_HANDLE(ID3D12PipelineState*, NativeHandleType::ID3D12PipelineState);
|
42
|
+
SGL_NATIVE_HANDLE(ID3D12Fence*, NativeHandleType::ID3D12Fence);
|
43
|
+
SGL_NATIVE_HANDLE(ID3D12CommandQueue*, NativeHandleType::ID3D12CommandQueue);
|
44
|
+
SGL_NATIVE_HANDLE(ID3D12GraphicsCommandList*, NativeHandleType::ID3D12GraphicsCommandList);
|
45
|
+
SGL_NATIVE_HANDLE(D3D12_CPU_DESCRIPTOR_HANDLE, NativeHandleType::D3D12_CPU_DESCRIPTOR_HANDLE);
|
46
|
+
#endif // SGL_HAS_D3D12
|
47
|
+
|
48
|
+
#if SGL_HAS_VULKAN
|
49
|
+
SGL_NATIVE_HANDLE(VkInstance, NativeHandleType::VkInstance);
|
50
|
+
SGL_NATIVE_HANDLE(VkPhysicalDevice, NativeHandleType::VkPhysicalDevice);
|
51
|
+
SGL_NATIVE_HANDLE(VkDevice, NativeHandleType::VkDevice);
|
52
|
+
SGL_NATIVE_HANDLE(VkImage, NativeHandleType::VkImage);
|
53
|
+
SGL_NATIVE_HANDLE(VkImageView, NativeHandleType::VkImageView);
|
54
|
+
SGL_NATIVE_HANDLE(VkBuffer, NativeHandleType::VkBuffer);
|
55
|
+
SGL_NATIVE_HANDLE(VkBufferView, NativeHandleType::VkBufferView);
|
56
|
+
SGL_NATIVE_HANDLE(VkPipeline, NativeHandleType::VkPipeline);
|
57
|
+
SGL_NATIVE_HANDLE(VkFence, NativeHandleType::VkFence);
|
58
|
+
SGL_NATIVE_HANDLE(VkQueue, NativeHandleType::VkQueue);
|
59
|
+
SGL_NATIVE_HANDLE(VkCommandBuffer, NativeHandleType::VkCommandBuffer);
|
60
|
+
SGL_NATIVE_HANDLE(VkSampler, NativeHandleType::VkSampler);
|
61
|
+
#endif // SGL_HAS_VULKAN
|
62
|
+
|
63
|
+
#undef SGL_NATIVE_HANDLE
|
64
|
+
|
65
|
+
} // namespace sgl
|
@@ -0,0 +1,138 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include "sgl/device/fwd.h"
|
6
|
+
#include "sgl/device/device_resource.h"
|
7
|
+
#include "sgl/device/types.h"
|
8
|
+
#include "sgl/device/native_handle.h"
|
9
|
+
|
10
|
+
#include "sgl/core/macros.h"
|
11
|
+
#include "sgl/core/enum.h"
|
12
|
+
#include "sgl/core/object.h"
|
13
|
+
|
14
|
+
#include "sgl/math/vector_types.h"
|
15
|
+
|
16
|
+
#include <slang-gfx.h>
|
17
|
+
|
18
|
+
#include <map>
|
19
|
+
#include <set>
|
20
|
+
|
21
|
+
namespace sgl {
|
22
|
+
|
23
|
+
|
24
|
+
/// Pipeline base class.
|
25
|
+
class SGL_API Pipeline : public DeviceResource {
|
26
|
+
SGL_OBJECT(Pipeline)
|
27
|
+
public:
|
28
|
+
Pipeline(ref<Device> device, ref<ShaderProgram> program);
|
29
|
+
virtual ~Pipeline();
|
30
|
+
|
31
|
+
gfx::IPipelineState* gfx_pipeline_state() const { return m_gfx_pipeline_state; }
|
32
|
+
|
33
|
+
/// Returns the native API handle:
|
34
|
+
/// - D3D12: ID3D12PipelineState*
|
35
|
+
/// - Vulkan: VkPipeline
|
36
|
+
NativeHandle get_native_handle() const;
|
37
|
+
|
38
|
+
void notify_program_reloaded();
|
39
|
+
|
40
|
+
protected:
|
41
|
+
virtual void recreate() = 0;
|
42
|
+
|
43
|
+
Slang::ComPtr<gfx::IPipelineState> m_gfx_pipeline_state;
|
44
|
+
|
45
|
+
private:
|
46
|
+
/// Pipelines store program (and thus maintain the ref count)
|
47
|
+
/// in their descriptor - this is just so we can register/unregister
|
48
|
+
/// the with program. However due to order of destruction
|
49
|
+
/// this still needs to hold a strong reference.
|
50
|
+
ref<ShaderProgram> m_program;
|
51
|
+
};
|
52
|
+
|
53
|
+
struct ComputePipelineDesc {
|
54
|
+
ref<ShaderProgram> program;
|
55
|
+
};
|
56
|
+
|
57
|
+
/// Compute pipeline.
|
58
|
+
class SGL_API ComputePipeline : public Pipeline {
|
59
|
+
public:
|
60
|
+
ComputePipeline(ref<Device> device, ComputePipelineDesc desc);
|
61
|
+
|
62
|
+
const ComputePipelineDesc& desc() const { return m_desc; }
|
63
|
+
|
64
|
+
/// Thread group size.
|
65
|
+
/// Used to determine the number of thread groups to dispatch.
|
66
|
+
uint3 thread_group_size() const { return m_thread_group_size; }
|
67
|
+
|
68
|
+
std::string to_string() const override;
|
69
|
+
|
70
|
+
protected:
|
71
|
+
virtual void recreate() override;
|
72
|
+
|
73
|
+
private:
|
74
|
+
ComputePipelineDesc m_desc;
|
75
|
+
uint3 m_thread_group_size;
|
76
|
+
};
|
77
|
+
|
78
|
+
struct GraphicsPipelineDesc {
|
79
|
+
ref<ShaderProgram> program;
|
80
|
+
ref<InputLayout> input_layout;
|
81
|
+
ref<FramebufferLayout> framebuffer_layout;
|
82
|
+
PrimitiveType primitive_type{PrimitiveType::triangle};
|
83
|
+
DepthStencilDesc depth_stencil;
|
84
|
+
RasterizerDesc rasterizer;
|
85
|
+
BlendDesc blend;
|
86
|
+
};
|
87
|
+
|
88
|
+
/// Graphics pipeline.
|
89
|
+
class SGL_API GraphicsPipeline : public Pipeline {
|
90
|
+
public:
|
91
|
+
GraphicsPipeline(ref<Device> device, GraphicsPipelineDesc desc);
|
92
|
+
|
93
|
+
std::string to_string() const override;
|
94
|
+
const GraphicsPipelineDesc& desc() const { return m_desc; }
|
95
|
+
|
96
|
+
protected:
|
97
|
+
virtual void recreate() override;
|
98
|
+
|
99
|
+
private:
|
100
|
+
GraphicsPipelineDesc m_desc;
|
101
|
+
|
102
|
+
// These are stored to ensure the layouts aren't freed when pipeline
|
103
|
+
// relies on them if it needs to be recreated for hot reload.
|
104
|
+
ref<const InputLayout> m_stored_input_layout;
|
105
|
+
ref<const FramebufferLayout> m_stored_framebuffer_layout;
|
106
|
+
};
|
107
|
+
|
108
|
+
struct HitGroupDesc {
|
109
|
+
std::string hit_group_name;
|
110
|
+
std::string closest_hit_entry_point;
|
111
|
+
std::string any_hit_entry_point;
|
112
|
+
std::string intersection_entry_point;
|
113
|
+
};
|
114
|
+
|
115
|
+
struct RayTracingPipelineDesc {
|
116
|
+
ref<ShaderProgram> program;
|
117
|
+
std::vector<HitGroupDesc> hit_groups;
|
118
|
+
uint32_t max_recursion{0};
|
119
|
+
uint32_t max_ray_payload_size{0};
|
120
|
+
uint32_t max_attribute_size{8};
|
121
|
+
RayTracingPipelineFlags flags{RayTracingPipelineFlags::none};
|
122
|
+
};
|
123
|
+
|
124
|
+
/// Ray tracing pipeline.
|
125
|
+
class SGL_API RayTracingPipeline : public Pipeline {
|
126
|
+
public:
|
127
|
+
RayTracingPipeline(ref<Device> device, RayTracingPipelineDesc desc);
|
128
|
+
|
129
|
+
std::string to_string() const override;
|
130
|
+
|
131
|
+
protected:
|
132
|
+
virtual void recreate() override;
|
133
|
+
|
134
|
+
private:
|
135
|
+
RayTracingPipelineDesc m_desc;
|
136
|
+
};
|
137
|
+
|
138
|
+
} // namespace sgl
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include "sgl/device/fwd.h"
|
6
|
+
#include "sgl/device/shader_cursor.h"
|
7
|
+
|
8
|
+
#include <map>
|
9
|
+
#include <string>
|
10
|
+
|
11
|
+
namespace sgl {
|
12
|
+
|
13
|
+
/**
|
14
|
+
* \brief Debug printer.
|
15
|
+
*
|
16
|
+
* This class implements host-side support for shader debug printing.
|
17
|
+
*/
|
18
|
+
class DebugPrinter {
|
19
|
+
public:
|
20
|
+
DebugPrinter(Device* device, size_t buffer_size = 4 * 1024 * 1024);
|
21
|
+
|
22
|
+
/// Add a map of hashed strings to the printer.
|
23
|
+
/// This needs to be called for any shader that uses debug printing.
|
24
|
+
void add_hashed_strings(const std::map<uint32_t, std::string>& hashed_strings);
|
25
|
+
|
26
|
+
/// Flush the print buffer and output any messages to stdout.
|
27
|
+
void flush();
|
28
|
+
|
29
|
+
/// Flush the print buffer and output any messages as a string.
|
30
|
+
std::string flush_to_string();
|
31
|
+
|
32
|
+
void bind(ShaderCursor cursor);
|
33
|
+
|
34
|
+
private:
|
35
|
+
void flush_device(bool wait);
|
36
|
+
|
37
|
+
Device* m_device;
|
38
|
+
|
39
|
+
ref<Buffer> m_buffer;
|
40
|
+
ref<Buffer> m_readback_buffer;
|
41
|
+
|
42
|
+
std::map<uint32_t, std::string> m_hashed_strings;
|
43
|
+
};
|
44
|
+
|
45
|
+
} // namespace sgl
|