-
Notifications
You must be signed in to change notification settings - Fork 65
New morton class with arithmetic and comparison operators #860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 28 commits
cdcc9ad
8e84558
d33fab5
5fe6c08
f18b2fa
7d86cba
4ebc555
55a2ef6
f516256
534d81b
6256390
246cefc
1c7f791
5088799
e25a35c
0d9dd4a
89d2bf2
de4d0fb
799420e
52323bc
b6b7003
60ff99a
5560162
e50c56b
b1de9c3
ea8cd43
53a5f6a
cf52d9c
f954522
2d0ffba
68edc32
5013c89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
+2 −1 | CMakeLists.txt | |
+24 −0 | XX_Mortons/CMakeLists.txt | |
+7 −0 | XX_Mortons/app_resources/shader.hlsl | |
+28 −0 | XX_Mortons/config.json.template | |
+69 −0 | XX_Mortons/main.cpp | |
+50 −0 | XX_Mortons/pipeline.groovy |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef _NBL_BUILTIN_HLSL_CPP_COMPAT_IMPL_VECTOR_IMPL_INCLUDED_ | ||
#define _NBL_BUILTIN_HLSL_CPP_COMPAT_IMPL_VECTOR_IMPL_INCLUDED_ | ||
|
||
#include <nbl/builtin/hlsl/cpp_compat/basic.h> | ||
#include <nbl/builtin/hlsl/cpp_compat/vector.hlsl> | ||
#include <nbl/builtin/hlsl/concepts.hlsl> | ||
|
||
// To prevent implicit truncation warnings | ||
namespace nbl | ||
{ | ||
namespace hlsl | ||
{ | ||
namespace impl | ||
{ | ||
|
||
template<typename T, uint16_t N, uint16_t M> NBL_PARTIAL_REQ_TOP(N <= M) | ||
struct static_cast_helper<vector<T, N>, vector<T, M> NBL_PARTIAL_REQ_BOT(N <= M) > | ||
{ | ||
NBL_CONSTEXPR_STATIC_INLINE_FUNC vector<T, N> cast(NBL_CONST_REF_ARG(vector<T, M>) val) | ||
{ | ||
vector<T, N> retVal; | ||
[[unroll]] | ||
for (uint16_t i = 0; i < N; i++) | ||
{ | ||
retVal[i] = val[i]; | ||
} | ||
return retVal; | ||
} | ||
}; | ||
|
||
} | ||
} | ||
} | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,12 @@ inline bool any(Vector vec) | |
return cpp_compat_intrinsics_impl::any_helper<Vector>::__call(vec); | ||
} | ||
|
||
template<typename Condition, typename ResultType> | ||
NBL_CONSTEXPR_INLINE_FUNC ResultType select(Condition condition, ResultType object1, ResultType object2) | ||
{ | ||
return cpp_compat_intrinsics_impl::select_helper<Condition, ResultType>::__call(condition, object1, object2); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but we already have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can drop this and just use mix, yeah There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok the thing is that select can either: -take a -take a so the latter does exactly the same as mix, but it also can act as the usual ternary There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aaah ok |
||
/** | ||
* @brief Returns x - floor(x). | ||
* | ||
|
@@ -217,6 +223,19 @@ inline T refract(NBL_CONST_REF_ARG(T) I, NBL_CONST_REF_ARG(T) N, NBL_CONST_REF_A | |
return cpp_compat_intrinsics_impl::refract_helper<T, U>::__call(I, N, eta); | ||
} | ||
|
||
template<typename T> | ||
NBL_CONSTEXPR_INLINE_FUNC spirv::AddCarryOutput<T> addCarry(NBL_CONST_REF_ARG(T) operand1, NBL_CONST_REF_ARG(T) operand2) | ||
{ | ||
return cpp_compat_intrinsics_impl::addCarry_helper<T>::__call(operand1, operand2); | ||
} | ||
|
||
template<typename T> | ||
NBL_CONSTEXPR_INLINE_FUNC spirv::SubBorrowOutput<T> subBorrow(NBL_CONST_REF_ARG(T) operand1, NBL_CONST_REF_ARG(T) operand2) | ||
devshgraphicsprogramming marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
return cpp_compat_intrinsics_impl::subBorrow_helper<T>::__call(operand1, operand2); | ||
} | ||
|
||
|
||
#ifdef __HLSL_VERSION | ||
#define NAMESPACE spirv | ||
#else | ||
|
Uh oh!
There was an error while loading. Please reload this page.