Skip to content

Commit fe7383e

Browse files
committed
Merge remote-tracking branch 'origin' into ali_blake3
2 parents 5330907 + da92c04 commit fe7383e

File tree

10 files changed

+879
-311
lines changed

10 files changed

+879
-311
lines changed

include/nbl/builtin/hlsl/blit/parameters.hlsl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ namespace blit
1414

1515
struct parameters_t
1616
{
17-
1817
float32_t3 fScale;
1918
float32_t3 negativeSupport;
2019
float32_t referenceAlpha;

include/nbl/builtin/hlsl/cpp_compat/basic.h

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,35 @@
33

44
#include <nbl/builtin/hlsl/macros.h>
55

6+
namespace nbl
7+
{
8+
namespace hlsl
9+
{
10+
namespace impl
11+
{
12+
template<typename To, typename From, typename Enabled = void>
13+
struct static_cast_helper
14+
{
15+
static inline To cast(From u)
16+
{
17+
#ifndef __HLSL_VERSION
18+
return static_cast<To>(u);
19+
#else
20+
return To(u);
21+
#endif
22+
}
23+
};
24+
}
25+
26+
template<typename To, typename From>
27+
inline To _static_cast(From v)
28+
{
29+
return impl::static_cast_helper<To, From>::cast(v);
30+
}
31+
32+
}
33+
}
34+
635
#ifndef __HLSL_VERSION
736
#include <type_traits>
837

@@ -11,16 +40,11 @@
1140
#define NBL_CONSTEXPR_FUNC constexpr
1241
#define NBL_CONSTEXPR_STATIC constexpr static
1342
#define NBL_CONSTEXPR_STATIC_INLINE constexpr static inline
43+
#define NBL_CONSTEXPR_INLINE_FUNC constexpr inline
1444
#define NBL_CONST_MEMBER_FUNC const
1545

1646
namespace nbl::hlsl
1747
{
18-
template<typename T, typename U>
19-
T _static_cast(U v)
20-
{
21-
return static_cast<T>(v);
22-
}
23-
2448
template<typename T>
2549
using add_reference = std::add_lvalue_reference<T>;
2650

@@ -41,32 +65,28 @@ namespace nbl::hlsl
4165
#define NBL_CONSTEXPR_FUNC
4266
#define NBL_CONSTEXPR_STATIC const static
4367
#define NBL_CONSTEXPR_STATIC_INLINE const static
68+
#define NBL_CONSTEXPR_INLINE_FUNC inline
4469
#define NBL_CONST_MEMBER_FUNC
4570

4671
namespace nbl
4772
{
48-
namespace hlsl
49-
{
50-
template<typename T, typename U>
51-
T _static_cast(U v)
52-
{
53-
return (T)v;
54-
}
73+
namespace hlsl
74+
{
5575

5676
#if 0 // TODO: for later
57-
template<typename T>
58-
struct add_reference
59-
{
60-
using type = ref<T>;
61-
};
62-
template<typename T>
63-
struct add_pointer
64-
{
65-
using type = ptr<T>;
66-
};
77+
template<typename T>
78+
struct add_reference
79+
{
80+
using type = ref<T>;
81+
};
82+
template<typename T>
83+
struct add_pointer
84+
{
85+
using type = ptr<T>;
86+
};
6787
#endif
6888

69-
}
89+
}
7090
}
7191

7292
#define NBL_REF_ARG(...) inout __VA_ARGS__

0 commit comments

Comments
 (0)