mobile-shader-optimization

Installation
SKILL.md

Mobile Shader Optimization for Unity

TRIGGER

Use this skill when the user is writing, reviewing, or optimizing Unity shaders for mobile platforms (Android, iOS) or any GPU-constrained environment (Meta Quest VR, low-end devices). Triggers include: mentions of "mobile", "Android", "iOS", "Mali", "Adreno", "PowerVR", "performance", "optimization", "fillrate", "overdraw", "bandwidth", "frame budget", "half precision", "LOD", "baked lighting", or any shader work targeting sub-60fps scenarios. Also trigger when the user is profiling shaders, asking about GPU architecture, or comparing Simple Lit vs Complex Lit in URP.


CORE RULES — HARD CONSTRAINTS

These rules must always be followed when writing mobile shaders:

  1. Use half precision by default. Only use float for world-space positions, UV coordinates requiring high precision, and depth calculations. On Mali and Adreno GPUs, half triggers 16-bit fast paths that are 2x faster.

  2. Never use discard (clip/alpha-test) on PowerVR or Apple GPUs. It breaks Early-Z/Hidden Surface Removal, forcing the GPU to process fragments it would otherwise skip. Use alpha blending instead, or move discard to a separate pass.

  3. Keep Shader Graph node count under 100 for mobile. Each node compiles to shader instructions. Exceeding ~100 nodes risks exceeding mobile GPU instruction limits and causes performance cliffs.

  4. Never use while or do-while loops in shaders targeting OpenGL ES 2.0 / WebGL 1.0. Only counting for loops are allowed. Even on ES 3.0+, avoid dynamic loop bounds — they prevent the compiler from unrolling.

Installs
37
GitHub Stars
9
First Seen
Mar 28, 2026
mobile-shader-optimization — adevra/unity-shader-agent-skills