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.
Files changed (142) 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 +142 -0
  5. nv_sgl-0.6.0.dist-info/WHEEL +5 -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/d3d12/D3D12Core.dll +0 -0
  10. sgl/d3d12/d3d12SDKLayers.dll +0 -0
  11. sgl/dxcompiler.dll +0 -0
  12. sgl/dxil.dll +0 -0
  13. sgl/gfx.dll +0 -0
  14. sgl/include/sgl/app/app.h +113 -0
  15. sgl/include/sgl/core/bitmap.h +302 -0
  16. sgl/include/sgl/core/crypto.h +89 -0
  17. sgl/include/sgl/core/data_type.h +46 -0
  18. sgl/include/sgl/core/dds_file.h +103 -0
  19. sgl/include/sgl/core/enum.h +201 -0
  20. sgl/include/sgl/core/error.h +161 -0
  21. sgl/include/sgl/core/file_stream.h +77 -0
  22. sgl/include/sgl/core/file_system_watcher.h +141 -0
  23. sgl/include/sgl/core/format.h +36 -0
  24. sgl/include/sgl/core/fwd.h +90 -0
  25. sgl/include/sgl/core/hash.h +45 -0
  26. sgl/include/sgl/core/input.h +522 -0
  27. sgl/include/sgl/core/logger.h +214 -0
  28. sgl/include/sgl/core/macros.h +184 -0
  29. sgl/include/sgl/core/maths.h +45 -0
  30. sgl/include/sgl/core/memory_mapped_file.h +112 -0
  31. sgl/include/sgl/core/memory_mapped_file_stream.h +32 -0
  32. sgl/include/sgl/core/memory_stream.h +74 -0
  33. sgl/include/sgl/core/object.h +683 -0
  34. sgl/include/sgl/core/platform.h +239 -0
  35. sgl/include/sgl/core/plugin.h +331 -0
  36. sgl/include/sgl/core/resolver.h +39 -0
  37. sgl/include/sgl/core/short_vector.h +141 -0
  38. sgl/include/sgl/core/static_vector.h +111 -0
  39. sgl/include/sgl/core/stream.h +54 -0
  40. sgl/include/sgl/core/string.h +276 -0
  41. sgl/include/sgl/core/struct.h +360 -0
  42. sgl/include/sgl/core/thread.h +28 -0
  43. sgl/include/sgl/core/timer.h +52 -0
  44. sgl/include/sgl/core/traits.h +15 -0
  45. sgl/include/sgl/core/type_utils.h +19 -0
  46. sgl/include/sgl/core/window.h +177 -0
  47. sgl/include/sgl/device/agility_sdk.h +24 -0
  48. sgl/include/sgl/device/blit.h +88 -0
  49. sgl/include/sgl/device/buffer_cursor.h +162 -0
  50. sgl/include/sgl/device/command.h +539 -0
  51. sgl/include/sgl/device/cuda_api.h +766 -0
  52. sgl/include/sgl/device/cuda_interop.h +39 -0
  53. sgl/include/sgl/device/cuda_utils.h +107 -0
  54. sgl/include/sgl/device/cursor_utils.h +129 -0
  55. sgl/include/sgl/device/device.h +668 -0
  56. sgl/include/sgl/device/device_resource.h +37 -0
  57. sgl/include/sgl/device/fence.h +91 -0
  58. sgl/include/sgl/device/formats.h +330 -0
  59. sgl/include/sgl/device/framebuffer.h +85 -0
  60. sgl/include/sgl/device/fwd.h +164 -0
  61. sgl/include/sgl/device/helpers.h +20 -0
  62. sgl/include/sgl/device/hot_reload.h +75 -0
  63. sgl/include/sgl/device/input_layout.h +74 -0
  64. sgl/include/sgl/device/kernel.h +69 -0
  65. sgl/include/sgl/device/memory_heap.h +155 -0
  66. sgl/include/sgl/device/native_formats.h +342 -0
  67. sgl/include/sgl/device/native_handle.h +73 -0
  68. sgl/include/sgl/device/native_handle_traits.h +65 -0
  69. sgl/include/sgl/device/pipeline.h +138 -0
  70. sgl/include/sgl/device/print.h +45 -0
  71. sgl/include/sgl/device/python/cursor_utils.h +853 -0
  72. sgl/include/sgl/device/query.h +52 -0
  73. sgl/include/sgl/device/raytracing.h +84 -0
  74. sgl/include/sgl/device/reflection.h +1254 -0
  75. sgl/include/sgl/device/resource.h +705 -0
  76. sgl/include/sgl/device/sampler.h +57 -0
  77. sgl/include/sgl/device/shader.h +516 -0
  78. sgl/include/sgl/device/shader_cursor.h +85 -0
  79. sgl/include/sgl/device/shader_object.h +94 -0
  80. sgl/include/sgl/device/shader_offset.h +67 -0
  81. sgl/include/sgl/device/shared_handle.h +12 -0
  82. sgl/include/sgl/device/slang_utils.h +54 -0
  83. sgl/include/sgl/device/swapchain.h +74 -0
  84. sgl/include/sgl/device/types.h +782 -0
  85. sgl/include/sgl/math/colorspace.h +56 -0
  86. sgl/include/sgl/math/constants.h +7 -0
  87. sgl/include/sgl/math/float16.h +146 -0
  88. sgl/include/sgl/math/matrix.h +6 -0
  89. sgl/include/sgl/math/matrix_math.h +746 -0
  90. sgl/include/sgl/math/matrix_types.h +207 -0
  91. sgl/include/sgl/math/python/primitivetype.h +33 -0
  92. sgl/include/sgl/math/quaternion.h +6 -0
  93. sgl/include/sgl/math/quaternion_math.h +484 -0
  94. sgl/include/sgl/math/quaternion_types.h +83 -0
  95. sgl/include/sgl/math/ray.h +47 -0
  96. sgl/include/sgl/math/scalar_math.h +249 -0
  97. sgl/include/sgl/math/scalar_types.h +107 -0
  98. sgl/include/sgl/math/vector.h +6 -0
  99. sgl/include/sgl/math/vector_math.h +1796 -0
  100. sgl/include/sgl/math/vector_types.h +336 -0
  101. sgl/include/sgl/python/nanobind.h +489 -0
  102. sgl/include/sgl/python/py_doc.h +11600 -0
  103. sgl/include/sgl/python/sgl_ext_pch.h +8 -0
  104. sgl/include/sgl/sgl.h +21 -0
  105. sgl/include/sgl/sgl_pch.h +6 -0
  106. sgl/include/sgl/stl/bit.h +377 -0
  107. sgl/include/sgl/tests/testing.h +54 -0
  108. sgl/include/sgl/ui/fwd.h +34 -0
  109. sgl/include/sgl/ui/imgui_config.h +43 -0
  110. sgl/include/sgl/ui/ui.h +71 -0
  111. sgl/include/sgl/ui/widgets.h +918 -0
  112. sgl/include/sgl/utils/python/slangpy.h +366 -0
  113. sgl/include/sgl/utils/renderdoc.h +50 -0
  114. sgl/include/sgl/utils/slangpy.h +153 -0
  115. sgl/include/sgl/utils/tev.h +93 -0
  116. sgl/include/sgl/utils/texture_loader.h +106 -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.dll +0 -0
  121. sgl/sgl_ext.cp313-win_amd64.pyd +0 -0
  122. sgl/shaders/nvapi/nvHLSLExtns.h +2315 -0
  123. sgl/shaders/nvapi/nvHLSLExtnsInternal.h +758 -0
  124. sgl/shaders/nvapi/nvShaderExtnEnums.h +142 -0
  125. sgl/shaders/sgl/device/blit.slang +93 -0
  126. sgl/shaders/sgl/device/nvapi.slang +5 -0
  127. sgl/shaders/sgl/device/nvapi.slangh +7 -0
  128. sgl/shaders/sgl/device/print.slang +445 -0
  129. sgl/shaders/sgl/math/constants.slang +4 -0
  130. sgl/shaders/sgl/math/ray.slang +29 -0
  131. sgl/shaders/sgl/ui/imgui.slang +49 -0
  132. sgl/slang-glslang.dll +0 -0
  133. sgl/slang-llvm.dll +0 -0
  134. sgl/slang-rt.dll +0 -0
  135. sgl/slang.dll +0 -0
  136. sgl/slangpy/__init__.pyi +268 -0
  137. sgl/tev/__init__.pyi +108 -0
  138. sgl/tevclient.lib +0 -0
  139. sgl/thread/__init__.pyi +4 -0
  140. sgl/ui/__init__.pyi +1118 -0
  141. share/cmake/tevclient/tevclient-config-release.cmake +19 -0
  142. share/cmake/tevclient/tevclient-config.cmake +108 -0
@@ -0,0 +1,39 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+
3
+ #pragma once
4
+
5
+ #include "sgl/core/object.h"
6
+
7
+ #include "sgl/device/fwd.h"
8
+
9
+ namespace sgl::cuda {
10
+
11
+ struct TensorView {
12
+ void* data;
13
+ size_t size;
14
+ size_t stride;
15
+ };
16
+
17
+ class InteropBuffer : public Object {
18
+ public:
19
+ InteropBuffer(sgl::Device* device, const TensorView tensor_view, bool is_uav);
20
+ ~InteropBuffer();
21
+
22
+ Buffer* buffer() const { return m_buffer; }
23
+ bool is_uav() const { return m_is_uav; }
24
+ ref<ResourceView> get_resource_view() const;
25
+
26
+ void copy_from_cuda(void* cuda_stream = 0);
27
+ void copy_to_cuda(void* cuda_stream = 0);
28
+
29
+ private:
30
+ sgl::Device* m_device;
31
+ TensorView m_tensor_view;
32
+ bool m_is_uav;
33
+ ref<sgl::Buffer> m_buffer;
34
+ ref<cuda::ExternalMemory> m_external_memory;
35
+ ref<sgl::ResourceView> m_srv;
36
+ ref<sgl::ResourceView> m_uav;
37
+ };
38
+
39
+ } // namespace sgl::cuda
@@ -0,0 +1,107 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+
3
+ #pragma once
4
+
5
+ #include "sgl/core/macros.h"
6
+
7
+ #include "sgl/device/fwd.h"
8
+ #include "sgl/device/fence.h"
9
+ #include "sgl/device/cuda_api.h"
10
+
11
+ #define SGL_CU_CHECK(call) \
12
+ do { \
13
+ CUresult result = call; \
14
+ if (result != CUDA_SUCCESS) { \
15
+ const char* errorName; \
16
+ cuGetErrorName(result, &errorName); \
17
+ const char* errorString; \
18
+ cuGetErrorString(result, &errorString); \
19
+ SGL_THROW("CUDA call {} failed with error {} ({}).", #call, errorName, errorString); \
20
+ } \
21
+ } while (0)
22
+
23
+ #define SGL_CU_SCOPE(device) sgl::cuda::ContextScope _context_scope(device)
24
+
25
+
26
+ namespace sgl::cuda {
27
+
28
+ SGL_API void* malloc_device(size_t size);
29
+ SGL_API void free_device(void* ptr);
30
+
31
+ SGL_API void memcpy_device_to_device(void* dst, const void* src, size_t count);
32
+ SGL_API void memcpy_host_to_device(void* dst, const void* src, size_t count);
33
+ SGL_API void memcpy_device_to_host(void* dst, const void* src, size_t count);
34
+
35
+ SGL_API void memset_device(void* dst, uint8_t value, size_t count);
36
+
37
+ SGL_API CUexternalMemory import_external_memory(const Buffer* buffer);
38
+ SGL_API void destroy_external_memory(CUexternalMemory ext_mem);
39
+ SGL_API void* external_memory_get_mapped_buffer(CUexternalMemory ext_mem, size_t offset, size_t size);
40
+
41
+ SGL_API CUexternalSemaphore import_external_semaphore(const Fence* fence);
42
+ SGL_API void destroy_external_semaphore(CUexternalSemaphore ext_sem);
43
+ SGL_API void signal_external_semaphore(CUexternalSemaphore ext_sem, uint64_t value, CUstream stream = 0);
44
+ SGL_API void wait_external_semaphore(CUexternalSemaphore ext_sem, uint64_t value, CUstream stream = 0);
45
+
46
+ /// Wraps a CUDA device, context and stream.
47
+ class SGL_API Device : public Object {
48
+ SGL_OBJECT(cuda::Device)
49
+ public:
50
+ /// Constructor.
51
+ /// Creates a CUDA device on the same adapter as the sgl device.
52
+ explicit Device(const sgl::Device* device);
53
+ ~Device();
54
+
55
+ CUdevice device() const { return m_device; }
56
+ CUcontext context() const { return m_context; }
57
+ CUstream stream() const { return m_stream; }
58
+
59
+ private:
60
+ CUdevice m_device;
61
+ CUcontext m_context;
62
+ CUstream m_stream;
63
+ };
64
+
65
+ /// Wraps an external memory resource.
66
+ class SGL_API ExternalMemory : public Object {
67
+ SGL_OBJECT(cuda::ExternalMemory)
68
+ public:
69
+ explicit ExternalMemory(const Buffer* buffer);
70
+ ~ExternalMemory();
71
+
72
+ size_t size() const { return m_size; }
73
+
74
+ void* mapped_data() const;
75
+
76
+ private:
77
+ /// Non-owning pointer to the resource.
78
+ const Resource* m_resource;
79
+ CUexternalMemory m_external_memory;
80
+ size_t m_size;
81
+ mutable void* m_mapped_data{nullptr};
82
+ };
83
+
84
+ /// Wraps an external semaphore.
85
+ class SGL_API ExternalSemaphore : public Object {
86
+ SGL_OBJECT(cuda::ExternalSemaphore)
87
+ public:
88
+ explicit ExternalSemaphore(Fence* fence);
89
+ ~ExternalSemaphore();
90
+
91
+ void signal(uint64_t value, CUstream stream = 0);
92
+ void wait(uint64_t value, CUstream stream = 0);
93
+
94
+ private:
95
+ /// Non-owning pointer to the fence.
96
+ Fence* m_fence;
97
+ CUexternalSemaphore m_external_semaphore;
98
+ };
99
+
100
+ class SGL_API ContextScope {
101
+ public:
102
+ explicit ContextScope(const Device* device);
103
+ explicit ContextScope(const sgl::Device* device);
104
+ ~ContextScope();
105
+ };
106
+
107
+ } // namespace sgl::cuda
@@ -0,0 +1,129 @@
1
+ #pragma once
2
+
3
+ #include "sgl/device/fwd.h"
4
+ #include "sgl/device/reflection.h"
5
+
6
+ namespace sgl {
7
+
8
+ namespace cursor_utils {
9
+ bool allow_scalar_conversion(TypeReflection::ScalarType from, TypeReflection::ScalarType to);
10
+
11
+ size_t get_scalar_type_size(TypeReflection::ScalarType type);
12
+
13
+ void check_array(
14
+ const TypeLayoutReflection* type_layout,
15
+ size_t size,
16
+ TypeReflection::ScalarType scalar_type,
17
+ size_t element_count
18
+ );
19
+
20
+ void check_scalar(const TypeLayoutReflection* type_layout, size_t size, TypeReflection::ScalarType scalar_type);
21
+
22
+ void check_vector(
23
+ const TypeLayoutReflection* type_layout,
24
+ size_t size,
25
+ TypeReflection::ScalarType scalar_type,
26
+ int dimension
27
+ );
28
+
29
+ void check_matrix(
30
+ const TypeLayoutReflection* type_layout,
31
+ size_t size,
32
+ TypeReflection::ScalarType scalar_type,
33
+ int rows,
34
+ int cols
35
+ );
36
+ } // namespace cursor_utils
37
+
38
+ /// Dummy type to represent traits of an arbitrary value type usable by cursors
39
+ struct _AnyCursorValue { };
40
+
41
+ /// Concept that defines the requirements for a cursor that can be traversed using
42
+ /// field names and element indices. Each traversal function should return a new
43
+ /// cursor object that represents the field or element.
44
+ template<typename T>
45
+ concept TraversableCursor = requires(T obj, std::string_view name_idx, uint32_t el_index) {
46
+ {
47
+ obj[name_idx]
48
+ } -> std::same_as<T>;
49
+ {
50
+ obj[el_index]
51
+ } -> std::same_as<T>;
52
+ {
53
+ obj.find_field(name_idx)
54
+ } -> std::same_as<T>;
55
+ {
56
+ obj.find_element(el_index)
57
+ } -> std::same_as<T>;
58
+ {
59
+ obj.has_field(name_idx)
60
+ } -> std::convertible_to<bool>;
61
+ {
62
+ obj.has_element(el_index)
63
+ } -> std::convertible_to<bool>;
64
+ {
65
+ obj.type_layout()
66
+ } -> std::convertible_to<ref<const TypeLayoutReflection>>;
67
+ {
68
+ obj.type()
69
+ } -> std::convertible_to<ref<const TypeReflection>>;
70
+ {
71
+ obj.is_valid()
72
+ } -> std::convertible_to<bool>;
73
+ };
74
+
75
+ /// Concept that defines the requirements for a cursor that can be read from.
76
+ template<typename T>
77
+ concept ReadableCursor = requires(
78
+ T obj,
79
+ void* data,
80
+ size_t size,
81
+ TypeReflection::ScalarType scalar_type,
82
+ size_t element_count,
83
+ _AnyCursorValue& val
84
+ ) {
85
+ {
86
+ obj.template get<_AnyCursorValue>(val)
87
+ } -> std::same_as<void>; // Ensure set() method exists
88
+ {
89
+ obj.template as<_AnyCursorValue>()
90
+ } -> std::same_as<_AnyCursorValue>;
91
+ {
92
+ obj._get_array(data, size, scalar_type, element_count)
93
+ } -> std::same_as<void>;
94
+ {
95
+ obj._get_scalar(data, size, scalar_type)
96
+ } -> std::same_as<void>;
97
+ {
98
+ obj._get_vector(data, size, scalar_type, 0)
99
+ } -> std::same_as<void>;
100
+ {
101
+ obj._get_matrix(data, size, scalar_type, 0, 0)
102
+ } -> std::same_as<void>;
103
+ };
104
+
105
+ /// Concept that defines the requirements for a cursor that can be written to.
106
+ template<typename T>
107
+ concept WritableCursor
108
+ = requires(T obj, void* data, size_t size, TypeReflection::ScalarType scalar_type, size_t element_count) {
109
+ {
110
+ obj.template set<_AnyCursorValue>({})
111
+ } -> std::same_as<void>;
112
+ {
113
+ obj.template operator=<_AnyCursorValue>({})
114
+ } -> std::same_as<void>;
115
+ {
116
+ obj._set_array(data, size, scalar_type, element_count)
117
+ } -> std::same_as<void>;
118
+ {
119
+ obj._set_scalar(data, size, scalar_type)
120
+ } -> std::same_as<void>;
121
+ {
122
+ obj._set_vector(data, size, scalar_type, 0)
123
+ } -> std::same_as<void>;
124
+ {
125
+ obj._set_matrix(data, size, scalar_type, 0, 0)
126
+ } -> std::same_as<void>;
127
+ };
128
+
129
+ } // namespace sgl