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,56 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include "scalar_types.h"
|
6
|
+
#include "vector_types.h"
|
7
|
+
|
8
|
+
namespace sgl::math {
|
9
|
+
|
10
|
+
template<floating_point T>
|
11
|
+
[[nodiscard]] inline T linear_to_srgb(T x)
|
12
|
+
{
|
13
|
+
if (x <= T(0.0031308)) {
|
14
|
+
return T(12.92) * x;
|
15
|
+
} else {
|
16
|
+
return T(1.055) * pow(x, T(1.0 / 2.4)) - T(0.055);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
template<floating_point T, int N>
|
21
|
+
[[nodiscard]] inline vector<T, N> linear_to_srgb(const vector<T, N>& x)
|
22
|
+
{
|
23
|
+
if constexpr (N == 1)
|
24
|
+
return vector<T, 1>(linear_to_srgb(x.x));
|
25
|
+
else if constexpr (N == 2)
|
26
|
+
return vector<T, 2>(linear_to_srgb(x.x), linear_to_srgb(x.y));
|
27
|
+
else if constexpr (N == 3)
|
28
|
+
return vector<T, 3>(linear_to_srgb(x.x), linear_to_srgb(x.y), linear_to_srgb(x.z));
|
29
|
+
else if constexpr (N == 4)
|
30
|
+
return vector<T, 4>(linear_to_srgb(x.x), linear_to_srgb(x.y), linear_to_srgb(x.z), linear_to_srgb(x.w));
|
31
|
+
}
|
32
|
+
|
33
|
+
template<floating_point T>
|
34
|
+
[[nodiscard]] inline T srgb_to_linear(T x)
|
35
|
+
{
|
36
|
+
if (x <= T(0.04045)) {
|
37
|
+
return T(1.0 / 12.92) * x;
|
38
|
+
} else {
|
39
|
+
return pow((x + T(0.055)) * T(1.0 / 1.055), T(2.4));
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
template<floating_point T, int N>
|
44
|
+
[[nodiscard]] inline vector<T, N> srgb_to_linear(const vector<T, N>& x)
|
45
|
+
{
|
46
|
+
if constexpr (N == 1)
|
47
|
+
return vector<T, 1>(srgb_to_linear(x.x));
|
48
|
+
else if constexpr (N == 2)
|
49
|
+
return vector<T, 2>(srgb_to_linear(x.x), srgb_to_linear(x.y));
|
50
|
+
else if constexpr (N == 3)
|
51
|
+
return vector<T, 3>(srgb_to_linear(x.x), srgb_to_linear(x.y), srgb_to_linear(x.z));
|
52
|
+
else if constexpr (N == 4)
|
53
|
+
return vector<T, 4>(srgb_to_linear(x.x), srgb_to_linear(x.y), srgb_to_linear(x.z), srgb_to_linear(x.w));
|
54
|
+
}
|
55
|
+
|
56
|
+
} // namespace sgl::math
|
@@ -0,0 +1,146 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include "sgl/core/macros.h"
|
6
|
+
|
7
|
+
#include <cstdint>
|
8
|
+
#include <limits>
|
9
|
+
|
10
|
+
namespace sgl::math {
|
11
|
+
|
12
|
+
SGL_API uint16_t float32_to_float16(float value);
|
13
|
+
SGL_API float float16_to_float32(uint16_t value);
|
14
|
+
|
15
|
+
struct float16_t {
|
16
|
+
float16_t() = default;
|
17
|
+
|
18
|
+
float16_t(uint32_t sign, uint32_t exponent, uint32_t fraction)
|
19
|
+
: m_bits((sign & 0x01) << 15 | (exponent & 0x1f) << 10 | (fraction & 0x03ff))
|
20
|
+
{
|
21
|
+
}
|
22
|
+
|
23
|
+
explicit float16_t(float value)
|
24
|
+
: m_bits(float32_to_float16(value))
|
25
|
+
{
|
26
|
+
}
|
27
|
+
|
28
|
+
template<typename T>
|
29
|
+
explicit float16_t(T value)
|
30
|
+
: m_bits(float32_to_float16(static_cast<float>(value)))
|
31
|
+
{
|
32
|
+
}
|
33
|
+
|
34
|
+
operator float() const { return float16_to_float32(m_bits); }
|
35
|
+
|
36
|
+
static constexpr float16_t fromBits(uint16_t bits) { return float16_t(bits, FromBits); }
|
37
|
+
uint16_t toBits() const { return m_bits; }
|
38
|
+
|
39
|
+
bool operator==(const float16_t other) const { return m_bits == other.m_bits; }
|
40
|
+
bool operator!=(const float16_t other) const { return m_bits != other.m_bits; }
|
41
|
+
bool operator<(const float16_t other) const { return static_cast<float>(*this) < static_cast<float>(other); }
|
42
|
+
bool operator<=(const float16_t other) const { return static_cast<float>(*this) <= static_cast<float>(other); }
|
43
|
+
bool operator>(const float16_t other) const { return static_cast<float>(*this) > static_cast<float>(other); }
|
44
|
+
bool operator>=(const float16_t other) const { return static_cast<float>(*this) >= static_cast<float>(other); }
|
45
|
+
|
46
|
+
float16_t operator+() const { return *this; }
|
47
|
+
float16_t operator-() const { return fromBits(m_bits ^ 0x8000); }
|
48
|
+
|
49
|
+
// TODO: Implement math operators in native fp16 precision. For now using fp32.
|
50
|
+
float16_t operator+(const float16_t other) const
|
51
|
+
{
|
52
|
+
return float16_t(static_cast<float>(*this) + static_cast<float>(other));
|
53
|
+
}
|
54
|
+
float16_t operator-(const float16_t other) const
|
55
|
+
{
|
56
|
+
return float16_t(static_cast<float>(*this) - static_cast<float>(other));
|
57
|
+
}
|
58
|
+
float16_t operator*(const float16_t other) const
|
59
|
+
{
|
60
|
+
return float16_t(static_cast<float>(*this) * static_cast<float>(other));
|
61
|
+
}
|
62
|
+
float16_t operator/(const float16_t other) const
|
63
|
+
{
|
64
|
+
return float16_t(static_cast<float>(*this) / static_cast<float>(other));
|
65
|
+
}
|
66
|
+
|
67
|
+
float16_t operator+=(const float16_t other) { return *this = *this + other; }
|
68
|
+
float16_t operator-=(const float16_t other) { return *this = *this - other; }
|
69
|
+
float16_t operator*=(const float16_t other) { return *this = *this * other; }
|
70
|
+
float16_t operator/=(const float16_t other) { return *this = *this / other; }
|
71
|
+
|
72
|
+
constexpr bool isfinite() const noexcept { return exponent() < 31; }
|
73
|
+
constexpr bool isinf() const noexcept { return exponent() == 31 && mantissa() == 0; }
|
74
|
+
constexpr bool isnan() const noexcept { return exponent() == 31 && mantissa() != 0; }
|
75
|
+
|
76
|
+
constexpr bool is_normalized() const noexcept { return exponent() > 0 && exponent() < 31; }
|
77
|
+
constexpr bool is_denormalized() const noexcept { return exponent() == 0 && mantissa() != 0; }
|
78
|
+
|
79
|
+
private:
|
80
|
+
enum Tag { FromBits };
|
81
|
+
|
82
|
+
constexpr float16_t(uint16_t bits, Tag)
|
83
|
+
: m_bits(bits)
|
84
|
+
{
|
85
|
+
}
|
86
|
+
|
87
|
+
constexpr uint16_t mantissa() const noexcept { return m_bits & 0x3ff; }
|
88
|
+
constexpr uint16_t exponent() const noexcept { return (m_bits >> 10) & 0x001f; }
|
89
|
+
|
90
|
+
uint16_t m_bits;
|
91
|
+
};
|
92
|
+
|
93
|
+
SGL_DIAGNOSTIC_PUSH
|
94
|
+
// disable warning about literal suffixes not starting with an underscore
|
95
|
+
SGL_DISABLE_MSVC_WARNING(4455)
|
96
|
+
SGL_DISABLE_CLANG_WARNING("-Wuser-defined-literals")
|
97
|
+
SGL_DISABLE_GCC_WARNING("-Wliteral-suffix")
|
98
|
+
|
99
|
+
/// h suffix for "half float" literals.
|
100
|
+
inline float16_t operator""h(long double value)
|
101
|
+
{
|
102
|
+
return float16_t(static_cast<float>(value));
|
103
|
+
}
|
104
|
+
|
105
|
+
SGL_DIAGNOSTIC_POP
|
106
|
+
|
107
|
+
} // namespace sgl::math
|
108
|
+
|
109
|
+
namespace std {
|
110
|
+
|
111
|
+
template<>
|
112
|
+
class numeric_limits<sgl::math::float16_t> {
|
113
|
+
public:
|
114
|
+
static constexpr bool is_specialized = true;
|
115
|
+
static constexpr sgl::math::float16_t min() noexcept { return sgl::math::float16_t::fromBits(0x0200); }
|
116
|
+
static constexpr sgl::math::float16_t max() noexcept { return sgl::math::float16_t::fromBits(0x7bff); }
|
117
|
+
static constexpr sgl::math::float16_t lowest() noexcept { return sgl::math::float16_t::fromBits(0xfbff); }
|
118
|
+
static constexpr int digits = 11;
|
119
|
+
static constexpr int digits10 = 3;
|
120
|
+
static constexpr bool is_signed = true;
|
121
|
+
static constexpr bool is_integer = false;
|
122
|
+
static constexpr bool is_exact = false;
|
123
|
+
static constexpr int radix = 2;
|
124
|
+
static constexpr sgl::math::float16_t epsilon() noexcept { return sgl::math::float16_t::fromBits(0x1200); }
|
125
|
+
static constexpr sgl::math::float16_t round_error() noexcept { return sgl::math::float16_t::fromBits(0x3c00); }
|
126
|
+
static constexpr int min_exponent = -13;
|
127
|
+
static constexpr int min_exponent10 = -4;
|
128
|
+
static constexpr int max_exponent = 16;
|
129
|
+
static constexpr int max_exponent10 = 4;
|
130
|
+
static constexpr bool has_infinity = true;
|
131
|
+
static constexpr bool has_quiet_NaN = true;
|
132
|
+
static constexpr bool has_signaling_NaN = true;
|
133
|
+
static constexpr float_denorm_style has_denorm = denorm_absent;
|
134
|
+
static constexpr bool has_denorm_loss = false;
|
135
|
+
static constexpr sgl::math::float16_t infinity() noexcept { return sgl::math::float16_t::fromBits(0x7c00); }
|
136
|
+
static constexpr sgl::math::float16_t quiet_NaN() noexcept { return sgl::math::float16_t::fromBits(0x7fff); }
|
137
|
+
static constexpr sgl::math::float16_t signaling_NaN() noexcept { return sgl::math::float16_t::fromBits(0x7dff); }
|
138
|
+
static constexpr sgl::math::float16_t denorm_min() noexcept { return sgl::math::float16_t::fromBits(0); }
|
139
|
+
static constexpr bool is_iec559 = false;
|
140
|
+
static constexpr bool is_bounded = false;
|
141
|
+
static constexpr bool is_modulo = false;
|
142
|
+
static constexpr bool traps = false;
|
143
|
+
static constexpr bool tinyness_before = false;
|
144
|
+
static constexpr float_round_style round_style = round_to_nearest;
|
145
|
+
};
|
146
|
+
} // namespace std
|