Skip to content

Commit 188e63e

Browse files
committed
Merge branch 'master' into nahim_complex_fft_workgroup
2 parents ee32a83 + c658fa7 commit 188e63e

File tree

4 files changed

+44
-60
lines changed

4 files changed

+44
-60
lines changed

3rdparty/dxc/dxc

Submodule dxc updated 257 files

include/nbl/builtin/hlsl/complex.hlsl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,4 +356,18 @@ complex_t<Scalar> polar(const Scalar r, const Scalar theta)
356356
}
357357
}
358358

359-
#endif
359+
// due to lack of alignof and typeid in DXC, need C++03 style tricks
360+
NBL_REGISTER_OBJ_TYPE(complex_t<float16_t>,::nbl::hlsl::alignment_of_v<float16_t>)
361+
NBL_REGISTER_OBJ_TYPE(complex_t<float16_t2>,::nbl::hlsl::alignment_of_v<float16_t2>)
362+
NBL_REGISTER_OBJ_TYPE(complex_t<float16_t3>,::nbl::hlsl::alignment_of_v<float16_t3>)
363+
NBL_REGISTER_OBJ_TYPE(complex_t<float16_t4>,::nbl::hlsl::alignment_of_v<float16_t4>)
364+
NBL_REGISTER_OBJ_TYPE(complex_t<float32_t>,::nbl::hlsl::alignment_of_v<float32_t>)
365+
NBL_REGISTER_OBJ_TYPE(complex_t<float32_t2>,::nbl::hlsl::alignment_of_v<float32_t2>)
366+
NBL_REGISTER_OBJ_TYPE(complex_t<float32_t3>,::nbl::hlsl::alignment_of_v<float32_t3>)
367+
NBL_REGISTER_OBJ_TYPE(complex_t<float32_t4>,::nbl::hlsl::alignment_of_v<float32_t4>)
368+
NBL_REGISTER_OBJ_TYPE(complex_t<float64_t>,::nbl::hlsl::alignment_of_v<float64_t>)
369+
NBL_REGISTER_OBJ_TYPE(complex_t<float64_t2>,::nbl::hlsl::alignment_of_v<float64_t2>)
370+
NBL_REGISTER_OBJ_TYPE(complex_t<float64_t3>,::nbl::hlsl::alignment_of_v<float64_t3>)
371+
NBL_REGISTER_OBJ_TYPE(complex_t<float64_t4>,::nbl::hlsl::alignment_of_v<float64_t4>)
372+
373+
#endif

include/nbl/builtin/hlsl/cpp_compat/promote.hlsl

Lines changed: 23 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#ifndef _NBL_BUILTIN_HLSL_CPP_COMPAT_PROMOTE_INCLUDED_
22
#define _NBL_BUILTIN_HLSL_CPP_COMPAT_PROMOTE_INCLUDED_
33

4+
#include "nbl/builtin/hlsl/type_traits.hlsl"
5+
46
namespace nbl
57
{
68
namespace hlsl
79
{
810

911
namespace impl
1012
{
13+
1114
// partial specialize this for `T=matrix<scalar_t,,>|vector<scalar_t,>` and `U=matrix<scalar_t,,>|vector<scalar_t,>|scalar_t`
1215
template<typename T, typename U>
1316
struct Promote
@@ -20,76 +23,43 @@ struct Promote
2023

2124
#ifdef __HLSL_VERSION
2225

23-
// TODO: write this scalar-type agnostic!
24-
template<typename U>
25-
struct Promote<float32_t1,U>
26-
{
27-
float32_t1 operator()(U v)
28-
{
29-
return float32_t1(v);
30-
}
31-
};
32-
33-
template<typename U>
34-
struct Promote<float32_t2, U>
35-
{
36-
float32_t2 operator()(U v)
37-
{
38-
return float32_t2(v, v);
39-
}
40-
};
41-
42-
template<typename U>
43-
struct Promote<float32_t3, U>
44-
{
45-
float32_t3 operator()(U v)
46-
{
47-
return float32_t3(v, v, v);
48-
}
49-
};
50-
51-
template<typename U>
52-
struct Promote<float32_t4, U>
53-
{
54-
float32_t4 operator()(U v)
55-
{
56-
return float32_t4(v, v, v, v);
57-
}
58-
};
59-
60-
template<typename U>
61-
struct Promote<float64_t1,U>
26+
template<typename Scalar, typename U>
27+
struct Promote<vector <Scalar, 1>, U>
6228
{
63-
float64_t1 operator()(U v)
29+
enable_if_t<is_scalar<Scalar>::value && is_scalar<U>::value, vector <Scalar, 1> > operator()(U v)
6430
{
65-
return float64_t1(v);
31+
vector <Scalar, 1> promoted = {Scalar(v)};
32+
return promoted;
6633
}
6734
};
6835

69-
template<typename U>
70-
struct Promote<float64_t2, U>
36+
template<typename Scalar, typename U>
37+
struct Promote<vector <Scalar, 2>, U>
7138
{
72-
float64_t2 operator()(U v)
39+
enable_if_t<is_scalar<Scalar>::value && is_scalar<U>::value, vector <Scalar, 2> > operator()(U v)
7340
{
74-
return float64_t2(v, v);
41+
vector <Scalar, 2> promoted = {Scalar(v), Scalar(v)};
42+
return promoted;
7543
}
7644
};
7745

78-
template<typename U>
79-
struct Promote<float64_t3, U>
46+
template<typename Scalar, typename U>
47+
struct Promote<vector <Scalar, 3>, U>
8048
{
81-
float64_t3 operator()(U v)
49+
enable_if_t<is_scalar<Scalar>::value && is_scalar<U>::value, vector <Scalar, 3> > operator()(U v)
8250
{
83-
return float64_t3(v, v, v);
51+
vector <Scalar, 3> promoted = {Scalar(v), Scalar(v), Scalar(v)};
52+
return promoted;
8453
}
8554
};
8655

87-
template<typename U>
88-
struct Promote<float64_t4, U>
56+
template<typename Scalar, typename U>
57+
struct Promote<vector <Scalar, 4>, U>
8958
{
90-
float64_t4 operator()(U v)
59+
enable_if_t<is_scalar<Scalar>::value && is_scalar<U>::value, vector <Scalar, 4> > operator()(U v)
9160
{
92-
return float64_t4(v, v, v, v);
61+
vector <Scalar, 4> promoted = {Scalar(v), Scalar(v), Scalar(v), Scalar(v)};
62+
return promoted;
9363
}
9464
};
9565

include/nbl/builtin/hlsl/type_traits.hlsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,13 @@ struct unsigned_integer_of_size<8>
695695
#define typeid(expr) (::nbl::hlsl::impl::typeid_t<__decltype(expr)>::value)
696696

697697
// Found a bug in Boost.Wave, try to avoid multi-line macros https://github.com/boostorg/wave/issues/195
698-
#define NBL_IMPL_SPECIALIZE_TYPE_ID(T) namespace impl { template<> struct typeid_t<T> : integral_constant<uint32_t,__COUNTER__> {}; }
698+
#define NBL_IMPL_SPECIALIZE_TYPE_ID(T) namespace impl { template<> struct typeid_t<T > : integral_constant<uint32_t,__COUNTER__> {}; }
699699

700700
#define NBL_REGISTER_OBJ_TYPE(T,A) namespace nbl { namespace hlsl { NBL_IMPL_SPECIALIZE_TYPE_ID(T) \
701-
template<> struct alignment_of<T> : integral_constant<uint32_t,A> {}; \
702-
template<> struct alignment_of<const T> : integral_constant<uint32_t,A> {}; \
703-
template<> struct alignment_of<typename impl::add_lvalue_reference<T>::type> : integral_constant<uint32_t,A> {}; \
704-
template<> struct alignment_of<typename impl::add_lvalue_reference<const T>::type> : integral_constant<uint32_t,A> {}; \
701+
template<> struct alignment_of<T > : integral_constant<uint32_t,A > {}; \
702+
template<> struct alignment_of<const T > : integral_constant<uint32_t,A > {}; \
703+
template<> struct alignment_of<typename impl::add_lvalue_reference<T >::type> : integral_constant<uint32_t,A > {}; \
704+
template<> struct alignment_of<typename impl::add_lvalue_reference<const T >::type> : integral_constant<uint32_t,A > {}; \
705705
}}
706706

707707
// TODO: find out how to do it such that we don't get duplicate definition if we use two function identifiers with same signature

0 commit comments

Comments
 (0)