Skip to content

Commit

Permalink
update docstrings (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
skallweitNV authored Aug 19, 2024
1 parent cd3c7b8 commit 55da053
Show file tree
Hide file tree
Showing 4 changed files with 726 additions and 287 deletions.
8 changes: 4 additions & 4 deletions src/sgl/device/python/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ SGL_PY_EXPORT(device_device)
"get_format_supported_resource_states",
&Device::get_format_supported_resource_states,
"format"_a,
D_NA(Device, get_format_supported_states)
D(Device, get_format_supported_resource_states)
);

device.def_prop_ro("slang_session", &Device::slang_session, D(Device, slang_session));
device.def("close", &Device::close, D_NA(Device, close));
device.def("close", &Device::close, D(Device, close));
device.def(
"create_swapchain",
[](Device* self,
Expand Down Expand Up @@ -251,7 +251,7 @@ SGL_PY_EXPORT(device_device)
"height"_a = SwapchainDesc().height,
"image_count"_a = SwapchainDesc().image_count,
"enable_vsync"_a = SwapchainDesc().enable_vsync,
D_NA(Device, create_swapchain, 2)
D(Device, create_swapchain, 2)
);
device.def(
"create_swapchain",
Expand Down Expand Up @@ -581,7 +581,7 @@ SGL_PY_EXPORT(device_device)
"cache_path"_a.none() = nb::none(),
D(Device, create_slang_session)
);
device.def("reload_all_programs", &Device::reload_all_programs, D_NA(Device, reload_all_programs));
device.def("reload_all_programs", &Device::reload_all_programs, D(Device, reload_all_programs));
device.def("load_module", &Device::load_module, "module_name"_a, D(Device, load_module));
device.def(
"load_module_from_source",
Expand Down
24 changes: 12 additions & 12 deletions src/sgl/device/python/reflection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ SGL_PY_EXPORT(device_reflection)
nb::sgl_enum<DeclReflection::Kind>(decl_reflection, "Kind");

decl_reflection //
.def_prop_ro("kind", &DeclReflection::kind, D_NA(DeclReflection, kind))
.def_prop_ro("children", &DeclReflection::children, D_NA(DeclReflection, children))
.def_prop_ro("child_count", &DeclReflection::child_count, D_NA(DeclReflection, child_count))
.def_prop_ro("kind", &DeclReflection::kind, D(DeclReflection, kind))
.def_prop_ro("children", &DeclReflection::children, D(DeclReflection, children))
.def_prop_ro("child_count", &DeclReflection::child_count, D(DeclReflection, child_count))
.def_prop_ro("name", &DeclReflection::name)
.def("children_of_kind", &DeclReflection::children_of_kind, "kind"_a, D_NA(DeclReflection, children_of_kind))
.def("as_type", &DeclReflection::as_type, D_NA(DeclReflection, as_type))
.def("as_variable", &DeclReflection::as_variable, D_NA(DeclReflection, as_variable))
.def("as_function", &DeclReflection::as_function, D_NA(DeclReflection, as_function))
.def("children_of_kind", &DeclReflection::children_of_kind, "kind"_a, D(DeclReflection, children_of_kind))
.def("as_type", &DeclReflection::as_type, D(DeclReflection, as_type))
.def("as_variable", &DeclReflection::as_variable, D(DeclReflection, as_variable))
.def("as_function", &DeclReflection::as_function, D(DeclReflection, as_function))
.def(
"find_children_of_kind",
&DeclReflection::find_children_of_kind,
"kind"_a,
"child_name"_a,
D_NA(DeclReflection, find_children_of_kind)
D(DeclReflection, find_children_of_kind)
)
.def(
"find_first_child_of_kind",
&DeclReflection::find_first_child_of_kind,
"kind"_a,
"child_name"_a,
D_NA(DeclReflection, find_first_child_of_kind)
D(DeclReflection, find_first_child_of_kind)
)
.def("__len__", [](DeclReflection& self) { return self.child_count(); })
.def(
Expand Down Expand Up @@ -120,7 +120,7 @@ SGL_PY_EXPORT(device_reflection)
.def_prop_ro("name", &FunctionReflection::name)
.def_prop_ro("return_type", &FunctionReflection::return_type)
.def_prop_ro("parameters", &FunctionReflection::parameters)
.def("has_modifier", &FunctionReflection::has_modifier, "modifier"_a, D_NA(FunctionReflection, has_modifier));
.def("has_modifier", &FunctionReflection::has_modifier, "modifier"_a, D(FunctionReflection, has_modifier));

nb::sgl_enum<ModifierID>(m, "ModifierID");

Expand All @@ -129,7 +129,7 @@ SGL_PY_EXPORT(device_reflection)
nb::class_<VariableReflection, BaseReflectionObject>(m, "VariableReflection")
.def_prop_ro("name", &VariableReflection::name)
.def_prop_ro("type", &VariableReflection::type)
.def("has_modifier", &VariableReflection::has_modifier, "modifier"_a, D_NA(VariableReflection, has_modifier));
.def("has_modifier", &VariableReflection::has_modifier, "modifier"_a, D(VariableReflection, has_modifier));

nb::class_<VariableLayoutReflection, BaseReflectionObject>(m, "VariableLayoutReflection")
.def_prop_ro("name", &VariableLayoutReflection::name)
Expand All @@ -147,7 +147,7 @@ SGL_PY_EXPORT(device_reflection)
&EntryPointLayout::compute_thread_group_size,
D(EntryPointLayout, compute_thread_group_size)
)
.def_prop_ro("parameters", &EntryPointLayout::parameters, D_NA(EntryPointLayout, parameters))
.def_prop_ro("parameters", &EntryPointLayout::parameters, D(EntryPointLayout, parameters))
.def("__repr__", &EntryPointLayout::to_string);

bind_list_type<EntryPointLayoutParameterList>(m, "EntryPointLayoutParameterList");
Expand Down
14 changes: 7 additions & 7 deletions src/sgl/device/python/shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ SGL_PY_EXPORT(device_shader)
{
using namespace sgl;

nb::class_<TypeConformance>(m, "TypeConformance", D_NA(TypeConformance))
nb::class_<TypeConformance>(m, "TypeConformance", D(TypeConformance))
.def(nb::init<>())
.def(nb::init<std::string, std::string, int32_t>(), "type_name"_a, "interface_name"_a, "id"_a = -1)
.def(
Expand All @@ -65,9 +65,9 @@ SGL_PY_EXPORT(device_shader)
tuple.size() > 2 ? nb::cast<int32_t>(tuple[2]) : -1};
}
)
.def_rw("interface_name", &TypeConformance::interface_name, D_NA(TypeConformance, interface_name))
.def_rw("type_name", &TypeConformance::type_name, D_NA(TypeConformance, type_name))
.def_rw("id", &TypeConformance::id, D_NA(TypeConformance, id))
.def_rw("interface_name", &TypeConformance::interface_name, D(TypeConformance, interface_name))
.def_rw("type_name", &TypeConformance::type_name, D(TypeConformance, type_name))
.def_rw("id", &TypeConformance::id, D(TypeConformance, id))
.def("__repr__", &TypeConformance::to_string);
nb::implicitly_convertible<nb::tuple, TypeConformance>();

Expand Down Expand Up @@ -180,7 +180,7 @@ SGL_PY_EXPORT(device_shader)
using sgl::SlangEntryPoint;

nb::class_<SlangSession, Object>(m, "SlangSession", D(SlangSession))
.def_prop_ro("device", &SlangSession::device, D_NA(SlangSession, device))
.def_prop_ro("device", &SlangSession::device, D(SlangSession, device))
.def_prop_ro("desc", &SlangSession::desc, D(SlangSession, desc))
.def("load_module", &SlangSession::load_module, "module_name"_a, D(SlangSession, load_module))
.def(
Expand Down Expand Up @@ -211,12 +211,12 @@ SGL_PY_EXPORT(device_shader)
.def("load_source", &SlangSession::load_source, "module_name"_a, D(SlangSession, load_source));

nb::class_<SlangModule, Object>(m, "SlangModule", D(SlangModule))
.def_prop_ro("session", &SlangModule::session, D_NA(SlangModule, session))
.def_prop_ro("session", &SlangModule::session, D(SlangModule, session))
.def_prop_ro("name", &SlangModule::name, D(SlangModule, name))
.def_prop_ro("path", &SlangModule::path, D(SlangModule, path))
.def_prop_ro("layout", &SlangModule::layout, D(SlangModule, layout))
.def_prop_ro("entry_points", &SlangModule::entry_points, D(SlangModule, entry_points))
.def_prop_ro("module_decl", &SlangModule::module_decl, D_NA(SlangModule, module_decl))
.def_prop_ro("module_decl", &SlangModule::module_decl, D(SlangModule, module_decl))
.def(
"entry_point",
&SlangModule::entry_point,
Expand Down
Loading

0 comments on commit 55da053

Please sign in to comment.