Open llvm-beanz opened 11 months ago
Well, as for the reflection, you could merge the Clang Reflection TS and use the C++20 concepts based reflection, I've used it before to autogen WASM embind
bindings for C++ classes and structs in a production-like environment (my reflection utility header was over 1000 lines).
Its quite nice and I found it to be just as stable as DXC (some select things you can work around crash it).
It could probably also help push the Reflection TS across the finish like for actual C++29 or something https://clementpirelli.wordpress.com/2021/12/08/cpp-reflection-ts-first-look/
P.s. I have a permissively licensed (Apache 2.0) header which tries to polyfill type_tratis
for current trunk DXC although in a different namespace to std::
because we have a tendency to include our HLSL2021 headers in both C++ and HLSL.
https://github.com/Devsh-Graphics-Programming/Nabla/blob/41be49ce6c9d4bbab52abfab488e1027e71c4e2e/include/nbl/builtin/hlsl/type_traits.hlsl
As you can see, quite a lot of traits are held up by a lack of variadic templates in DXC, although I guess hlsl-specs
thinking more about Clang-HLSL where that will be possible.
This may be useful for https://github.com/microsoft/hlsl-specs/blob/main/proposals/0003-numeric-constants.md as well.
This may be useful for https://github.com/microsoft/hlsl-specs/blob/main/proposals/0003-numeric-constants.md as well.
C++ style Numeric constants won't work in HLSL because you don't have constexpr
methods.
This makes any numeric_limits<float>
impossible (cause floats can't be constexpr
or const static
inline member initialized then considered a compile time constant)
What we've had to do, is work around this stuff with storing floatN_t
as uintN_t
because HLSL's asuint
and asfloat
behave as-if they're supposedly constexpr!?
Is your feature request related to a problem? Please describe. Now that HLSL supports C++ templates with SFINAE, we should ship a set of C++-compatible type_traits interfaces.
Describe the solution you'd like We should audit the C++
type_traits
header and ship most (or all) of it for HLSL.Describe alternatives you've considered We could just extend the HLSL language with more and more compile-time reflection capabilities, but matching C++ would be more in line with the language direction.