Skip to content

Commit

Permalink
Sphinx Python Documentation (#1567) - Added docstrings to PyMaterialX…
Browse files Browse the repository at this point in the history
…GenMsl.
  • Loading branch information
StefanHabel committed Oct 18, 2023
1 parent e715c0f commit 6a9d8e5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
27 changes: 26 additions & 1 deletion source/PyMaterialX/PyMaterialXGenMsl/PyModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,32 @@ void bindPyMslResourceBindingContext(py::module &mod);

PYBIND11_MODULE(PyMaterialXGenMsl, mod)
{
mod.doc() = "Shader generation using Metal Shading Language";
mod.doc() = R"docstring(
Shader generation using Metal Shading Language.
:see: https://developer.apple.com/metal/
:see: https://developer.apple.com/documentation/metal
MSL Shader Generation Classes
-----------------------------
**Class Hierarchy**
* `PyMaterialXGenShader.ShaderGenerator`
* `PyMaterialXGenShader.HwShaderGenerator`
* `MslShaderGenerator`
* `PyMaterialXGenShader.GenUserData`
* `PyMaterialXGenShader.HwResourceBindingContext`
* `MslResourceBindingContext`
**Class Index**
.. autosummary::
:toctree: msl-shader-generators
MslShaderGenerator
MslResourceBindingContext
)docstring";

// PyMaterialXGenMsl depends on types defined in PyMaterialXGenShader
pybind11::module::import("PyMaterialXGenShader");
Expand Down
11 changes: 9 additions & 2 deletions source/PyMaterialX/PyMaterialXGenMsl/PyMslShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ void bindPyMslShaderGenerator(py::module& mod)
.def(py::init<>())
.def("generate", &mx::MslShaderGenerator::generate)
.def("getTarget", &mx::MslShaderGenerator::getTarget)
.def("getVersion", &mx::MslShaderGenerator::getVersion);
.def("getVersion", &mx::MslShaderGenerator::getVersion)
.doc() = R"docstring(
Base class for MSL (Metal Shading Language) code generation.
A generator for a specific MSL target should be derived from this class.
)docstring";
}

void bindPyMslResourceBindingContext(py::module &mod)
Expand All @@ -33,5 +37,8 @@ void bindPyMslResourceBindingContext(py::module &mod)
.def_static("create", &mx::MslResourceBindingContext::create)
.def(py::init<size_t, size_t>())
.def("emitDirectives", &mx::MslResourceBindingContext::emitDirectives)
.def("emitResourceBindings", &mx::MslResourceBindingContext::emitResourceBindings);
.def("emitResourceBindings", &mx::MslResourceBindingContext::emitResourceBindings)
.doc() = R"docstring(
Class representing a resource binding for MSL shader resources.
)docstring";
}

0 comments on commit 6a9d8e5

Please sign in to comment.