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,88 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+
3
+ #pragma once
4
+
5
+ #include "sgl/device/fwd.h"
6
+ #include "sgl/device/types.h"
7
+
8
+ #include "sgl/core/object.h"
9
+
10
+ #include "sgl/math/vector_types.h"
11
+
12
+ #include <map>
13
+
14
+ namespace sgl {
15
+
16
+ /**
17
+ * \brief Utility class for blitting textures and generating mipmaps.
18
+ *
19
+ * Because compute shaders have limited support for UAV texture formats,
20
+ * this class uses a graphics pipeline to blit a texture to a render target.
21
+ */
22
+ class Blitter : public Object {
23
+ SGL_OBJECT(Blitter)
24
+ public:
25
+ Blitter(Device* device);
26
+ ~Blitter();
27
+
28
+ /**
29
+ * \brief Blit a texture (SRV) to another texture (RTV).
30
+ *
31
+ * Blits the full extent of the source texture to the destination texture.
32
+ *
33
+ * \param command_buffer Command buffer.
34
+ * \param dst RTV of the destination texture.
35
+ * \param src SRV of the source texture.
36
+ * \param filter Filtering mode to use.
37
+ */
38
+ void blit(
39
+ CommandBuffer* command_buffer,
40
+ ResourceView* dst,
41
+ ResourceView* src,
42
+ TextureFilteringMode filter = TextureFilteringMode::linear
43
+ );
44
+
45
+ /**
46
+ * \brief Generate mipmaps for a texture.
47
+ *
48
+ * Repetatively blits the texture to a smaller mip level until the smallest mip level is reached.
49
+ * The texture needs to have mip levels pre-allocated and have usage flags for SRV and RTV.
50
+ * Supports both 2D and 2D array textures.
51
+ *
52
+ * \param command_buffer Command buffer.
53
+ * \param texture Texture to generate mipmaps for.
54
+ * \param array_layer Array layer to generate mipmaps for.
55
+ */
56
+ void generate_mips(CommandBuffer* command_buffer, Texture* texture, uint32_t array_layer = 0);
57
+
58
+ private:
59
+ enum class TextureType {
60
+ float_,
61
+ int_,
62
+ };
63
+
64
+ enum class TextureLayout {
65
+ texture_2d,
66
+ texture_2d_array,
67
+ };
68
+
69
+ struct ProgramKey {
70
+ TextureLayout src_layout;
71
+ TextureType src_type;
72
+ TextureType dst_type;
73
+
74
+ auto operator<=>(const ProgramKey&) const = default;
75
+ };
76
+
77
+ ref<ShaderProgram> get_program(ProgramKey key);
78
+ ref<GraphicsPipeline> get_pipeline(ProgramKey key, const Framebuffer* framebuffer);
79
+
80
+ Device* m_device;
81
+ ref<Sampler> m_linear_sampler;
82
+ ref<Sampler> m_point_sampler;
83
+
84
+ std::map<ProgramKey, ref<ShaderProgram>> m_program_cache;
85
+ std::map<std::pair<ProgramKey, FramebufferLayoutDesc>, ref<GraphicsPipeline>> m_pipeline_cache;
86
+ };
87
+
88
+ } // namespace sgl
@@ -0,0 +1,162 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+
3
+ #pragma once
4
+
5
+ #include "sgl/device/fwd.h"
6
+ #include "sgl/device/shader_offset.h"
7
+ #include "sgl/device/reflection.h"
8
+ #include "sgl/device/cursor_utils.h"
9
+
10
+ #include "sgl/core/config.h"
11
+ #include "sgl/core/macros.h"
12
+
13
+ #include <string_view>
14
+
15
+ namespace sgl {
16
+
17
+ /// Represents a single element of a given type in a block of memory, and
18
+ /// provides read/write tools to access its members via reflection.
19
+ class SGL_API BufferElementCursor {
20
+ public:
21
+ BufferElementCursor() = default;
22
+
23
+ /// Create with none-owning view of specific block of memory
24
+ BufferElementCursor(ref<TypeLayoutReflection> layout, ref<BufferCursor> owner);
25
+
26
+ ref<const TypeLayoutReflection> type_layout() const { return m_type_layout; }
27
+ ref<const TypeReflection> type() const { return m_type_layout->type(); }
28
+
29
+ size_t offset() const { return m_offset; }
30
+
31
+ bool is_valid() const { return m_buffer != nullptr; }
32
+
33
+ std::string to_string() const;
34
+
35
+ BufferElementCursor operator[](std::string_view name) const;
36
+ BufferElementCursor operator[](uint32_t index) const;
37
+
38
+ BufferElementCursor find_field(std::string_view name) const;
39
+ BufferElementCursor find_element(uint32_t index) const;
40
+
41
+ bool has_field(std::string_view name) const { return find_field(name).is_valid(); }
42
+ bool has_element(uint32_t index) const { return find_element(index).is_valid(); }
43
+
44
+ void set_data(const void* data, size_t size);
45
+
46
+ template<typename T>
47
+ void operator=(const T& value)
48
+ {
49
+ set(value);
50
+ }
51
+
52
+ template<typename T>
53
+ T as() const
54
+ {
55
+ T value;
56
+ get(value);
57
+ return value;
58
+ }
59
+
60
+ template<typename T>
61
+ void get(T& value) const;
62
+
63
+ template<typename T>
64
+ void set(const T& value);
65
+
66
+ void _set_array(const void* data, size_t size, TypeReflection::ScalarType scalar_type, size_t element_count);
67
+ void _set_scalar(const void* data, size_t size, TypeReflection::ScalarType scalar_type);
68
+ void _set_vector(const void* data, size_t size, TypeReflection::ScalarType scalar_type, int dimension);
69
+ void _set_matrix(const void* data, size_t size, TypeReflection::ScalarType scalar_type, int rows, int cols);
70
+
71
+ void _get_array(void* data, size_t size, TypeReflection::ScalarType scalar_type, size_t element_count) const;
72
+ void _get_scalar(void* data, size_t size, TypeReflection::ScalarType scalar_type) const;
73
+ void _get_vector(void* data, size_t size, TypeReflection::ScalarType scalar_type, int dimension) const;
74
+ void _get_matrix(void* data, size_t size, TypeReflection::ScalarType scalar_type, int rows, int cols) const;
75
+
76
+ private:
77
+ void write_data(size_t offset, const void* data, size_t size);
78
+ void read_data(size_t offset, void* data, size_t size) const;
79
+
80
+ ref<const TypeLayoutReflection> m_type_layout;
81
+ ref<BufferCursor> m_buffer;
82
+ size_t m_offset{0};
83
+
84
+ friend class BufferCursor;
85
+ };
86
+
87
+ /// Represents a list of elements in a block of memory, and provides
88
+ /// simple interface to get a BufferElementCursor for each one. As
89
+ /// this can be the owner of its data, it is a ref counted object that
90
+ /// elements refer to.
91
+ class SGL_API BufferCursor : Object {
92
+ public:
93
+ BufferCursor() = default;
94
+
95
+ /// Create with none-owning view of specific block of memory. Number of
96
+ /// elements is inferred from the size of the block and the type layout.
97
+ BufferCursor(ref<TypeLayoutReflection> element_layout, void* data, size_t size);
98
+
99
+ /// Create buffer + allocate space internally for a given number of elements.
100
+ BufferCursor(ref<TypeLayoutReflection> element_layout, size_t element_count);
101
+
102
+ /// Create as a view onto a buffer resource.
103
+ BufferCursor(ref<TypeLayoutReflection> element_layout, ref<Buffer> resource);
104
+
105
+ /// Create as a view onto a section of a buffer resource.
106
+ BufferCursor(ref<TypeLayoutReflection> element_layout, ref<Buffer> resource, size_t size, size_t offset);
107
+
108
+ ~BufferCursor();
109
+
110
+ /// Get type layout of an element of the cursor.
111
+ ref<const TypeLayoutReflection> element_type_layout() const { return m_element_type_layout; }
112
+
113
+ /// Get type of an element of the cursor.
114
+ ref<const TypeReflection> element_type() const { return m_element_type_layout->type(); }
115
+
116
+ /// Get element at a given index.
117
+ BufferElementCursor find_element(uint32_t index);
118
+
119
+ /// Index operator to get element at a given index.
120
+ BufferElementCursor operator[](uint32_t index) { return find_element(index); }
121
+
122
+ /// Number of elements in the buffer.
123
+ size_t element_count() const { return size() / element_stride(); }
124
+
125
+ /// Size of element.
126
+ size_t element_size() const { return m_element_type_layout->size(); }
127
+
128
+ /// Stride of elements.
129
+ size_t element_stride() const { return m_element_type_layout->stride(); }
130
+
131
+ /// Size of whole buffer.
132
+ size_t size() const { return m_size; }
133
+
134
+ /// Check if internal buffer exists.
135
+ bool is_loaded() const { return m_buffer != nullptr; }
136
+
137
+ /// Write data to buffer (note: writes only to host memory).
138
+ void write_data(size_t offset, const void* data, size_t size);
139
+
140
+ /// Reads data from buffer (note: reads only from host memory).
141
+ void read_data(size_t offset, void* data, size_t size) const;
142
+
143
+ /// In case of GPU only buffers, loads all data from GPU.
144
+ void load();
145
+
146
+ /// In case of GPU only buffers, pushes all data to the GPU.
147
+ void apply();
148
+
149
+ /// Get the resource this cursor represents (if any).
150
+ ref<Buffer> resource() const { return m_resource; }
151
+
152
+ private:
153
+ ref<const TypeLayoutReflection> m_element_type_layout;
154
+ ref<Buffer> m_resource;
155
+ uint8_t* m_buffer{nullptr};
156
+ size_t m_size{0};
157
+ bool m_owner{false};
158
+ DeviceOffset m_offset{0};
159
+ };
160
+
161
+
162
+ } // namespace sgl