Skip to content

Commit 7a25770

Browse files
committed
report all known extensions, handle renderer objects
1 parent 1ca7c3a commit 7a25770

File tree

6 files changed

+29
-5
lines changed

6 files changed

+29
-5
lines changed

tsd/src/anari_tsd/DeviceGlobalState.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct DeviceGlobalState : public helium::BaseGlobalDeviceState
3030
int volumeCount{0};
3131
int fieldCount{0};
3232
int lightCount{0};
33+
int rendererCount{0};
3334
int worldCount{0};
3435
};
3536

tsd/src/anari_tsd/Frame.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ DeviceGlobalState *Frame::deviceState() const
2929
void Frame::commitParameters()
3030
{
3131
m_world = getParamObject<World>("world");
32+
m_renderer = getParamObject<TSDObject>("renderer");
33+
m_camera = getParamObject<TSDObject>("camera");
3234
}
3335

3436
void Frame::finalize()
@@ -37,6 +39,16 @@ void Frame::finalize()
3739
reportMessage(
3840
ANARI_SEVERITY_WARNING, "missing required parameter 'world' on frame");
3941
}
42+
43+
if (!m_renderer) {
44+
reportMessage(ANARI_SEVERITY_WARNING,
45+
"missing required parameter 'renderer' on frame");
46+
}
47+
48+
if (!m_camera) {
49+
reportMessage(
50+
ANARI_SEVERITY_WARNING, "missing required parameter 'camera' on frame");
51+
}
4052
}
4153

4254
bool Frame::getProperty(const std::string_view &name,

tsd/src/anari_tsd/Frame.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ struct Frame : public helium::BaseFrame
4444

4545
private:
4646
helium::IntrusivePtr<World> m_world;
47+
helium::IntrusivePtr<TSDObject> m_renderer;
48+
helium::IntrusivePtr<TSDObject> m_camera;
4749
};
4850

4951
} // namespace tsd_device

tsd/src/anari_tsd/Library.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ANARIDevice Library::newDevice(const char * /*subtype*/)
3131

3232
const char **Library::getDeviceExtensions(const char * /*deviceType*/)
3333
{
34-
return nullptr;
34+
return query_extensions();
3535
}
3636

3737
} // namespace tsd_device

tsd/src/anari_tsd/Object.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ TSDObject::TSDObject(
8686
obj = s->scene.createObject<tsd::core::Light>(subtype).data();
8787
name = "light" + std::to_string(s->lightCount++);
8888
break;
89+
case ANARI_RENDERER:
90+
obj = new tsd::core::Object(ANARI_RENDERER, subtype);
91+
name = "renderer" + std::to_string(s->rendererCount++);
92+
break;
8993
default:
9094
break;
9195
}
@@ -94,10 +98,13 @@ TSDObject::TSDObject(
9498
reportMessage(ANARI_SEVERITY_WARNING,
9599
"failed to create equivalent TSD object for %s",
96100
anari::toString(type));
97-
} else {
101+
return;
102+
} else if (type == ANARI_RENDERER)
103+
m_rendererObject.reset(obj);
104+
else
98105
m_object = tsd::core::Any(obj->type(), obj->index());
99-
obj->setName(name.c_str());
100-
}
106+
107+
obj->setName(name.c_str());
101108
}
102109

103110
void TSDObject::commitParameters()

tsd/src/anari_tsd/Object.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <helium/BaseObject.h>
99
#include <helium/utility/ChangeObserverPtr.h>
1010
// std
11+
#include <memory>
1112
#include <string_view>
1213

1314
namespace tsd_device {
@@ -41,7 +42,8 @@ struct TSDObject : public Object
4142
tsd::core::Object *tsdObject() const;
4243

4344
private:
44-
tsd::core::Any m_object;
45+
tsd::core::Any m_object; // scene ref for non-renderer objects
46+
std::unique_ptr<tsd::core::Object> m_rendererObject; // only if ANARI_RENDERER
4547
};
4648

4749
} // namespace tsd_device

0 commit comments

Comments
 (0)