Debugging and Validation

Reading compile errors, checking mmdx12.log, the CLI validation tool pack_check.exe (kind / group / capability output) and headless testing.

Dealing with compile errors

If a typo or type mismatch in your shader code causes a syntax error, MMDX12 does not force-quit:

  1. Automatic safe recovery: the character / effect with the error immediately falls back to the default MMD shading or the disabled state, so the screen stays intact.
  2. On-screen notice: a red error bar appears at the top.
  3. Effects tab diagnosis: open the Effects tab at the top and the pack’s state shows Compile error, with the DXC compiler’s original messages in the details panel on the right.
  4. Check the log file: in mmdx12.log, created next to the MMDX12.exe executable, lines starting with [E] give the exact source file name and line number:
    [E] surface.hlsl:48:12: error: no matching function for call to 'smoothstep'

Surface shaders check PackShade, screen effects check PackEffect / PackEffectState / each pass function, and PT / GI checks PackEvaluate / PackEvaluateLighting.

The standalone validation tool: pack_check.exe

pack_check.exe, distributed in the same folder as MMDX12.exe, is a command-line tool that validates a pack without running the app.

Usage

pack_check.exe <pack folder or pack.zip> [--compile]

What it checks

  • Manifest structure: required pack.json fields (version, name), ID rules, parameter counts (16 by default, 128 with params.ext) and material class syntax.
  • Kind and blocks: type (surface / effect / look / world) and the matching files / blocks (effect.hlsl, world.hlsl, look, world). A wrong kind or a missing file is an error.
  • Capabilities (requires): whether declared capabilities are known names, whether each meets the required apiVersion, and whether a pass’s history / mips declares the matching capability. Capabilities the app does not know cause Incompatible.
  • Groups and parameters: duplicate groups ids, parameter group references, types (float / int / bool / color / vec3) and default / min / max / step / alpha formats, and duplicate parameter keys.
  • File constraints: unpacked size up to 32 MB (64 MB for world effects), up to 200 files, and disallowed file extensions or symbolic links.
  • Offline shader compilation (--compile): invokes DXC to actually compile the raster, RT, (if present) PT / GI shaders and an effect pack’s PackEffect / PackEffectState / every passes entry.

pack_check prints the pack’s kind, required capability list, groups and each parameter’s type and range, so when editing a manifest you can immediately see how it was interpreted.

Exit codes and CI use

  • 0: validation succeeded (no problems)
  • 1: warnings or fatal errors found
# CI script example
pack_check.exe ./my_pack --compile
if [ $? -ne 0 ]; then
  echo "MMDX Effects validation failed"
  exit 1
fi

Templates and live hot reload

  1. In the app’s Effects tab, click New pack to start from a surface shader or screen effect template.
  2. MMDX12 keeps watching the pack folder in the background.
  3. Saving pack.json, *.hlsl, *.hlsli or preview images refreshes the cache and recompiles immediately.
  4. Pressing Ctrl + S in your editor refreshes the screen right away, with no top menu or shortcut fiddling.

Headless capture testing

Instead of driving the screen by hand, you can extract a particular frame to an image file to check shader results quickly:

MMDX12.exe --character "ModelName" --song "SongName" --autoplay --shader-pack my_pack --frames 600 --capture out.png

This command auto-plays to frame 600, captures out.png and exits, which makes visual before / after comparisons of shader changes easy. Screen effects can be applied for a single run with --effect, looks with --look and world effects with --world.