Skip to content

Commit

Permalink
Merge branch 'main' into nikelsm/materialx_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jstone-lucasfilm authored Sep 7, 2023
2 parents 386f4c0 + f822dc9 commit f84d479
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Added support for the [lin_displayp3 and srgb_displayp3](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1368) colorspaces in shader generation.
- Added support for the [blackbody PBR node](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1367) in shader generation.
- Added support for [displacement](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1396) in MDL generation.
- Added an up-axis control to the [triplanar projection node](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1489).
- Added version details to [shared libraries](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1447) on Windows.
- Added a [MacOS 13](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1375) build to GitHub Actions.

Expand All @@ -30,6 +31,7 @@
- Fixed [volume mixing](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1395) in MDL generation.
- Fixed a bug to improve [shader generation determinism](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1376).
- Fixed a bug to improve the [consistency of auto layout](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1389) in the MaterialX Graph Editor.
- Fixed a bug to enable [multi-output connection edits](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1506) in the MaterialX Graph Editor.

## [1.38.7] - 2023-04-21

Expand Down
5 changes: 5 additions & 0 deletions source/MaterialXRender/ShaderRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,9 @@ void ShaderRenderer::setSize(unsigned int, unsigned int)
{
}

void ShaderRenderer::updateUniform(const string&, ConstValuePtr)
{
throw ExceptionRenderError("Update uniform is not yet supported");
}

MATERIALX_NAMESPACE_END
3 changes: 3 additions & 0 deletions source/MaterialXRender/ShaderRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ class MX_RENDER_API ShaderRenderer
/// Validate inputs for the program.
virtual void validateInputs() { }

/// Update the program with value of the uniform.
virtual void updateUniform(const string& name, ConstValuePtr value);

/// Set the size of the rendered image.
virtual void setSize(unsigned int width, unsigned int height);

Expand Down
10 changes: 10 additions & 0 deletions source/MaterialXRenderGlsl/GlslRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ void GlslRenderer::validateInputs()
_program->getAttributesList();
}

void GlslRenderer::updateUniform(const string& name, ConstValuePtr value)
{
if (!_program->bind())
{
return;
}

_program->bindUniform(name, value);
}

void GlslRenderer::setSize(unsigned int width, unsigned int height)
{
if (_context->makeCurrent())
Expand Down
3 changes: 3 additions & 0 deletions source/MaterialXRenderGlsl/GlslRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class MX_RENDERGLSL_API GlslRenderer : public ShaderRenderer
/// Validate inputs for the program
void validateInputs() override;

/// Update the program with value of the uniform.
void updateUniform(const string& name, ConstValuePtr value) override;

/// Set the size of the rendered image
void setSize(unsigned int width, unsigned int height) override;

Expand Down
3 changes: 3 additions & 0 deletions source/MaterialXRenderMsl/MslRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class MX_RENDERMSL_API MslRenderer : public ShaderRenderer
/// Validate inputs for the program
void validateInputs() override;

/// Update the program with value of the uniform.
void updateUniform(const string& name, ConstValuePtr value) override;

/// Set the size of the rendered image
void setSize(unsigned int width, unsigned int height) override;

Expand Down
5 changes: 5 additions & 0 deletions source/MaterialXRenderMsl/MslRenderer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@
_program->getAttributesList();
}

void MslRenderer::updateUniform(const string& name, ConstValuePtr value)
{
_program->bindUniform(name, value);
}

void MslRenderer::createFrameBuffer(bool encodeSrgb)
{
_framebuffer = MetalFramebuffer::create(_device,
Expand Down
1 change: 1 addition & 0 deletions source/PyMaterialX/PyMaterialXRender/PyShaderRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void bindPyShaderRenderer(py::module& mod)
.def("createProgram", static_cast<void (mx::ShaderRenderer::*)(mx::ShaderPtr)>(&mx::ShaderRenderer::createProgram))
.def("createProgram", static_cast<void (mx::ShaderRenderer::*)(const mx::ShaderRenderer::StageMap&)>(&mx::ShaderRenderer::createProgram))
.def("validateInputs", &mx::ShaderRenderer::validateInputs)
.def("updateUniform", &mx::ShaderRenderer::updateUniform)
.def("setSize", &mx::ShaderRenderer::setSize)
.def("render", &mx::ShaderRenderer::render);

Expand Down

0 comments on commit f84d479

Please sign in to comment.