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,94 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include "sgl/core/config.h"
|
6
|
+
#include "sgl/core/object.h"
|
7
|
+
#include "sgl/core/type_utils.h"
|
8
|
+
|
9
|
+
#include "sgl/device/fwd.h"
|
10
|
+
#include "sgl/device/shader_offset.h"
|
11
|
+
#include "sgl/device/resource.h"
|
12
|
+
|
13
|
+
#include <slang-gfx.h>
|
14
|
+
|
15
|
+
#include <string_view>
|
16
|
+
#include <vector>
|
17
|
+
#include <map>
|
18
|
+
|
19
|
+
namespace sgl {
|
20
|
+
|
21
|
+
class SGL_API ShaderObject : public Object {
|
22
|
+
SGL_OBJECT(ShaderObject)
|
23
|
+
public:
|
24
|
+
ShaderObject(ref<Device> device, gfx::IShaderObject* shader_object);
|
25
|
+
|
26
|
+
virtual ref<const TypeLayoutReflection> element_type_layout() const;
|
27
|
+
|
28
|
+
virtual uint32_t get_entry_point_count() const;
|
29
|
+
virtual ref<ShaderObject> get_entry_point(uint32_t index) = 0;
|
30
|
+
|
31
|
+
virtual ref<ShaderObject> get_object(const ShaderOffset& offset) = 0;
|
32
|
+
virtual void set_object(const ShaderOffset& offset, const ref<ShaderObject>& object);
|
33
|
+
|
34
|
+
virtual void set_resource(const ShaderOffset& offset, const ref<ResourceView>& resource_view);
|
35
|
+
virtual void set_sampler(const ShaderOffset& offset, const ref<Sampler>& sampler);
|
36
|
+
virtual void
|
37
|
+
set_acceleration_structure(const ShaderOffset& offset, const ref<AccelerationStructure>& acceleration_structure);
|
38
|
+
virtual void set_data(const ShaderOffset& offset, void const* data, size_t size);
|
39
|
+
|
40
|
+
virtual void set_cuda_tensor_view(const ShaderOffset& offset, const cuda::TensorView& tensor_view, bool is_uav);
|
41
|
+
virtual void get_cuda_interop_buffers(std::vector<ref<cuda::InteropBuffer>>& cuda_interop_buffers) const;
|
42
|
+
|
43
|
+
gfx::IShaderObject* gfx_shader_object() const { return m_shader_object; }
|
44
|
+
|
45
|
+
protected:
|
46
|
+
ref<Device> m_device;
|
47
|
+
gfx::IShaderObject* m_shader_object;
|
48
|
+
std::vector<ref<cuda::InteropBuffer>> m_cuda_interop_buffers;
|
49
|
+
};
|
50
|
+
|
51
|
+
class SGL_API TransientShaderObject : public ShaderObject {
|
52
|
+
SGL_OBJECT(TransientShaderObject)
|
53
|
+
public:
|
54
|
+
TransientShaderObject(ref<Device> device, gfx::IShaderObject* shader_object, CommandBuffer* command_buffer);
|
55
|
+
|
56
|
+
virtual ref<ShaderObject> get_entry_point(uint32_t index) override;
|
57
|
+
|
58
|
+
virtual ref<ShaderObject> get_object(const ShaderOffset& offset) override;
|
59
|
+
virtual void set_object(const ShaderOffset& offset, const ref<ShaderObject>& object) override;
|
60
|
+
|
61
|
+
virtual void set_resource(const ShaderOffset& offset, const ref<ResourceView>& resource_view) override;
|
62
|
+
|
63
|
+
virtual void get_cuda_interop_buffers(std::vector<ref<cuda::InteropBuffer>>& cuda_interop_buffers) const override;
|
64
|
+
|
65
|
+
private:
|
66
|
+
CommandBuffer* m_command_buffer;
|
67
|
+
std::vector<ref<TransientShaderObject>> m_sub_objects;
|
68
|
+
};
|
69
|
+
|
70
|
+
class SGL_API MutableShaderObject : public ShaderObject {
|
71
|
+
SGL_OBJECT(MutableShaderObject)
|
72
|
+
public:
|
73
|
+
MutableShaderObject(ref<Device> device, gfx::IShaderObject* shader_object);
|
74
|
+
MutableShaderObject(ref<Device> device, const ShaderProgram* shader_program);
|
75
|
+
MutableShaderObject(ref<Device> device, const TypeLayoutReflection* type_layout);
|
76
|
+
~MutableShaderObject();
|
77
|
+
|
78
|
+
virtual ref<ShaderObject> get_entry_point(uint32_t index) override;
|
79
|
+
|
80
|
+
virtual ref<ShaderObject> get_object(const ShaderOffset& offset) override;
|
81
|
+
virtual void set_object(const ShaderOffset& offset, const ref<ShaderObject>& object) override;
|
82
|
+
|
83
|
+
virtual void set_resource(const ShaderOffset& offset, const ref<ResourceView>& resource_view) override;
|
84
|
+
|
85
|
+
void set_resource_states(CommandBuffer* command_buffer) const;
|
86
|
+
|
87
|
+
virtual void get_cuda_interop_buffers(std::vector<ref<cuda::InteropBuffer>>& cuda_interop_buffers) const override;
|
88
|
+
|
89
|
+
private:
|
90
|
+
std::map<ShaderOffset, ref<ResourceView>> m_resource_views;
|
91
|
+
std::map<ShaderOffset, ref<MutableShaderObject>> m_sub_objects;
|
92
|
+
};
|
93
|
+
|
94
|
+
} // namespace sgl
|
@@ -0,0 +1,67 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include <cstdint>
|
6
|
+
#include <compare>
|
7
|
+
|
8
|
+
namespace sgl {
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Represents the offset of a shader variable relative to its enclosing type/buffer/block.
|
12
|
+
*
|
13
|
+
* A `ShaderOffset` can be used to store the offset of a shader variable that might use
|
14
|
+
* ordinary/uniform data, resources like textures/buffers/samplers, or some combination.
|
15
|
+
*
|
16
|
+
* A `ShaderOffset` can also encode an invalid offset, to indicate that a particular
|
17
|
+
* shader variable is not present.
|
18
|
+
*/
|
19
|
+
struct ShaderOffset {
|
20
|
+
uint32_t uniform_offset{INVALID};
|
21
|
+
uint32_t binding_range_index{INVALID};
|
22
|
+
uint32_t binding_array_index{INVALID};
|
23
|
+
|
24
|
+
/// Create an invalid offset.
|
25
|
+
static ShaderOffset invalid() { return {}; }
|
26
|
+
|
27
|
+
/// Create a zero offset.
|
28
|
+
static ShaderOffset zero() { return ShaderOffset(0, 0, 0); }
|
29
|
+
|
30
|
+
/// Default constructor. Creates an invalid offset.
|
31
|
+
ShaderOffset() = default;
|
32
|
+
|
33
|
+
/// Constructor.
|
34
|
+
ShaderOffset(uint32_t uniform_offset_, uint32_t binding_range_index_, uint32_t binding_array_index_)
|
35
|
+
: uniform_offset(uniform_offset_)
|
36
|
+
, binding_range_index(binding_range_index_)
|
37
|
+
, binding_array_index(binding_array_index_)
|
38
|
+
{
|
39
|
+
}
|
40
|
+
|
41
|
+
/// Check whether this offset is valid.
|
42
|
+
bool is_valid() const { return uniform_offset != INVALID; }
|
43
|
+
|
44
|
+
/// Adds another offset to this offset.
|
45
|
+
/// Returns an invalid offset if either offset is invalid.
|
46
|
+
ShaderOffset operator+(const ShaderOffset& other) const
|
47
|
+
{
|
48
|
+
if (is_valid() && other.is_valid()) {
|
49
|
+
return ShaderOffset(
|
50
|
+
uniform_offset + other.uniform_offset,
|
51
|
+
binding_range_index + other.binding_range_index,
|
52
|
+
binding_array_index + other.binding_array_index
|
53
|
+
);
|
54
|
+
} else {
|
55
|
+
return {};
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
/// Comparison.
|
60
|
+
auto operator<=>(const ShaderOffset&) const = default;
|
61
|
+
|
62
|
+
private:
|
63
|
+
/// Invalid offset value.
|
64
|
+
static constexpr uint32_t INVALID = uint32_t(-1);
|
65
|
+
};
|
66
|
+
|
67
|
+
} // namespace sgl
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#include <slang.h>
|
4
|
+
#include <slang-com-ptr.h>
|
5
|
+
|
6
|
+
#define SGL_CATCH_INTERNAL_SLANG_ERROR(expr) \
|
7
|
+
try { \
|
8
|
+
expr; \
|
9
|
+
} catch (...) { \
|
10
|
+
const char* slang_error = slang::getLastInternalErrorMessage(); \
|
11
|
+
throw sgl::SlangCompileError(fmt::format("Internal slang error: {}", slang_error)); \
|
12
|
+
}
|
13
|
+
|
14
|
+
namespace sgl {
|
15
|
+
|
16
|
+
/// Implementation of slang's ISlangBlob interface to access an unowned blob of data.
|
17
|
+
class UnownedSlangBlob : public ISlangBlob {
|
18
|
+
public:
|
19
|
+
UnownedSlangBlob(const void* data, size_t size)
|
20
|
+
: m_data(data)
|
21
|
+
, m_size(size)
|
22
|
+
{
|
23
|
+
}
|
24
|
+
|
25
|
+
virtual SLANG_NO_THROW void const* SLANG_MCALL getBufferPointer() override { return m_data; }
|
26
|
+
virtual SLANG_NO_THROW size_t SLANG_MCALL getBufferSize() override { return m_size; }
|
27
|
+
|
28
|
+
virtual SLANG_NO_THROW SlangResult SLANG_MCALL queryInterface(SlangUUID const& uuid, void** outObject) override
|
29
|
+
{
|
30
|
+
if (uuid == SLANG_UUID_ISlangBlob) {
|
31
|
+
*outObject = static_cast<ISlangBlob*>(this);
|
32
|
+
return SLANG_OK;
|
33
|
+
}
|
34
|
+
return SLANG_E_NO_INTERFACE;
|
35
|
+
}
|
36
|
+
|
37
|
+
virtual SLANG_NO_THROW uint32_t SLANG_MCALL addRef() override
|
38
|
+
{
|
39
|
+
// Do not perform any reference counting.
|
40
|
+
return 2;
|
41
|
+
}
|
42
|
+
|
43
|
+
virtual SLANG_NO_THROW uint32_t SLANG_MCALL release() override
|
44
|
+
{
|
45
|
+
// Do not perform any reference counting.
|
46
|
+
return 2;
|
47
|
+
}
|
48
|
+
|
49
|
+
private:
|
50
|
+
const void* m_data;
|
51
|
+
size_t m_size;
|
52
|
+
};
|
53
|
+
|
54
|
+
} // namespace sgl
|
@@ -0,0 +1,74 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include "sgl/device/fwd.h"
|
6
|
+
#include "sgl/device/formats.h"
|
7
|
+
|
8
|
+
#include "sgl/core/macros.h"
|
9
|
+
#include "sgl/core/platform.h"
|
10
|
+
#include "sgl/core/object.h"
|
11
|
+
|
12
|
+
#include <slang-gfx.h>
|
13
|
+
|
14
|
+
namespace sgl {
|
15
|
+
|
16
|
+
class Window;
|
17
|
+
|
18
|
+
struct SwapchainDesc {
|
19
|
+
/// Format of the swapchain images.
|
20
|
+
Format format{Format::bgra8_unorm_srgb};
|
21
|
+
/// Width of the swapchain images in pixels.
|
22
|
+
uint32_t width{0};
|
23
|
+
/// Height of the swapchain images in pixels.
|
24
|
+
uint32_t height{0};
|
25
|
+
/// Number of swapchain images.
|
26
|
+
uint32_t image_count{3};
|
27
|
+
/// Enable/disable vertical synchronization.
|
28
|
+
bool enable_vsync{false};
|
29
|
+
};
|
30
|
+
|
31
|
+
class SGL_API Swapchain : public Object {
|
32
|
+
SGL_OBJECT(Swapchain)
|
33
|
+
public:
|
34
|
+
Swapchain(SwapchainDesc desc, WindowHandle window_handle, ref<Device> device);
|
35
|
+
Swapchain(SwapchainDesc desc, Window* window, ref<Device> device);
|
36
|
+
~Swapchain();
|
37
|
+
|
38
|
+
/// Returns the swapchain description.
|
39
|
+
const SwapchainDesc& desc() const { return m_desc; }
|
40
|
+
|
41
|
+
/// Returns the back buffer images.
|
42
|
+
const std::vector<ref<Texture>>& images() const { return m_images; }
|
43
|
+
|
44
|
+
/// Returns the back buffer image at position `index`.
|
45
|
+
const ref<Texture>& get_image(uint32_t index) const;
|
46
|
+
|
47
|
+
/// Present the next image in the swapchain.
|
48
|
+
void present();
|
49
|
+
|
50
|
+
/// Returns the index of next back buffer image that will be presented in the next `present` call.
|
51
|
+
/// Returns -1 if no image is available and the caller should skip the frame.
|
52
|
+
int acquire_next_image();
|
53
|
+
|
54
|
+
/// Resizes the back buffers of this swapchain. All render target views and framebuffers
|
55
|
+
/// referencing the back buffer images must be freed before calling this method.
|
56
|
+
void resize(uint32_t width, uint32_t height);
|
57
|
+
|
58
|
+
/// Returns true if the window is occluded.
|
59
|
+
bool is_occluded() const;
|
60
|
+
|
61
|
+
bool fullscreen_mode() const { return m_fullscreen; }
|
62
|
+
void set_fullscreen_mode(bool fullscreen);
|
63
|
+
|
64
|
+
|
65
|
+
private:
|
66
|
+
void get_images();
|
67
|
+
|
68
|
+
SwapchainDesc m_desc;
|
69
|
+
ref<Device> m_device;
|
70
|
+
Slang::ComPtr<gfx::ISwapchain> m_gfx_swapchain;
|
71
|
+
bool m_fullscreen{false};
|
72
|
+
std::vector<ref<Texture>> m_images;
|
73
|
+
};
|
74
|
+
} // namespace sgl
|