Skip to content

Commit 6e7314a

Browse files
committed
fix broken object arrays in TSD
1 parent 5349e42 commit 6e7314a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

tsd/src/tsd/objects/Array.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,18 @@ anari::Object Array::makeANARIObject(anari::Device d) const
116116

117117
anari::Object retval = nullptr;
118118

119+
const void *ptr = anari::isObject(elementType()) ? nullptr : m_data;
119120
switch (type()) {
120121
case ANARI_ARRAY1D:
121-
retval =
122-
anari::newArray1D(d, m_data, nullptr, nullptr, elementType(), dim(0));
122+
retval = anari::newArray1D(d, ptr, nullptr, nullptr, elementType(), dim(0));
123123
break;
124124
case ANARI_ARRAY2D:
125125
retval = anari::newArray2D(
126-
d, m_data, nullptr, nullptr, elementType(), dim(0), dim(1));
126+
d, ptr, nullptr, nullptr, elementType(), dim(0), dim(1));
127127
break;
128128
case ANARI_ARRAY3D:
129129
retval = anari::newArray3D(
130-
d, m_data, nullptr, nullptr, elementType(), dim(0), dim(1), dim(2));
130+
d, ptr, nullptr, nullptr, elementType(), dim(0), dim(1), dim(2));
131131
break;
132132
default:
133133
break;
@@ -180,8 +180,6 @@ Array::Array(anari::DataType arrayType,
180180
{
181181
if (anari::isObject(type) && kind == MemoryKind::CUDA)
182182
throw std::runtime_error("cannot create CUDA arrays of objects!");
183-
else if (anari::isObject(type))
184-
return;
185183

186184
if (isEmpty()) {
187185
logWarning("%s of %s elements created with 0 size",

tsd/src/tsd/rendering/RenderIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void RenderIndex::populate(Context &ctx, bool setAsUpdateDelegate)
5959
auto createANARICacheArrays =
6060
[&](const auto &objArray, auto &handleArray, bool supportsCUDA) {
6161
foreach_item_const(objArray, [&](auto *obj) {
62-
if (!obj || !supportsCUDA && obj->kind() == Array::MemoryKind::CUDA)
62+
if (!obj || (!supportsCUDA && obj->kind() == Array::MemoryKind::CUDA))
6363
handleArray.insert(nullptr);
6464
else
6565
handleArray.insert((anari::Array)obj->makeANARIObject(d));

0 commit comments

Comments
 (0)