Skip to content

Commit

Permalink
Docstrings for PyMaterialXGen* classes.
Browse files Browse the repository at this point in the history
Similar to AcademySoftwareFoundation#2051 and AcademySoftwareFoundation#2061 and AcademySoftwareFoundation#2063.

Split from AcademySoftwareFoundation#1567.

Update AcademySoftwareFoundation#342.

Signed-off-by: Stefan Habel <19556655+StefanHabel@users.noreply.github.com>
  • Loading branch information
StefanHabel committed Oct 13, 2024
1 parent 0ba2ad0 commit 241b8db
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/MaterialXGenMsl/MslResourceBindingContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ MATERIALX_NAMESPACE_BEGIN
using MslResourceBindingContextPtr = shared_ptr<class MslResourceBindingContext>;

/// @class MslResourceBindingContext
/// Class representing a resource binding for Msl shader resources.
/// Class representing a resource binding for MSL shader resources.
class MX_GENMSL_API MslResourceBindingContext : public HwResourceBindingContext
{
public:
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXGenMsl/MslShaderGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MATERIALX_NAMESPACE_BEGIN

using MslShaderGeneratorPtr = shared_ptr<class MslShaderGenerator>;

/// Base class for MSL (OpenGL Shading Language) code generation.
/// Base class for MSL (Metal Shading Language) code generation.
/// A generator for a specific MSL target should be derived from this class.
class MX_GENMSL_API MslShaderGenerator : public HwShaderGenerator
{
Expand Down
19 changes: 19 additions & 0 deletions source/PyMaterialX/PyMaterialXGenGlsl/PyGlslShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ void bindPyGlslShaderGenerator(py::module& mod)
.def("generate", &mx::GlslShaderGenerator::generate)
.def("getTarget", &mx::GlslShaderGenerator::getTarget)
.def("getVersion", &mx::GlslShaderGenerator::getVersion);
mod.attr("GlslShaderGenerator").doc() = R"docstring(
Base class for GLSL (OpenGL Shading Language) code generation.
A generator for a specific GLSL target should be derived from this class.
:see: https://materialx.org/docs/api/class_glsl_shader_generator.html)docstring";
}

void bindPyGlslResourceBindingContext(py::module &mod)
Expand All @@ -34,6 +40,11 @@ void bindPyGlslResourceBindingContext(py::module &mod)
.def(py::init<size_t, size_t>())
.def("emitDirectives", &mx::GlslResourceBindingContext::emitDirectives)
.def("emitResourceBindings", &mx::GlslResourceBindingContext::emitResourceBindings);
mod.attr("GlslResourceBindingContext").doc() = R"docstring(
Class representing a resource binding for GLSL (OpenGL Shading Language)
shader resources.
:see: https://materialx.org/docs/api/class_glsl_resource_binding_context.html)docstring";
}

// Essl shader generator bindings
Expand All @@ -46,6 +57,10 @@ void bindPyEsslShaderGenerator(py::module& mod)
.def("generate", &mx::EsslShaderGenerator::generate)
.def("getTarget", &mx::EsslShaderGenerator::getTarget)
.def("getVersion", &mx::EsslShaderGenerator::getVersion);
mod.attr("EsslShaderGenerator").doc() = R"docstring(
An ESSL (OpenGL ES Shading Language) shader generator.
:see: https://materialx.org/docs/api/class_essl_shader_generator.html)docstring";
}

// Glsl Vulkan shader generator bindings
Expand All @@ -58,4 +73,8 @@ void bindPyVkShaderGenerator(py::module& mod)
.def("generate", &mx::VkShaderGenerator::generate)
.def("getTarget", &mx::VkShaderGenerator::getTarget)
.def("getVersion", &mx::VkShaderGenerator::getVersion);
mod.attr("VkShaderGenerator").doc() = R"docstring(
A Vulkan GLSL (OpenGL Shading Language) shader generator.
:see: https://materialx.org/docs/api/class_vk_shader_generator.html)docstring";
}
4 changes: 4 additions & 0 deletions source/PyMaterialX/PyMaterialXGenMdl/PyMdlShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ void bindPyMdlShaderGenerator(py::module& mod)
.def_static("create", &mx::MdlShaderGenerator::create)
.def(py::init<>())
.def("getTarget", &mx::MdlShaderGenerator::getTarget);
mod.attr("MdlShaderGenerator").doc() = R"docstring(
Shader generator for MDL (Material Definition Language).
:see: https://materialx.org/docs/api/class_mdl_shader_generator.html)docstring";
}
6 changes: 6 additions & 0 deletions source/PyMaterialX/PyMaterialXGenMsl/PyMslShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ void bindPyMslShaderGenerator(py::module& mod)
.def("generate", &mx::MslShaderGenerator::generate)
.def("getTarget", &mx::MslShaderGenerator::getTarget)
.def("getVersion", &mx::MslShaderGenerator::getVersion);
mod.attr("MslShaderGenerator").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 @@ -32,4 +36,6 @@ void bindPyMslResourceBindingContext(py::module &mod)
.def(py::init<size_t, size_t>())
.def("emitDirectives", &mx::MslResourceBindingContext::emitDirectives)
.def("emitResourceBindings", &mx::MslResourceBindingContext::emitResourceBindings);
mod.attr("MslResourceBindingContext").doc() = R"docstring(
Class representing a resource binding for MSL shader resources.)docstring";
}
6 changes: 6 additions & 0 deletions source/PyMaterialX/PyMaterialXGenOsl/PyOslShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ void bindPyOslShaderGenerator(py::module& mod)
.def(py::init<>())
.def("getTarget", &mx::OslShaderGenerator::getTarget)
.def("generate", &mx::OslShaderGenerator::generate);
mod.attr("OslShaderGenerator").doc() = R"docstring(
Base class for OSL (Open Shading Language) shader generators.
A generator for a specific OSL target should be derived from this class.
:see: https://materialx.org/docs/api/class_osl_shader_generator.html)docstring";
}

0 comments on commit 241b8db

Please sign in to comment.