File tree Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 5
5
#include <nbl/builtin/hlsl/type_traits.hlsl>
6
6
#include <nbl/builtin/hlsl/vector_utils/vector_traits.hlsl>
7
7
#include <nbl/builtin/hlsl/array_accessors.hlsl>
8
+ #include <nbl/builtin/hlsl/spirv_intrinsics/core.hlsl>
8
9
#include <nbl/builtin/hlsl/spirv_intrinsics/GLSL.std.450 .hlsl>
9
10
10
11
#ifndef __HLSL_VERSION
@@ -271,6 +272,25 @@ inline T exp2(NBL_CONST_REF_ARG(T) val)
271
272
#endif
272
273
}
273
274
275
+ #ifdef __HLSL_VERSION
276
+ #define EXP2_SPECIALIZATION_RETUR_VAL spirv::Exp2 (float (val))
277
+ #else
278
+ #define EXP2_SPECIALIZATION_RETUR_VAL std::exp2 (val)
279
+ #endif
280
+ #define DEFINE_EXP2_SPECIALIZATION (TYPE)\
281
+ template<>\
282
+ inline TYPE exp2 (NBL_CONST_REF_ARG (TYPE) val)\
283
+ {\
284
+ return EXP2_SPECIALIZATION_RETUR_VAL;\
285
+ }\
286
+
287
+ DEFINE_EXP2_SPECIALIZATION (int16_t)
288
+ DEFINE_EXP2_SPECIALIZATION (int32_t)
289
+ DEFINE_EXP2_SPECIALIZATION (int64_t)
290
+ DEFINE_EXP2_SPECIALIZATION (uint16_t)
291
+ DEFINE_EXP2_SPECIALIZATION (uint32_t)
292
+ DEFINE_EXP2_SPECIALIZATION (uint64_t)
293
+
274
294
template<typename FloatingPoint>
275
295
inline FloatingPoint rsqrt (FloatingPoint x)
276
296
{
Original file line number Diff line number Diff line change @@ -26,9 +26,9 @@ template<typename Integral>
26
26
[[vk::ext_instruction (GLSLstd450::GLSLstd450FindUMsb, "GLSL.std.450" )]]
27
27
enable_if_t<is_integral_v<Integral> && (sizeof (scalar_type_t<Integral>) == 4 ), Integral> findUMsb (Integral value);
28
28
29
- template<typename T >
29
+ template<typename FloatingPoint >
30
30
[[vk::ext_instruction (GLSLstd450::GLSLstd450Exp2, "GLSL.std.450" )]]
31
- enable_if_t<is_fundamental<T >::value, T > Exp2 (T val);
31
+ enable_if_t<is_floating_point<FloatingPoint >::value, FloatingPoint > Exp2 (FloatingPoint val);
32
32
33
33
template<typename FloatingPoint>
34
34
[[vk::ext_instruction (GLSLstd450::GLSLstd450InverseSqrt, "GLSL.std.450" )]]
Original file line number Diff line number Diff line change @@ -210,6 +210,11 @@ LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "glsl/ext/DepthPyramidGenerator/vir
210
210
211
211
# HLSL
212
212
LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/macros.h" )
213
+
214
+ # utility
215
+ LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/array_accessors.hlsl" )
216
+ LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/vector_utils/vector_traits.hlsl" )
217
+
213
218
#spirv intrinsics
214
219
LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/core.hlsl" )
215
220
LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/fragment_shader_pixel_interlock.hlsl" )
@@ -219,10 +224,11 @@ LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/subgroup_bal
219
224
LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/subgroup_basic.hlsl" )
220
225
LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/subgroup_shuffle.hlsl" )
221
226
LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/subgroup_vote.hlsl" )
227
+ LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/GLSL.std.450.hlsl" )
222
228
#C++ compatibility
223
229
LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/cpp_compat.hlsl" )
224
230
LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/cpp_compat/basic.h" )
225
- LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/cpp_compat/intrinsics.h " )
231
+ LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/cpp_compat/intrinsics.hlsl " )
226
232
LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/cpp_compat/matrix.hlsl" )
227
233
LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/cpp_compat/promote.hlsl" )
228
234
LIST_BUILTIN_RESOURCE (NBL_RESOURCES_TO_EMBED "hlsl/cpp_compat/vector.hlsl" )
You can’t perform that action at this time.
0 commit comments