性能三 powerVR specfication

2.Optimising Geometry

  Interleaving Attributes

VBO

Draw call size

Triangle Size  32个像素/primitive    ---3vertex so 10pixel/vertex

Face Culling

Sorting Geometry

  Distance

  Render state

Z Pre-pass 不推荐做 因为没用 会有额外clocks 和bandwidth开销

3.Texture

texture size 不是越大越好,大的会费memory和引起cachemissing,最近的时候texel:pixel为1:1,一定用压缩。

NPOT  not power of two

512x128 是POT

NPOT使用GL_CLAMP_TO_EDGE 用默认repeat会有error

有扩展专门处理它 GL_IMG_texture_npot

推荐使用32的倍数

推荐不要使用NPOT 性能下降 涉及mipmaplevel  sizeofTexture target platform

Texture Compression

他家有工具PVRTexTool

PVRTC特点是smaller memory footprint省电

jpc等等是image compression 会在system memory里解压

PVRTC压缩状态直接提交graphic core使用

mipmap 减小cachemissing降低带宽 反走样 memory开销增加

Texture Sampling

dependent texture read 会有fetch texture开销 如果有复杂alu开销可以 通过调度把fetch 开销给掩盖掉 

vertex shader lookup 是dependent texture read

只用varying的部分通道比如zw也算 dependent texture read

Texture2DProj() 参数Vec3 或者Vec4有无效的w也是dependent texture read

尽量在vs里算uv 即使PowerVR对此有一定优化, Rouge better than SGX

Texture Uploading

非压缩的tex 是line-scan-line format读取

压缩tex 是block-by-block读取

texture 初始化时传入 最好用他们画一遍trangle 这样可以warm up

颜色用lowp

浮点数                                  精度                整数范围 

FP32 highp             ,,[2^31-1,-2^31]

FP16 Mediump [-65504.0,65504.0],,[2^15-1,-2^15] --32768   1 5 11

十位定的小数 lowp   [-2.2], 1/256, [2^9-1,-2^9]

https://docs.unity3d.com/Manual/SL-DataTypesAndPrecision.html

手机 float highp

         half Mediump

浮点数精度这里,抄个东西在手机上遇到half的问题

pc上没有这个问题,原来pc会自动把half转为float处理 怪不得我就奇怪他们都是FP16为什么只有手机有问题。。

原文地址:https://www.cnblogs.com/minggoddess/p/10728282.html