alandtse / alandtse/hlslkit

Adopt shader-verification tooling from Open Shaders (perm-gen, refactor-verify, compile-bench)

Ouverte
#19 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
1
Forks
0
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Three shader-tooling scripts were written in [alandtse/open-shaders](https://github.com/alandtse/open-shaders) during a shader-decomposition effort that has since been shelved (superseded by upstream [community-shaders#2220](https://github.com/community-shaders/skyrim-community-shaders/pull/2220)). They contain **no fork-specific content** — they operate on the shared CS shader tree (`package/Shaders` + `features/*/Shaders`), hlslkit's `shader-validation.yaml` format, and the shared runtime's `[ShaderTiming]` log — so they belong in hlslkit, where both Community Shaders and Open Shaders benefit, rather than living forked in one repo.

Filing this so the work isn't lost; no urgency.

## The tools

Reference: `alandtse/open-shaders` closed PR #158 and branch `refactor/shader-decomposition` @ `b05863fdba3851c92ce462fa800506fe9126967a`.

1. **`tools/gen-verify-perms.py`** — reads a hlslkit `shader-validation.yaml` matrix and emits per-shader/stage permutation lists (full + a stratified subset covering every define symbol + known-hot combos + a fixed-seed sample). Feeds fxc-based verification/bench. **Pure Python, consumes hlslkit's own config format → the cleanest drop-in, a natural companion to `hlslkit-generate`.**

2. **`tools/verify-shader-refactor.ps1`** — proves an HLSL refactor is behavior-preserving: compiles a shader from a base git ref vs the working tree across a permutation list and compares **DXBC (Tier 1)** or **fxc `/P` preprocessed text (Tier 0)**. Parallel fxc workers, per-base-SHA caching, batch+bisect with a fail-fast probe. Materializes the base ref's include tree via `git archive` so shared `.hlsli` edits compare correctly. **PowerShell — would need a Python port to live as a hlslkit command (e.g. `hlslkit-verify-refactor`).**

3. **`tools/shader-compile-bench.ps1`** — measures shader compile time two ways: offline fxc at **release parity** (`/O3`, no debug flags), or parsing `[ShaderTiming]` lines from a `CommunityShaders.log`. **PowerShell — Python port needed (e.g. `hlslkit-bench`).**

## Suggested approach

- `gen-verify-perms.py` is a near-direct contribution (Python, config consumer).
- The two PowerShell scripts' logic should be reimplemented as Python hlslkit subcommands.

## Near-term use case

Validating community-shaders#2220 (`perf: terrain variation & parallax`): the compile-bench would confirm its claimed compile-time win; perm-gen + verify-refactor would check coverage/regressions across the matrix (incl. VR).

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.