The rest of the ui/shader API: typed uniforms, Metal shaders compiled ahead of their first draw, and shaders that read the backdrop.
Shaders (ui/shader)
- Typed uniforms. Look a variable up once with
s.Uniform(name)and set it ons.NewValues()withFloat,Vec2…Vec4,Int,Uint,Bool,Floats,Ints,UintsandColor. Pass them asOptions.Values. Each setter checks the variable's type and size and panics on a mismatch, so a typo fails loudly. Drawing withValuesallocates nothing.Options.Uniformsstill works, and overrides the names it holds. (#385) - Colors in the window's gamut. A
ui.Coloruniform reaches the shader in sRGB. A wide color (ui.Oklch) reaches it in extended sRGB on wide-gamut windows. (#385) - Metal shaders compile ahead. On macOS a shader's Metal library and pipeline are now compiled on a goroutine as soon as
Compilereturns, as Windows already did (#381). A shader compiled at startup draws its first frame in about 10 ms instead of about 200 ms. (#386) - Backdrop. A shader can read what the window drew behind it with
backdropAt(p)andbackdropSample(p), andOptions.BackdropBlurblurs it first, as Flutter'sBackdropFilterdoes. This works inDrawand in element effects. It works on Metal, Direct3D, GL and the CPU renderer. (#387)
These three were stacked on #384 and had not reached main; #401 landed them.
Documents
- A document now follows its file when another app saves it and renames it right away; before, it could be marked deleted. On Windows, documents open their files with
FILE_SHARE_DELETE, as Notepad and VS Code do, so other apps can replace them while the app reads them. (#395)
Tests
- Tests wait for what happens, never for a time:
internal/waitreplaces every per-test deadline (#391). The GUI tests' input hooks return once the app has handled the input, on macOS, Linux and Windows (#393). Both remove causes of CI's flaky tests.
Full Changelog: v0.5.3...v0.5.4