Conversation
| template<typename T> | ||
| inline T radians(NBL_CONST_REF_ARG(T) degrees) | ||
| { | ||
| static_assert( | ||
| is_floating_point<T>::value, | ||
| "This code expects the type to be either a double or a float." | ||
| ); | ||
|
|
||
| return degrees * PI<T>() / T(180); | ||
| } | ||
|
|
||
| template<typename T> | ||
| inline T degrees(NBL_CONST_REF_ARG(T) radians) | ||
| { | ||
| static_assert( | ||
| is_floating_point<T>::value, | ||
| "This code expects the type to be either a double or a float." | ||
| ); | ||
|
|
||
| return radians * T(180) / PI<T>(); | ||
| } |
There was a problem hiding this comment.
we have numbers ot something like that for PI and friends.
Also the _HLSL_VERSION case should forward to the inline SPIR-V from the std450 extended set
| DEFINE_MUL_QUATERNION_BY_SCALAR_OPERATOR(uint32_t) | ||
| DEFINE_MUL_QUATERNION_BY_SCALAR_OPERATOR(uint64_t) |
There was a problem hiding this comment.
this is a mistake, only provide mul with T
include/nbl/builtin/hlsl/matrix_utils/transformation_matrix_utils.hlsl
Outdated
Show resolved
Hide resolved
include/nbl/builtin/hlsl/matrix_utils/transformation_matrix_utils.hlsl
Outdated
Show resolved
Hide resolved
include/nbl/builtin/hlsl/matrix_utils/transformation_matrix_utils.hlsl
Outdated
Show resolved
Hide resolved
…H (ambiguity dependent type issues), reference #760
include/nbl/builtin/hlsl/matrix_utils/transformation_matrix_utils.hlsl
Outdated
Show resolved
Hide resolved
include/nbl/builtin/hlsl/matrix_utils/transformation_matrix_utils.hlsl
Outdated
Show resolved
Hide resolved
include/nbl/builtin/hlsl/matrix_utils/transformation_matrix_utils.hlsl
Outdated
Show resolved
Hide resolved
…ng/Nabla/pull/760/files#r1816728485 for #760 PR, update examples_tests submodule
|
|
||
| // TODO: if `IdentityFloat32_t3x4` and `IdentityFloat32_t3x4` constexprs are ok, then I can expand them into templated struct, not doing it untill the concept is approved | ||
| //template<typename T, uint32_t N, uint32_t M> | ||
| //struct IdentityMatrix |
There was a problem hiding this comment.
add
template<typename T>
concept MatrixType = requires
{
typename T::Base::row_type;
typename T::Base::col_type;
typename T::Base::value_type;
} && std::is_base_of_v<glm::mat<T::Base::row_type::length(), T::Base::col_type::length(), typename T::Base::value_type>, typename T::Base>;to matrix.hlsl just after definition (but ask @devshgraphicsprogramming if it should be named MatrixType)
then create diagonal utility
template<MatrixType Matrix>
constexpr inline Matrix diagonal(float scalar)
{
return Matrix(scalar);
}you can also template the scalar actually and make it value_type of the Matrix, now note that
matrix<T, N, M>(scalar)creates a diagonal matrix withscalarput on thediagonal- if your
N == Mthenmatrix<T, N, M>(1.f)is the identity matrix you need
so following diagonal create identity function (not struct!), you should be able to
using any_square_matrix_t = float32_t3x3;
constexpr auto bruh = hlsl::identity<any_square_matrix_t>()have constraints on the template parameter, let's allow only for square matrices
There was a problem hiding this comment.
but this is not C++ only file
There was a problem hiding this comment.
so we can't use concepts..
There was a problem hiding this comment.
typename T::Base::row_type;
typename T::Base::col_type;
typename T::Base::value_type;this is specific to GLM and won't pass in plain HLSL
| //{ | ||
| // | ||
| //}; | ||
| NBL_CONSTEXPR hlsl::float32_t3x4 IdentityFloat32_t3x4 = |
| //}; | ||
| NBL_CONSTEXPR hlsl::float32_t3x4 IdentityFloat32_t3x4 = | ||
| hlsl::float32_t3x4(hlsl::float32_t4(1, 0, 0, 0), hlsl::float32_t4(0, 0, 1, 0), hlsl::float32_t4(0, 0, 1, 0)); | ||
| NBL_CONSTEXPR hlsl::float32_t4x4 IdentityFloat32_t4x4 = |
| // TODO: this is temporary function, delete when removing vectorSIMD | ||
| template<typename T> | ||
| matrix<T, 4, 4> getMatrix3x4As4x4(const matrix<T, 3, 4>& mat) | ||
| inline core::vectorSIMDf transformVector(const matrix<T, 4, 4>& mat, const core::vectorSIMDf& vec) |
There was a problem hiding this comment.
shouldn't we also remove SIMD vectors?
| matrix<T, 4, 4> getMatrix3x4As4x4(const matrix<T, 3, 4>& mat) | ||
| inline core::vectorSIMDf transformVector(const matrix<T, 4, 4>& mat, const core::vectorSIMDf& vec) | ||
| { | ||
| core::vectorSIMDf output; |
There was a problem hiding this comment.
There was a problem hiding this comment.
I will remove every occurance of the simd vector when I work on it, no need to spam xd
| namespace transformation_matrix_utils_impl | ||
| { | ||
| template<typename T> | ||
| inline T determinant_helper(const matrix<T, 3, 3>& mat, vector<T, 3>& r1crossr2) |
There was a problem hiding this comment.
please document that your returned determinant is yielded by scalar triple product
| const vector<T, 3> zaxis = glm::normalize(position - target); | ||
| const vector<T, 3> xaxis = glm::normalize(hlsl::cross(upVector, zaxis)); | ||
| const vector<T, 3> yaxis = hlsl::cross(zaxis, xaxis); | ||
| static_assert(N >= 3 && M >= 3); |
There was a problem hiding this comment.
instead of doing static_assert lets have it in requires clause
There was a problem hiding this comment.
can't do since it is not C++ only file
| const vector<T, 3>& target, | ||
| const vector<T, 3>& upVector) | ||
| template<typename T, uint32_t N, uint32_t M> | ||
| inline matrix<T, 3, 3> getSub3x3TransposeCofactors(const matrix<T, N, M>& mat) |
There was a problem hiding this comment.
please document it returns adjugate (transpose of the cofactor matrix) of sub 3x3 mat matrix
| NBL_FORCE_INLINE T dot(const T& a, const T& b); | ||
| NBL_FORCE_INLINE T dot(const T& a, const T& b) | ||
| { | ||
| static_assert(!(std::is_same_v<T, hlsl::float32_t2> || std::is_same_v<T, hlsl::float32_t3> || std::is_same_v<T, hlsl::float32_t4>)); |
There was a problem hiding this comment.
can't do since it is not C++ only file
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
blake3: add reset()
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Prefix sum box blur
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
video: update profiles
Fix false positive aspect mask error raising
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
video: free command buffers when destroyed
Description
Testing
TODO list: