What is your Metal shader costing the GPU?
Paste a shader to see the patterns that slow it down on Apple GPUs, each with its fix. It runs in your browser; your shader never leaves this page.
The rules
Turn off a rule you don't want; this browser remembers.
What it can't see
The source alone shows patterns, not costs. Render passes, memory traffic and what each takes on the GPU need a capture of a frame: GPU frame analysis, in the Ray Kiln app with Plus, reads one with Apple's own tools, for your shader or a development build of your own app. Plus also runs these rules as you type, in the app’s editor and the playground’s, marking each line.
What it reads
Vertex, fragment and kernel functions, structs, attributes and template types. Macros aren't expanded and templates are skipped; a part it can't read is marked, and the rest is still checked. Try it on any episode from the playground, with Check in the linter, or from its page.
Keeping a pattern on purpose
A comment // lint:ignore turns findings off on its line, or on the next line when it stands alone. Name rules to turn off only those: // lint:ignore pow-constant. The summary counts what it turned off.