glslviewer-shader-debug
Adapt fragment shaders or runtime-shader snippets into standard GLSL, render them with glslViewer in headless mode, and inspect PNG output for shader debugging. Use when Codex needs to validate SDFs, gradients, masks, edge contours, or intermediate shader math by producing reproducible preview images from `.frag` files or translated shader snippets.
How do I install this agent skill?
npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill glslviewer-shader-debugIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides a secure workflow for debugging and rendering GLSL fragment shaders headlessly using the glslViewer tool. It includes a shell script for rendering and documentation for shader translation, following standard security practices for local command execution.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
glslViewer Shader Debug
Use this skill to turn shader math into repeatable headless previews.
Workflow
- Confirm
glslVieweris available withcommand -v glslViewer || command -v glslviewer. - Create a scratch
.fragfile, usually by copyingassets/sdf-contour-template.frag. - Translate the source shader into standard GLSL.
- Render the shader with
scripts/render_headless.sh. - Inspect the generated PNGs and compare the contour or mask shape against expectations.
Translation Rules
- For runtime-shader or SkSL-like snippets, read
references/runtime-effect-to-glsl.md. - Keep the math identical first. Change syntax before changing behavior.
- Replace non-standard types such as
half4orfloat2with GLSL equivalents. - Rewrite
main(vec2 fragCoord)into standard fragment entrypoint form:
void main()
{
vec2 fragCoord = gl_FragCoord.xy;
fragColor = ...;
}
- Prefer adding a contour or mask visualization instead of staring at raw SDF alpha. The template already includes a reusable
previewColor()helper.
Rendering
Render one or more fragment shaders like this:
/root/.codex/skills/glslviewer-shader-debug/scripts/render_headless.sh path/to/a.frag path/to/b.frag
Useful options:
--output DIR: choose output directory--size WIDTHxHEIGHT: choose render size, default256x256GLSLVIEWER_BIN=/full/path/to/glslViewer: force a specific binary
The script writes one PNG per input shader plus a frame directory that contains the original exported frame.
Validation Heuristics
- For rounded-rect SDFs, top and bottom scanlines should narrow near the corners.
- For gradients or normals, prefer false-color output so directional changes are obvious.
- If the headless preview looks correct but device output does not, suspect uniform binding, backend shader translation, or downstream thresholding rather than the pure math.
Resources
- Renderer:
scripts/render_headless.sh - Translation notes:
references/runtime-effect-to-glsl.md - Starter template:
assets/sdf-contour-template.frag
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/openharmonyinsight/openharmony-skills/glslviewer-shader-debug">View glslviewer-shader-debug on skillZs</a>