Skip to content

Commit b3fba14

Browse files
committed
Added GLSL.std.450.hlsl
1 parent 0dbeb8f commit b3fba14

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#ifndef _NBL_BUILTIN_HLSL_SPIRV_INTRINSICS_GLSL_STD_450_INCLUDED_
2+
#define _NBL_BUILTIN_HLSL_SPIRV_INTRINSICS_GLSL_STD_450_INCLUDED_
3+
4+
#ifdef __HLSL_VERSION
5+
#include <nbl/builtin/hlsl/cpp_compat.hlsl>
6+
#include "spirv/unified1/GLSL.std.450.h"
7+
8+
namespace nbl
9+
{
10+
namespace hlsl
11+
{
12+
namespace spirv
13+
{
14+
15+
// Find MSB and LSB restricted to 32-bit width component types https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html
16+
17+
template<typename Integral NBL_FUNC_REQUIRES(is_integral_v<Integral> && (sizeof(scalar_type_t<Integral>) == 4))
18+
[[vk::ext_instruction(GLSLstd450::GLSLstd450FindILsb, "GLSL.std.450")]]
19+
Integral findILsb(Integral value);
20+
21+
template<typename Integral NBL_FUNC_REQUIRES(is_integral_v<Integral> && (sizeof(scalar_type_t<Integral>) == 4))
22+
[[vk::ext_instruction(GLSLstd450::GLSLstd450FindSMsb, "GLSL.std.450")]]
23+
Integral findSMsb(Integral value);
24+
25+
template<typename Integral NBL_FUNC_REQUIRES(is_integral_v<Integral> && (sizeof(scalar_type_t<Integral>) == 4))
26+
[[vk::ext_instruction(GLSLstd450::GLSLstd450FindUMsb, "GLSL.std.450")]]
27+
Integral findUMsb(Integral value);
28+
29+
}
30+
}
31+
}
32+
33+
#endif
34+
#endif

0 commit comments

Comments
 (0)