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.
Files changed (133) hide show
  1. include/tevclient.h +393 -0
  2. nv_sgl-0.6.0.dist-info/LICENSE +29 -0
  3. nv_sgl-0.6.0.dist-info/METADATA +21 -0
  4. nv_sgl-0.6.0.dist-info/RECORD +133 -0
  5. nv_sgl-0.6.0.dist-info/WHEEL +6 -0
  6. nv_sgl-0.6.0.dist-info/top_level.txt +1 -0
  7. sgl/__init__.py +15 -0
  8. sgl/__init__.pyi +6738 -0
  9. sgl/include/sgl/app/app.h +113 -0
  10. sgl/include/sgl/core/bitmap.h +302 -0
  11. sgl/include/sgl/core/crypto.h +89 -0
  12. sgl/include/sgl/core/data_type.h +46 -0
  13. sgl/include/sgl/core/dds_file.h +103 -0
  14. sgl/include/sgl/core/enum.h +201 -0
  15. sgl/include/sgl/core/error.h +161 -0
  16. sgl/include/sgl/core/file_stream.h +77 -0
  17. sgl/include/sgl/core/file_system_watcher.h +141 -0
  18. sgl/include/sgl/core/format.h +36 -0
  19. sgl/include/sgl/core/fwd.h +90 -0
  20. sgl/include/sgl/core/hash.h +45 -0
  21. sgl/include/sgl/core/input.h +522 -0
  22. sgl/include/sgl/core/logger.h +214 -0
  23. sgl/include/sgl/core/macros.h +184 -0
  24. sgl/include/sgl/core/maths.h +45 -0
  25. sgl/include/sgl/core/memory_mapped_file.h +112 -0
  26. sgl/include/sgl/core/memory_mapped_file_stream.h +32 -0
  27. sgl/include/sgl/core/memory_stream.h +74 -0
  28. sgl/include/sgl/core/object.h +683 -0
  29. sgl/include/sgl/core/platform.h +239 -0
  30. sgl/include/sgl/core/plugin.h +331 -0
  31. sgl/include/sgl/core/resolver.h +39 -0
  32. sgl/include/sgl/core/short_vector.h +141 -0
  33. sgl/include/sgl/core/static_vector.h +111 -0
  34. sgl/include/sgl/core/stream.h +54 -0
  35. sgl/include/sgl/core/string.h +276 -0
  36. sgl/include/sgl/core/struct.h +360 -0
  37. sgl/include/sgl/core/thread.h +28 -0
  38. sgl/include/sgl/core/timer.h +52 -0
  39. sgl/include/sgl/core/traits.h +15 -0
  40. sgl/include/sgl/core/type_utils.h +19 -0
  41. sgl/include/sgl/core/window.h +177 -0
  42. sgl/include/sgl/device/agility_sdk.h +24 -0
  43. sgl/include/sgl/device/blit.h +88 -0
  44. sgl/include/sgl/device/buffer_cursor.h +162 -0
  45. sgl/include/sgl/device/command.h +539 -0
  46. sgl/include/sgl/device/cuda_api.h +766 -0
  47. sgl/include/sgl/device/cuda_interop.h +39 -0
  48. sgl/include/sgl/device/cuda_utils.h +107 -0
  49. sgl/include/sgl/device/cursor_utils.h +129 -0
  50. sgl/include/sgl/device/device.h +668 -0
  51. sgl/include/sgl/device/device_resource.h +37 -0
  52. sgl/include/sgl/device/fence.h +91 -0
  53. sgl/include/sgl/device/formats.h +330 -0
  54. sgl/include/sgl/device/framebuffer.h +85 -0
  55. sgl/include/sgl/device/fwd.h +164 -0
  56. sgl/include/sgl/device/helpers.h +20 -0
  57. sgl/include/sgl/device/hot_reload.h +75 -0
  58. sgl/include/sgl/device/input_layout.h +74 -0
  59. sgl/include/sgl/device/kernel.h +69 -0
  60. sgl/include/sgl/device/memory_heap.h +155 -0
  61. sgl/include/sgl/device/native_formats.h +342 -0
  62. sgl/include/sgl/device/native_handle.h +73 -0
  63. sgl/include/sgl/device/native_handle_traits.h +65 -0
  64. sgl/include/sgl/device/pipeline.h +138 -0
  65. sgl/include/sgl/device/print.h +45 -0
  66. sgl/include/sgl/device/python/cursor_utils.h +853 -0
  67. sgl/include/sgl/device/query.h +52 -0
  68. sgl/include/sgl/device/raytracing.h +84 -0
  69. sgl/include/sgl/device/reflection.h +1254 -0
  70. sgl/include/sgl/device/resource.h +705 -0
  71. sgl/include/sgl/device/sampler.h +57 -0
  72. sgl/include/sgl/device/shader.h +516 -0
  73. sgl/include/sgl/device/shader_cursor.h +85 -0
  74. sgl/include/sgl/device/shader_object.h +94 -0
  75. sgl/include/sgl/device/shader_offset.h +67 -0
  76. sgl/include/sgl/device/shared_handle.h +12 -0
  77. sgl/include/sgl/device/slang_utils.h +54 -0
  78. sgl/include/sgl/device/swapchain.h +74 -0
  79. sgl/include/sgl/device/types.h +782 -0
  80. sgl/include/sgl/math/colorspace.h +56 -0
  81. sgl/include/sgl/math/constants.h +7 -0
  82. sgl/include/sgl/math/float16.h +146 -0
  83. sgl/include/sgl/math/matrix.h +6 -0
  84. sgl/include/sgl/math/matrix_math.h +746 -0
  85. sgl/include/sgl/math/matrix_types.h +207 -0
  86. sgl/include/sgl/math/python/primitivetype.h +33 -0
  87. sgl/include/sgl/math/quaternion.h +6 -0
  88. sgl/include/sgl/math/quaternion_math.h +484 -0
  89. sgl/include/sgl/math/quaternion_types.h +83 -0
  90. sgl/include/sgl/math/ray.h +47 -0
  91. sgl/include/sgl/math/scalar_math.h +249 -0
  92. sgl/include/sgl/math/scalar_types.h +107 -0
  93. sgl/include/sgl/math/vector.h +6 -0
  94. sgl/include/sgl/math/vector_math.h +1796 -0
  95. sgl/include/sgl/math/vector_types.h +336 -0
  96. sgl/include/sgl/python/nanobind.h +489 -0
  97. sgl/include/sgl/python/py_doc.h +11600 -0
  98. sgl/include/sgl/python/sgl_ext_pch.h +8 -0
  99. sgl/include/sgl/sgl.h +21 -0
  100. sgl/include/sgl/sgl_pch.h +6 -0
  101. sgl/include/sgl/stl/bit.h +377 -0
  102. sgl/include/sgl/tests/testing.h +54 -0
  103. sgl/include/sgl/ui/fwd.h +34 -0
  104. sgl/include/sgl/ui/imgui_config.h +43 -0
  105. sgl/include/sgl/ui/ui.h +71 -0
  106. sgl/include/sgl/ui/widgets.h +918 -0
  107. sgl/include/sgl/utils/python/slangpy.h +366 -0
  108. sgl/include/sgl/utils/renderdoc.h +50 -0
  109. sgl/include/sgl/utils/slangpy.h +153 -0
  110. sgl/include/sgl/utils/tev.h +93 -0
  111. sgl/include/sgl/utils/texture_loader.h +106 -0
  112. sgl/libgfx.so +0 -0
  113. sgl/libsgl.so +0 -0
  114. sgl/libslang-glslang.so +0 -0
  115. sgl/libslang.so +0 -0
  116. sgl/libtevclient.a +0 -0
  117. sgl/math/__init__.pyi +5083 -0
  118. sgl/platform/__init__.pyi +102 -0
  119. sgl/renderdoc/__init__.pyi +51 -0
  120. sgl/sgl_ext.cpython-313-x86_64-linux-gnu.so +0 -0
  121. sgl/shaders/sgl/device/blit.slang +93 -0
  122. sgl/shaders/sgl/device/nvapi.slang +5 -0
  123. sgl/shaders/sgl/device/nvapi.slangh +7 -0
  124. sgl/shaders/sgl/device/print.slang +445 -0
  125. sgl/shaders/sgl/math/constants.slang +4 -0
  126. sgl/shaders/sgl/math/ray.slang +29 -0
  127. sgl/shaders/sgl/ui/imgui.slang +49 -0
  128. sgl/slangpy/__init__.pyi +268 -0
  129. sgl/tev/__init__.pyi +108 -0
  130. sgl/thread/__init__.pyi +4 -0
  131. sgl/ui/__init__.pyi +1118 -0
  132. share/cmake/tevclient/tevclient-config-release.cmake +19 -0
  133. share/cmake/tevclient/tevclient-config.cmake +103 -0
@@ -0,0 +1,4 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+
3
+
4
+ static const float FLT_MAX = 3.402823466e+38f; // max value
@@ -0,0 +1,29 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+
3
+ import constants;
4
+
5
+ /**
6
+ * Ray type.
7
+ * This has equal layout to DXR RayDesc but adds additional functionality.
8
+ */
9
+ struct Ray {
10
+ float3 origin;
11
+ float t_min;
12
+ float3 dir;
13
+ float t_max;
14
+
15
+ /// Initializer.
16
+ __init(float3 origin, float3 dir, float t_min = 0.f, float t_max = FLT_MAX)
17
+ {
18
+ this.origin = origin;
19
+ this.dir = dir;
20
+ this.t_min = t_min;
21
+ this.t_max = t_max;
22
+ }
23
+
24
+ /// Convert to DXR RayDesc.
25
+ RayDesc to_ray_desc() { return { origin, t_min, dir, t_max }; }
26
+
27
+ /// Evaluate position on the ray at t.
28
+ float3 eval(float t) { return origin + t * dir; }
29
+ };
@@ -0,0 +1,49 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+
3
+ SamplerState sampler;
4
+ Texture2D texture;
5
+ uniform float2 scale;
6
+ uniform float2 offset;
7
+ uniform bool is_srgb_format;
8
+
9
+ struct VsIn {
10
+ float2 pos : POSITION;
11
+ float2 uv : TEXCOORD0;
12
+ float4 col : COLOR;
13
+ };
14
+
15
+ struct VsOut {
16
+ float4 col : COLOR;
17
+ float2 uv : TEXCOORD0;
18
+ float4 pos : SV_Position;
19
+ };
20
+
21
+ float srgb_to_linear(float srgb)
22
+ {
23
+ return srgb < 0.04045f ? srgb * (1.f / 12.92f) : pow((srgb + 0.055f) * (1.f / 1.055f), 2.4f);
24
+ }
25
+
26
+ float3 srgb_to_linear(float3 srgb)
27
+ {
28
+ return float3(srgb_to_linear(srgb.r), srgb_to_linear(srgb.g), srgb_to_linear(srgb.b));
29
+ }
30
+
31
+ [shader("vertex")]
32
+ VsOut vs_main(VsIn vs_in)
33
+ {
34
+ VsOut vs_out;
35
+ vs_out.col = vs_in.col;
36
+ vs_out.uv = vs_in.uv;
37
+ vs_out.pos = float4(vs_in.pos * scale + offset, 0.f, 1.f);
38
+ return vs_out;
39
+ }
40
+
41
+ [shader("fragment")]
42
+ float4 fs_main(VsOut vs_out)
43
+ : SV_Target
44
+ {
45
+ float4 col = vs_out.col * texture.Sample(sampler, vs_out.uv);
46
+ if (is_srgb_format)
47
+ col.rgb = srgb_to_linear(col.rgb);
48
+ return col;
49
+ }
@@ -0,0 +1,268 @@
1
+ from collections.abc import Callable, Mapping, Sequence
2
+ import enum
3
+
4
+ import sgl
5
+
6
+
7
+ class AccessType(enum.Enum):
8
+ none = 0
9
+
10
+ read = 1
11
+
12
+ write = 2
13
+
14
+ readwrite = 3
15
+
16
+ class CallContext(sgl.Object):
17
+ def __init__(self, device: sgl.Device, call_shape: Shape) -> None:
18
+ """N/A"""
19
+
20
+ @property
21
+ def device(self) -> sgl.Device:
22
+ """N/A"""
23
+
24
+ @property
25
+ def call_shape(self) -> Shape:
26
+ """N/A"""
27
+
28
+ class CallMode(enum.Enum):
29
+ prim = 0
30
+
31
+ bwds = 1
32
+
33
+ fwds = 2
34
+
35
+ class NativeBoundCallRuntime(sgl.Object):
36
+ def __init__(self) -> None:
37
+ """N/A"""
38
+
39
+ @property
40
+ def args(self) -> list[NativeBoundVariableRuntime]:
41
+ """N/A"""
42
+
43
+ @args.setter
44
+ def args(self, arg: Sequence[NativeBoundVariableRuntime], /) -> None: ...
45
+
46
+ @property
47
+ def kwargs(self) -> dict[str, NativeBoundVariableRuntime]:
48
+ """N/A"""
49
+
50
+ @kwargs.setter
51
+ def kwargs(self, arg: Mapping[str, NativeBoundVariableRuntime], /) -> None: ...
52
+
53
+ def find_kwarg(self, arg: str, /) -> NativeBoundVariableRuntime:
54
+ """N/A"""
55
+
56
+ def calculate_call_shape(self, arg0: int, arg1: list, arg2: dict, /) -> Shape:
57
+ """N/A"""
58
+
59
+ def write_calldata_pre_dispatch(self, arg0: CallContext, arg1: dict, arg2: list, arg3: dict, /) -> None:
60
+ """N/A"""
61
+
62
+ def read_call_data_post_dispatch(self, arg0: CallContext, arg1: dict, arg2: list, arg3: dict, /) -> None:
63
+ """N/A"""
64
+
65
+ class NativeBoundVariableRuntime(sgl.Object):
66
+ def __init__(self) -> None:
67
+ """N/A"""
68
+
69
+ @property
70
+ def access(self) -> tuple[AccessType, AccessType]:
71
+ """N/A"""
72
+
73
+ @access.setter
74
+ def access(self, arg: tuple[AccessType, AccessType], /) -> None: ...
75
+
76
+ @property
77
+ def transform(self) -> Shape:
78
+ """N/A"""
79
+
80
+ @transform.setter
81
+ def transform(self, arg: Shape, /) -> None: ...
82
+
83
+ @property
84
+ def python_type(self) -> NativeType:
85
+ """N/A"""
86
+
87
+ @python_type.setter
88
+ def python_type(self, arg: NativeType, /) -> None: ...
89
+
90
+ @property
91
+ def shape(self) -> Shape:
92
+ """N/A"""
93
+
94
+ @shape.setter
95
+ def shape(self, arg: Shape, /) -> None: ...
96
+
97
+ @property
98
+ def variable_name(self) -> str:
99
+ """N/A"""
100
+
101
+ @variable_name.setter
102
+ def variable_name(self, arg: str, /) -> None: ...
103
+
104
+ @property
105
+ def children(self) -> dict[str, NativeBoundVariableRuntime] | None:
106
+ """N/A"""
107
+
108
+ @children.setter
109
+ def children(self, arg: Mapping[str, NativeBoundVariableRuntime], /) -> None: ...
110
+
111
+ def populate_call_shape(self, arg0: Sequence[int], arg1: object, /) -> None:
112
+ """N/A"""
113
+
114
+ def write_call_data_pre_dispatch(self, arg0: CallContext, arg1: dict, arg2: object, /) -> None:
115
+ """N/A"""
116
+
117
+ def read_call_data_post_dispatch(self, arg0: CallContext, arg1: dict, arg2: object, /) -> None:
118
+ """N/A"""
119
+
120
+ def read_output(self, arg0: CallContext, arg1: object, /) -> object:
121
+ """N/A"""
122
+
123
+ class NativeCallData(sgl.Object):
124
+ def __init__(self) -> None:
125
+ """N/A"""
126
+
127
+ @property
128
+ def device(self) -> sgl.Device:
129
+ """N/A"""
130
+
131
+ @device.setter
132
+ def device(self, arg: sgl.Device, /) -> None: ...
133
+
134
+ @property
135
+ def kernel(self) -> sgl.ComputeKernel:
136
+ """N/A"""
137
+
138
+ @kernel.setter
139
+ def kernel(self, arg: sgl.ComputeKernel, /) -> None: ...
140
+
141
+ @property
142
+ def call_dimensionality(self) -> int:
143
+ """N/A"""
144
+
145
+ @call_dimensionality.setter
146
+ def call_dimensionality(self, arg: int, /) -> None: ...
147
+
148
+ @property
149
+ def runtime(self) -> NativeBoundCallRuntime:
150
+ """N/A"""
151
+
152
+ @runtime.setter
153
+ def runtime(self, arg: NativeBoundCallRuntime, /) -> None: ...
154
+
155
+ @property
156
+ def vars(self) -> dict:
157
+ """N/A"""
158
+
159
+ @vars.setter
160
+ def vars(self, arg: dict, /) -> None: ...
161
+
162
+ @property
163
+ def call_mode(self) -> CallMode:
164
+ """N/A"""
165
+
166
+ @call_mode.setter
167
+ def call_mode(self, arg: CallMode, /) -> None: ...
168
+
169
+ @property
170
+ def last_call_shape(self) -> Shape:
171
+ """N/A"""
172
+
173
+ def add_before_dispatch_hook(self, arg: Callable[[dict], None], /) -> None:
174
+ """N/A"""
175
+
176
+ def add_after_dispatch_hook(self, arg: Callable[[dict], None], /) -> None:
177
+ """N/A"""
178
+
179
+ def call(self, *args, **kwargs) -> object:
180
+ """N/A"""
181
+
182
+ def append_to(self, command_buffer: sgl.CommandBuffer, *args, **kwargs) -> object:
183
+ """N/A"""
184
+
185
+ class NativeType(sgl.Object):
186
+ def __init__(self) -> None:
187
+ """N/A"""
188
+
189
+ @property
190
+ def name(self) -> str:
191
+ """N/A"""
192
+
193
+ @name.setter
194
+ def name(self, arg: str, /) -> None: ...
195
+
196
+ @property
197
+ def element_type(self) -> NativeType:
198
+ """N/A"""
199
+
200
+ @element_type.setter
201
+ def element_type(self, arg: NativeType | None) -> None: ...
202
+
203
+ @property
204
+ def concrete_shape(self) -> Shape:
205
+ """N/A"""
206
+
207
+ @concrete_shape.setter
208
+ def concrete_shape(self, arg: Shape, /) -> None: ...
209
+
210
+ def get_byte_size(self, arg: object, /) -> int:
211
+ """N/A"""
212
+
213
+ def get_container_shape(self, arg: object, /) -> Shape:
214
+ """N/A"""
215
+
216
+ def get_shape(self, value: object | None = None) -> Shape:
217
+ """N/A"""
218
+
219
+ def create_calldata(self, arg0: CallContext, arg1: NativeBoundVariableRuntime, arg2: object, /) -> object:
220
+ """N/A"""
221
+
222
+ def read_calldata(self, arg0: CallContext, arg1: NativeBoundVariableRuntime, arg2: object, arg3: object, /) -> None:
223
+ """N/A"""
224
+
225
+ def create_output(self, arg0: CallContext, arg1: NativeBoundVariableRuntime, /) -> object:
226
+ """N/A"""
227
+
228
+ def read_output(self, arg0: CallContext, arg1: NativeBoundVariableRuntime, arg2: object, /) -> object:
229
+ """N/A"""
230
+
231
+ class Shape:
232
+ def __init__(self, *args) -> None:
233
+ """N/A"""
234
+
235
+ def __add__(self, arg: Shape, /) -> Shape:
236
+ """N/A"""
237
+
238
+ def __getitem__(self, index: int) -> int:
239
+ """N/A"""
240
+
241
+ def __len__(self) -> int:
242
+ """N/A"""
243
+
244
+ @property
245
+ def valid(self) -> bool:
246
+ """N/A"""
247
+
248
+ @property
249
+ def concrete(self) -> bool:
250
+ """N/A"""
251
+
252
+ def as_tuple(self) -> tuple:
253
+ """N/A"""
254
+
255
+ def as_list(self) -> list[int]:
256
+ """N/A"""
257
+
258
+ def __repr__(self) -> str:
259
+ """N/A"""
260
+
261
+ def __str__(self) -> str:
262
+ """N/A"""
263
+
264
+ def __eq__(self, arg: object, /) -> bool:
265
+ """N/A"""
266
+
267
+ def hash_signature(value_to_id: Callable[[object], str], *args, **kwargs) -> str:
268
+ """N/A"""
sgl/tev/__init__.pyi ADDED
@@ -0,0 +1,108 @@
1
+ from typing import overload
2
+
3
+ import sgl
4
+
5
+
6
+ @overload
7
+ def show(bitmap: sgl.Bitmap, name: str = '', host: str = '127.0.0.1', port: int = 14158, max_retries: int = 3) -> bool:
8
+ """
9
+ Show a bitmap in the tev viewer (https://github.com/Tom94/tev).
10
+
11
+ This will block until the image is sent over.
12
+
13
+ Parameter ``bitmap``:
14
+ Bitmap to show.
15
+
16
+ Parameter ``name``:
17
+ Name of the image in tev. If not specified, a unique name will be
18
+ generated.
19
+
20
+ Parameter ``host``:
21
+ Host to connect to.
22
+
23
+ Parameter ``port``:
24
+ Port to connect to.
25
+
26
+ Parameter ``max_retries``:
27
+ Maximum number of retries.
28
+
29
+ Returns:
30
+ True if successful.
31
+ """
32
+
33
+ @overload
34
+ def show(texture: sgl.Texture, name: str = '', host: str = '127.0.0.1', port: int = 14158, max_retries: int = 3) -> bool:
35
+ """
36
+ Show texture in the tev viewer (https://github.com/Tom94/tev).
37
+
38
+ This will block until the image is sent over.
39
+
40
+ Parameter ``texture``:
41
+ Texture to show.
42
+
43
+ Parameter ``name``:
44
+ Name of the image in tev. If not specified, a unique name will be
45
+ generated.
46
+
47
+ Parameter ``host``:
48
+ Host to connect to.
49
+
50
+ Parameter ``port``:
51
+ Port to connect to.
52
+
53
+ Parameter ``max_retries``:
54
+ Maximum number of retries.
55
+
56
+ Returns:
57
+ True if successful.
58
+ """
59
+
60
+ @overload
61
+ def show_async(bitmap: sgl.Bitmap, name: str = '', host: str = '127.0.0.1', port: int = 14158, max_retries: int = 3) -> None:
62
+ """
63
+ Show a bitmap in the tev viewer (https://github.com/Tom94/tev).
64
+
65
+ This will return immediately and send the image asynchronously in the
66
+ background.
67
+
68
+ Parameter ``bitmap``:
69
+ Bitmap to show.
70
+
71
+ Parameter ``name``:
72
+ Name of the image in tev. If not specified, a unique name will be
73
+ generated.
74
+
75
+ Parameter ``host``:
76
+ Host to connect to.
77
+
78
+ Parameter ``port``:
79
+ Port to connect to.
80
+
81
+ Parameter ``max_retries``:
82
+ Maximum number of retries.
83
+ """
84
+
85
+ @overload
86
+ def show_async(texture: sgl.Texture, name: str = '', host: str = '127.0.0.1', port: int = 14158, max_retries: int = 3) -> None:
87
+ """
88
+ Show a texture in the tev viewer (https://github.com/Tom94/tev).
89
+
90
+ This will return immediately and send the image asynchronously in the
91
+ background.
92
+
93
+ Parameter ``bitmap``:
94
+ Texture to show.
95
+
96
+ Parameter ``name``:
97
+ Name of the image in tev. If not specified, a unique name will be
98
+ generated.
99
+
100
+ Parameter ``host``:
101
+ Host to connect to.
102
+
103
+ Parameter ``port``:
104
+ Port to connect to.
105
+
106
+ Parameter ``max_retries``:
107
+ Maximum number of retries.
108
+ """
@@ -0,0 +1,4 @@
1
+
2
+
3
+ def wait_for_tasks() -> None:
4
+ """Block until all scheduled tasks are completed."""