Skip to content

Commit

Permalink
Mark Quaternion as "special" array types
Browse files Browse the repository at this point in the history
This commit fixes gather/scatter operations on Quaternion types
  • Loading branch information
njroussel committed Jun 9, 2023
1 parent 8af56c1 commit 9a7ac4e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions include/drjit/quaternion.h
Expand Up @@ -22,6 +22,7 @@ struct Quaternion : StaticArrayImpl<Value_, 4, false, Quaternion<Value_>> {
DRJIT_ARRAY_DEFAULTS(Quaternion)

static constexpr bool IsQuaternion = true;
static constexpr bool IsSpecial = true;
static constexpr bool IsVector = false;

using ArrayType = Quaternion;
Expand Down
16 changes: 10 additions & 6 deletions tests/matrix.cpp
Expand Up @@ -14,15 +14,17 @@
#include "test.h"
#include <drjit/dynamic.h>
#include <drjit/matrix.h>
#include <drjit/quaternion.h>

namespace dr = drjit;

using Float = dr::DynamicArray<float>;
using UInt32 = dr::DynamicArray<uint32_t>;
using Mask = dr::mask_t<Float>;
using Array2f = dr::Array<Float, 2>;
using Matrix2f = dr::Matrix<Float, 2>;
using Matrix22f = dr::Matrix<Array2f, 2>;
using Float = dr::DynamicArray<float>;
using UInt32 = dr::DynamicArray<uint32_t>;
using Mask = dr::mask_t<Float>;
using Array2f = dr::Array<Float, 2>;
using Matrix2f = dr::Matrix<Float, 2>;
using Matrix22f = dr::Matrix<Array2f, 2>;
using Quaternion4f = dr::Quaternion<Float>;

template <typename Type> void test_scatter() {
int n = 999;
Expand All @@ -41,6 +43,7 @@ DRJIT_TEST(test01_scatter) {
test_scatter<Array2f>();
test_scatter<Matrix2f>();
test_scatter<Matrix22f>();
test_scatter<Quaternion4f>();
}

template <typename Type> void test_gather() {
Expand All @@ -59,4 +62,5 @@ DRJIT_TEST(test02_gather) {
test_gather<Array2f>();
test_gather<Matrix2f>();
test_gather<Matrix22f>();
test_gather<Quaternion4f>();
}

0 comments on commit 9a7ac4e

Please sign in to comment.