Skip to content

Commit

Permalink
allow setting shader object through python dictionary (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
skallweitNV authored Dec 6, 2024
1 parent 2bf7a15 commit 502626d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sgl/device/python/cursor_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,14 @@ class WriteConverterTable {
if (kind != TypeReflection::Kind::struct_)
type_layout = type_layout->element_type_layout();

// Handle shader object if possible.
if constexpr (requires { self.set_object(nullptr); }) {
if (nb::isinstance<MutableShaderObject>(nbval)) {
self.set_object(nb::cast<ref<MutableShaderObject>>(nbval));
return;
}
}

// Expect a dict for a slang struct.
if (nb::isinstance<nb::dict>(nbval)) {
auto dict = nb::cast<nb::dict>(nbval);
Expand Down

0 comments on commit 502626d

Please sign in to comment.