Datasets:
license: other
task_categories:
- text-generation
language:
- en
tags:
- graphics
- glsl
- wgsl
- hlsl
- metal
- spir-v
- webgpu
- shaders
- compiler-validated
size_categories:
- 10K<n<100K
ShaderCross Graphics Dataset v1.1
Multi-dialect shader corpus where every dialect is produced by a real compiler and validated by a real validator.
What changed from the previous release
The earlier release advertised a five-way polyglot matrix but generated it with regular-expression substitution. Measured on the published files:
| Claim | Measured reality |
|---|---|
| Five dialects via compilers | wgsl_transpiler.py was ~60 regexes; subprocess was imported but never called |
| Valid targets | dxc -T ps_6_0 rejected the HLSL: layout(location = 0) in float3 v_WorldPos; |
| Distinct implementations | quick_ratio(glsl, wgsl) = 0.9996; 82% of records were four near-identical copies |
| Zero-junk filtering | validation was all zeros; 42% of records were not shaders (e.g. a tree-sitter C scanner) |
| Dense corpus | 41.6% of bytes were exact duplicates stored under two keys |
v1.1 replaces the transpiler with glslang -> spirv-cross -> naga and validates
each target with spirv-val, glslangValidator, dxc and wgpu. On the same
GGX shader, GLSL-to-HLSL similarity fell from 0.9996 to 0.715 and dxc now
accepts the output.
Generation and validation matrix
| Dialect | Generator | This run | Validator |
|---|---|---|---|
| SPIR-V | glslangValidator -V | 855/860 (99%) | spirv-val |
| GLSL 330 | spirv-cross | 709/829 (86%) | glslangValidator |
| ESSL 300 | spirv-cross | 695/752 (92%) | glslangValidator |
| HLSL SM6.0 | spirv-cross | 708/784 (90%) | dxc (authoritative) |
| MSL 2.0 | spirv-cross | emitted, unverified | none exists on Linux |
| WGSL | sampler-split + naga | 544/719 (76%) | wgpu.create_shader_module |
msl_status is reported as EMITTED_UNVERIFIED, never PASSED: no Metal
compiler exists outside macOS, and overstating that is what made the previous
release untrustworthy.
The WGSL fix
GLSL's sampler2D is a combined image sampler; WGSL requires separate
texture_2d<f32> and sampler bindings. naga cannot bridge that gap, so 64% of
shaders failed conversion with invalid id %N. Twelve SPIR-V hygiene strategies
scored 0/40. Normalising the source instead lifted WGSL from 36% to 86%.
Contents
| File | Records |
|---|---|
dataset_full.jsonl |
566 |
dataset_permissive.jsonl |
537 |
dataset_noncommercial.jsonl |
29 |
diagnostic_bugfix_pairs.jsonl |
2076 |
metrics.json |
pipeline counters |
Parquet mirrors use nested Arrow structs rather than JSON-in-a-string.
Diagnostic pairs
Compilation failures are not discarded. Each becomes a record with the compiler
invocation, its exact log, and an explanation. Cases marked is_fixable: false
are constructs that cannot exist in the target API at all - subpass input,
gl_PointCoord, mesh shaders, descriptor indexing - which teaches genuine
portability boundaries.
Pipeline statistics for this build
repositories : 64/102 cloned
files scanned: 5769
candidates : 2893
accepted : 566
diagnostics : 2076
rejected : L0=2579 licence=297 inflation=23
duplicates : exact=90 near=144
tokens : 3,871,248
elapsed : 673s
Toolchain
{
"glslang": "Glslang Version: 10:11.8.0",
"spirv_cross": "(Debian package)",
"spirv_val": "SPIRV-Tools v2022.2-dev unknown hash, 2022-02-16T16:37:15",
"spirv_opt": "SPIRV-Tools v2022.2-dev unknown hash, 2022-02-16T16:37:15",
"spirv_dis": "SPIRV-Tools v2022.2-dev unknown hash, 2022-02-16T16:37:15",
"naga": "30.0.0",
"dxc": "libdxcompiler.so: 1.8(dev;3944-3e105849)"
}
Licensing
Records carry license and license_category. Use dataset_permissive.jsonl
for commercial pre-training; dataset_noncommercial.jsonl holds CC-BY-NC and
GPL-derived material for research only.
Schema
See docs/ARCHITECTURE_v1.1.md in the source repository. Key point: generated
code lives in exactly one place, implementations.*, and validation is
tri-state (PASSED / FAILED / EMITTED_UNVERIFIED) so unprovable claims are
representable rather than rounded up to success.