Skip to content

Commit 78d5eab

Browse files
committed
hlsl_generator: add checks for final bitcast overload
Signed-off-by: Ali Cheraghi <[email protected]>
1 parent 62f3976 commit 78d5eab

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tools/hlsl_generator/gen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
6161
template<class T, class U>
6262
[[vk::ext_instruction(spv::OpBitcast)]]
63-
T bitcast(U);
63+
enable_if_t<sizeof(T) == sizeof(U) && (is_spirv_type_v<T> || is_vector_v<T>), T> bitcast(U);
6464
"""
6565

6666
foot = """}

tools/hlsl_generator/out.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pointer_t<spv::StorageClassPhysicalStorageBuffer, T> bitcast(uint64_t);
5151

5252
template<class T, class U>
5353
[[vk::ext_instruction(spv::OpBitcast)]]
54-
T bitcast(U);
54+
enable_if_t<sizeof(T) == sizeof(U) && (is_spirv_type_v<T> || is_vector_v<T>), T> bitcast(U);
5555

5656
//! Builtins
5757
namespace builtin

0 commit comments

Comments
 (0)