Skip to content

Add RefDiffer, --no-render shader generation, and CI workflow docs - #33

Merged
ppenenko merged 2 commits into
metashade/devfrom
metashade/refdiffer-no-render
Jul 29, 2026
Merged

Add RefDiffer, --no-render shader generation, and CI workflow docs#33
ppenenko merged 2 commits into
metashade/devfrom
metashade/refdiffer-no-render

Conversation

@ppenenko

Copy link
Copy Markdown
Member

Summary

  • no_render flag in render_material(): generates and dumps shader source
    without GPU program creation, rendering, or image capture. Wired through
    render_element() and _render_elements() via --no-render CLI option.
  • RefDiffer (CI shader gate): re-introduces _RefDiffer (using filecmp.cmp,
    mirroring metashade.util.testing.RefDiffer) and _check_shader_baselines().
    In CI mode (--output-dir set), dumped .glsl files are compared against
    committed baselines; mismatches or missing baselines fail the test.
  • RenderEnvironment.is_ci_mode / get_baseline_dir(): detect when
    output_root diverges from repo_root / "contrib" and map output paths
    back to committed baseline locations.
  • README CI workflow: corrected test run sequence -- Metashade repo tests
    run between test_render.py (baseline renders) and test_render_metashade.py
    (override renders + comparison).

Test plan

  • Full metashade test suite passes (75 tests, 166 subtests)
  • --no-render generates shaders without rendering (2.3s vs 30s)
  • RefDiffer passes in CI mode (--output-dir /tmp/...) when baselines match
  • RefDiffer catches corrupted baseline (SUBFAILED with clear path message)

- Add no_render flag to render_material(): generates and dumps shaders
  without GPU program creation, rendering, or image capture.
- Re-add _RefDiffer (filecmp.cmp) and _check_shader_baselines(): in CI
  mode (--output-dir set), compares dumped .glsl files against committed
  baselines and fails on mismatch or missing baseline.
- Add RenderEnvironment.is_ci_mode and get_baseline_dir() to detect
  when output diverges from the committed tree.
- _render_elements always generates shaders (no_render skips GPU only,
  not shader gen), and runs RefDiffer automatically in CI mode.
- Update README CI workflow: correct test run sequence, document
  Metashade repo test dependency.

Signed-off-by: Pavlo Penenko <pavlo.penenko@autodesk.com>
@ppenenko
ppenenko force-pushed the metashade/refdiffer-no-render branch from 1382daa to d1f06da Compare July 29, 2026 19:34
@ppenenko
ppenenko requested a review from Copilot July 29, 2026 19:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the MaterialX render-test tooling to support shader-only generation (skipping GPU work) and introduces a CI-friendly shader baseline gate by comparing dumped GLSL against committed references when output is redirected outside contrib/. It also updates the contributor test README to document the correct CI invocation order (baseline renders → Metashade repo tests → override renders/compare).

Changes:

  • Add a no_render path in render_material() and thread it through the render test runner via --no-render.
  • Add a lightweight RefDiffer-style shader baseline comparison that runs in CI mode when --output-dir is set.
  • Update contrib/tests/README.md CI workflow instructions to reflect the intended sequencing and baseline behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
contrib/utilities/scripts/rendertest/mtlxutils/render_material.py Adds no_render shader-generation-only path and ensures shaders can still be dumped without GPU rendering.
contrib/tests/test_render.py Wires --no-render through the test runner and adds CI-mode shader baseline comparison utilities (_RefDiffer, _check_shader_baselines, baseline dir mapping).
contrib/tests/README.md Updates CI workflow documentation and explains when RefDiffer runs and how to use --no-render in GPU-less CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread contrib/tests/test_render.py Outdated
Comment on lines +65 to +67
When *no_render* is ``True``, shader source is generated and dumped
to *output_path* but GPU program creation, rendering and image
capture are skipped.
- Use filecmp.cmp(shallow=False) in _RefDiffer for byte-for-byte
  comparison instead of stat metadata (size + mtime).
- Clarify render_material docstring: shader dumping is conditional
  on output_path being provided.
- Update metashade submodule to include the matching shallow=False
  fix (metashade/metashade#202).

Signed-off-by: Pavlo Penenko <pavlo.penenko@autodesk.com>
@ppenenko
ppenenko merged commit 7cf3015 into metashade/dev Jul 29, 2026
36 checks passed
@ppenenko
ppenenko deleted the metashade/refdiffer-no-render branch July 29, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants