Skip to content

Commit fee58b4

Browse files
authored
Add static create method for complex so it's compatible with hlsl codepath
1 parent ba500ab commit fee58b4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

include/nbl/builtin/hlsl/complex.hlsl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,16 @@ namespace hlsl
2121
{
2222

2323
template<typename Scalar>
24-
using complex_t = std::complex<Scalar>;
24+
struct complex_t : public std::complex<Scalar>
25+
{
26+
using base_t = std::complex<Scalar>;
27+
complex_t(const Scalar real, const Scalar imag) : base_t(real, imag) {}
28+
static complex_t create(const Scalar real, const Scalar imag)
29+
{
30+
complex_t retVal(real, imag);
31+
return retVal;
32+
}
33+
};
2534

2635
// Fast mul by i
2736
template<typename Scalar>
@@ -463,4 +472,4 @@ NBL_REGISTER_OBJ_TYPE(complex_t<float64_t4>,::nbl::hlsl::alignment_of_v<float64_
463472
// -------------------------------------- END HLSL VERSION ---------------------------------------
464473
#endif
465474

466-
#endif
475+
#endif

0 commit comments

Comments
 (0)