|
7 | 7 | #include <nbl/builtin/hlsl/member_test_macros.hlsl>
|
8 | 8 |
|
9 | 9 | #ifdef __HLSL_VERSION
|
| 10 | + |
| 11 | +NBL_GENERATE_MEMBER_TESTER(shaderFloat64); |
| 12 | +NBL_GENERATE_MEMBER_TESTER(shaderDrawParameters); |
| 13 | +NBL_GENERATE_MEMBER_TESTER(subgroupArithmetic); |
| 14 | +NBL_GENERATE_MEMBER_TESTER(fragmentShaderPixelInterlock); |
| 15 | +NBL_GENERATE_MEMBER_TESTER(maxOptimallyResidentWorkgroupInvocations); |
| 16 | + |
| 17 | +#define NBL_GENERATE_GET_OR_DEFAULT(field, ty, default) \ |
| 18 | +template<typename S, bool = has_member_##field<S>::value> struct get_or_default_##field : integral_constant<ty,S::field> {}; \ |
| 19 | +template<typename S> struct get_or_default_##field<S,false> : integral_constant<ty,default> {}; |
| 20 | + |
10 | 21 | namespace nbl
|
11 | 22 | {
|
12 | 23 | namespace hlsl
|
13 | 24 | {
|
| 25 | + |
| 26 | +namespace impl |
| 27 | +{ |
| 28 | +NBL_GENERATE_GET_OR_DEFAULT(shaderFloat64, bool, false); |
| 29 | +NBL_GENERATE_GET_OR_DEFAULT(shaderDrawParameters, bool, false); |
| 30 | +NBL_GENERATE_GET_OR_DEFAULT(subgroupArithmetic, bool, false); |
| 31 | +NBL_GENERATE_GET_OR_DEFAULT(fragmentShaderPixelInterlock, bool, false); |
| 32 | +NBL_GENERATE_GET_OR_DEFAULT(maxOptimallyResidentWorkgroupInvocations, uint16_t, 0); |
| 33 | +} |
| 34 | + |
| 35 | + |
14 | 36 | template<typename device_capabilities>
|
15 | 37 | struct device_capabilities_traits
|
16 | 38 | {
|
17 |
| - // TODO: check for members and default them to sane things, only do the 5 members in CJITIncludeLoader.cpp struct, we'll do the rest on `vulkan_1_3` branch with Nahim |
| 39 | + NBL_CONSTEXPR_STATIC_INLINE bool shaderFloat64 = impl::get_or_default_shaderFloat64<device_capabilities>::value; |
| 40 | + NBL_CONSTEXPR_STATIC_INLINE bool shaderDrawParameters = impl::get_or_default_shaderDrawParameters<device_capabilities>::value; |
| 41 | + NBL_CONSTEXPR_STATIC_INLINE bool subgroupArithmetic = impl::get_or_default_subgroupArithmetic<device_capabilities>::value; |
| 42 | + NBL_CONSTEXPR_STATIC_INLINE bool fragmentShaderPixelInterlock = impl::get_or_default_fragmentShaderPixelInterlock<device_capabilities>::value; |
| 43 | + NBL_CONSTEXPR_STATIC_INLINE uint16_t maxOptimallyResidentWorkgroupInvocations = impl::get_or_default_maxOptimallyResidentWorkgroupInvocations<device_capabilities>::value; |
18 | 44 | };
|
| 45 | + |
| 46 | +#undef NBL_GENERATE_GET_OR_DEFAULT |
| 47 | + |
19 | 48 | }
|
20 | 49 | }
|
21 | 50 | #endif
|
|
0 commit comments