原文请见:参考地址
使用mali offline shader compiler分析shader的性能瓶颈。
下载Arm Performance Studio
编译Unity Shader
通常选择GLES3x。
You might need to select GLES3x, as this is the graphics API Mali works well with.
编译之后得到一个.shader文件,搜索#ifdef
,可以分别把Vert和Frag下的代码粘贴到单独的文件中。
代码示例如下:
Vertex Shader: shader.vert
//#ifdef VERTEX
#version 300 es
#define HLSLCC_ENABLE_UNIFORM_BUFFERS 1
#if HLSLCC_ENABLE_UNIFORM_BUFFERS
#define UNITY_UNIFORM
#else
#define UNITY_UNIFORM uniform
#endif
#define UNITY_SUPPORTS_UNIFORM_LOCATION 1
#if UNITY_SUPPORTS_UNIFORM_LOCATION
#define UNITY_LOCATION(x) layout(