Why Deterministic CPU Reference Renderers Still Matter in GPU Pipelines
Notes from building real-time AGSL and WebGL2 imaging engines where visual parity across mobile drivers depends on a bit-verifiable CPU oracle.
Contents (4)
When shipping real-time image shaders—whether AGSL on Android or WebGL2 in the browser—the fastest way to accumulate subtle visual regressions is to trust driver-specific GPU math as your sole source of truth. Different mobile GPUs vary in half-precision (mediump) rounding, sRGB texture sampling, and edge clamping.
While building LiEffects and editorium, pairing every live GPU shader graph with a deterministic CPU reference renderer turned out to be the highest-leverage engineering decision in both codebases.
The Verification Contract#
We treat the GPU path as a fast approximation of a pure functional reference operator . For a test image , we verify that the GPU output satisfies a strict perceptual and numeric envelope:
Pipeline Parity Flow#
Shared Transfer Function Math#
Both the shader and CPU reference execute identical piecewise sRGB linearization before any tone-mapping or film curve is applied:
fun srgbToLinear(c: Float): Float {
val clamped = c.coerceIn(0f, 1f)
return if (clamped <= 0.04045f) {
clamped / 12.92f
} else {
((clamped + 0.055f) / 1.055f).pow(2.4f)
}
}Measured Trade-Offs#
| Pipeline Stage | GPU Preview (1080p) | CPU Reference (12 MP Export) | Peak PSNR Parity |
|---|---|---|---|
| Tone Curve + White Balance | 0.9 ms | 118 ms | 56.2 dB |
| 3D Hald LUT (33³ Tetrahedral) | 1.4 ms | 240 ms | 51.8 dB |
| Stateless Film Grain + Vignette | 1.1 ms | 164 ms | 54.0 dB |
Footnotes#
-
Stateless coordinate hashing also guarantees tiled high-resolution exports never exhibit visible seam discontinuities along tile boundaries. ↩
Cite this thought
Academic BibTeX entry for referencing this note.
@misc{ali2026_deterministic_image_pipelines,
author = {Ali, MD Ahad},
title = {{Why Deterministic CPU Reference Renderers Still Matter in GPU Pipelines}},
howpublished = {aliahadmd.github.io},
year = {2026},
month = oct,
url = {https://aliahadmd.github.io/thoughts/2026-10-deterministic-image-pipelines/}
}