File tree Expand file tree Collapse file tree 4 files changed +49
-4
lines changed Expand file tree Collapse file tree 4 files changed +49
-4
lines changed Original file line number Diff line number Diff line change 44#ifndef _NBL_BUILTIN_HLSL_SPIRV_INTRINSICS_CORE_INCLUDED_
55#define _NBL_BUILTIN_HLSL_SPIRV_INTRINSICS_CORE_INCLUDED_
66
7-
87#ifdef __HLSL_VERSION // TODO: AnastZIuk fix public search paths so we don't choke
98#include "spirv/unified1/spirv.hpp"
109
1110#include <nbl/builtin/hlsl/vector_utils/vector_traits.hlsl>
12- #include " nbl/builtin/hlsl/type_traits.hlsl"
11+ #include < nbl/builtin/hlsl/type_traits.hlsl>
1312#include <nbl/builtin/hlsl/concepts.hlsl>
13+ #include <nbl/builtin/hlsl/spirv_intrinsics/output_structs.hlsl>
1414
1515namespace nbl
1616{
@@ -300,6 +300,14 @@ template<typename BooleanVector>
300300[[vk::ext_instruction (spv::OpAny)]]
301301enable_if_t<is_vector_v<BooleanVector>&& is_same_v<typename vector_traits<BooleanVector>::scalar_type, bool >, BooleanVector> any (BooleanVector vec);
302302
303+ template<typename T NBL_FUNC_REQUIRES (concepts::UnsignedIntegral<T>)
304+ [[vk::ext_instruction (spv::OpIAddCarry)]]
305+ AddCarryOutput<T> AddCarry (T operand1, T operand2);
306+
307+ template<typename T NBL_FUNC_REQUIRES (concepts::UnsignedIntegral<T>)
308+ [[vk::ext_instruction (spv::OpISubBorrow)]]
309+ SubBorrowOutput<T> SubBorrow (T operand1, T operand2);
310+
303311}
304312
305313#endif
Original file line number Diff line number Diff line change 1+ // Copyright (C) 2023 - DevSH Graphics Programming Sp. z O.O.
2+ // This file is part of the "Nabla Engine".
3+ // For conditions of distribution and use, see copyright notice in nabla.h
4+ #ifndef _NBL_BUILTIN_HLSL_SPIRV_INTRINSICS_OUTPUT_STRUCTS_INCLUDED_
5+ #define _NBL_BUILTIN_HLSL_SPIRV_INTRINSICS_OUTPUT_STRUCTS_INCLUDED_
6+
7+ #include <nbl/builtin/hlsl/concepts/core.hlsl>
8+
9+ namespace nbl
10+ {
11+ namespace hlsl
12+ {
13+
14+ template<typename T NBL_STRUCT_CONSTRAINABLE>
15+ struct AddCarryOutput;
16+ template<typename T NBL_STRUCT_CONSTRAINABLE>
17+ struct SubBorrowOutput;
18+
19+
20+ template<typename T> NBL_PARTIAL_REQ_TOP (concepts::UnsignedIntegral<T>)
21+ struct AddCarryOutput<T NBL_PARTIAL_REQ_BOT (concepts::UnsignedIntegral<T>) >
22+ {
23+ T result;
24+ T carry;
25+ };
26+
27+ template<typename T> NBL_PARTIAL_REQ_TOP (concepts::UnsignedIntegral<T>)
28+ struct SubBorrowOutput<T NBL_PARTIAL_REQ_BOT (concepts::UnsignedIntegral<T>) >
29+ {
30+ T result;
31+ T borrow;
32+ };
33+ }
34+ }
35+
36+ #endif
Original file line number Diff line number Diff line change 11// Copyright (C) 2023 - DevSH Graphics Programming Sp. z O.O.
22// This file is part of the "Nabla Engine".
33// For conditions of distribution and use, see copyright notice in nabla.h
4- #ifndef _NBL_BUILTIN_HLSL_SPIRV_INTRINSICS_OUTPUT_STRUCTS_INCLUDED_
5- #define _NBL_BUILTIN_HLSL_SPIRV_INTRINSICS_OUTPUT_STRUCTS_INCLUDED_
4+ #ifndef _NBL_BUILTIN_HLSL_TGMATH_SPIRV_INTRINSICS_OUTPUT_STRUCTS_INCLUDED_
5+ #define _NBL_BUILTIN_HLSL_TGMATH_SPIRV_INTRINSICS_OUTPUT_STRUCTS_INCLUDED_
66
77#include <nbl/builtin/hlsl/concepts/core.hlsl>
88#include <nbl/builtin/hlsl/concepts/vector .hlsl>
Original file line number Diff line number Diff line change @@ -238,6 +238,7 @@ LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/subgroup_bas
238238LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/subgroup_shuffle.hlsl" )
239239LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/subgroup_vote.hlsl" )
240240LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/glsl.std.450.hlsl" )
241+ LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "hlsl/spirv_intrinsics/output_structs.hlsl" )
241242#C++ compatibility
242243LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "hlsl/cpp_compat.hlsl" )
243244LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "hlsl/cpp_compat/basic.h" )
You can’t perform that action at this time.
0 commit comments