Skip to content

Commit 09c0483

Browse files
author
devsh
committed
make addCarry and subBorrow from SPIR-V follow our naming convention
1 parent f762722 commit 09c0483

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

include/nbl/builtin/hlsl/bda/__ptr.hlsl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,24 @@ struct __ptr
2727
}
2828

2929
// in non-64bit mode we only support "small" arithmetic on pointers (just offsets no arithmetic on pointers)
30-
#if 0 // TODO: @Przemog1
3130
__ptr operator+(uint32_t i)
3231
{
3332
i *= sizeof(T);
3433
uint32_t2 newAddr = addr;
35-
uint32_t2 diff = spirv::OpIAddCarry(addr[0],i);
36-
newAddr[0] = diff[0];
37-
newAddr[1] += diff[1];
34+
AddCarryOutput<T> lsbAddRes = spirv::addCarry<uint32_t>(addr[0],i);
35+
newAddr[0] = lsbAddRes.result;
36+
newAddr[1] += lsbAddRes.carry;
3837
return __ptr::create(newAddr);
3938
}
4039
__ptr operator-(uint32_t i)
4140
{
4241
i *= sizeof(T);
4342
uint32_t2 newAddr = addr;
44-
uint32_t2 diff = spirv::OpISubBorrow(addr[0],i);
45-
newAddr[0] = diff[0];
46-
newAddr[1] -= diff[1];
43+
AddCarryOutput<T> lsbSubRes = spirv::subBorrow<uint32_t>(addr[0],i);
44+
newAddr[0] = lsbSubRes.result;
45+
newAddr[1] -= lsbSubRes.carry;
4746
return __ptr::create(newAddr);
4847
}
49-
#endif
5048

5149
template< uint64_t alignment=alignment_of_v<T> >
5250
__ref<T,alignment,false> deref()

include/nbl/builtin/hlsl/spirv_intrinsics/core.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,11 @@ enable_if_t<is_vector_v<BooleanVector>&& is_same_v<typename vector_traits<Boolea
329329

330330
template<typename T NBL_FUNC_REQUIRES(concepts::UnsignedIntegral<T>)
331331
[[vk::ext_instruction(spv::OpIAddCarry)]]
332-
AddCarryOutput<T> AddCarry(T operand1, T operand2);
332+
AddCarryOutput<T> addCarry(T operand1, T operand2);
333333

334334
template<typename T NBL_FUNC_REQUIRES(concepts::UnsignedIntegral<T>)
335335
[[vk::ext_instruction(spv::OpISubBorrow)]]
336-
SubBorrowOutput<T> SubBorrow(T operand1, T operand2);
336+
SubBorrowOutput<T> subBorrow(T operand1, T operand2);
337337

338338
}
339339

0 commit comments

Comments
 (0)