17.08.2015 Views

Fast mobile shaders or rather Mobile! Fast!

Fast mobile shaders - Unity Technologies Blog

Fast mobile shaders - Unity Technologies Blog

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Varyings / Interpolants••Pass data from vertex to fragmentMost GPUs: minimize count & pack• PowerVR, not so much!•Usually much cheaper to use m<strong>or</strong>evaryings if it helps avoiding indirecttexture reads• Likewise, do not pack 2 UVs into onefloat4/vec4 varying f<strong>or</strong> PowerVROn PowerVR, varyings are very cheap (NOT like almost all other GPUs). Using m<strong>or</strong>e varyingscan be a big win there if it helps avoid doing some math in the shader.One particular case: texture2D(...,var.xy) is good on PVR; texture2D(...,var.zw) is bad - theGPU treats it as a dependent texture read which can’t be prefetched. So do NOT pack two UVsinto one vec4 varying if you care about PowerVR perf<strong>or</strong>mance!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!