ไธญๆ | English
Version: 1.2.0
Updated: 2025-08-28
Unity Mali Compiler Integration Tool is a professional Unity Editor extension that allows developers to directly invoke ARM Mali Offline Compiler within Unity to analyze Shader performance, providing detailed performance metrics and optimization recommendations.
- One-Click Shader Analysis - Compile and analyze Shaders directly in Unity
- Smart Code Parsing - Automatically convert Unity Shaders to GLSL format for Mali Compiler
- Detailed Performance Reports - Provide key metrics including work registers, instruction cycles, bottleneck analysis
- Intelligent Optimization Suggestions - Automatically generate optimization recommendations based on compilation results
- Multi-GPU Support - Support various GPU models from Mali-G71 to Mali-G715
- Batch Processing - Support result saving, automatic report generation, etc.
- Visit ARM official website: https://developer.arm.com/tools-and-software/graphics-and-gaming/arm-mobile-studio/components/mali-offline-compiler
- Download the version corresponding to your operating system
- After installation, record the path to
malioc.exe
- Copy all
.csfiles from the tool package to theEditorfolder in your Unity project - Wait for Unity to complete compilation
- Find
Tools > Mali Compiler Integrationin the menu bar
- Open
Tools > Mali Compiler Integration > Main Window - Click the "Browse" button in "Configuration Settings"
- Select the
malioc.exefile of Mali Offline Compiler - Ready to use after successful configuration verification
- Verbose Output: Enable for more detailed compilation information
- Save Temporary Files: For debugging, save intermediate converted GLSL files
- Auto Save Results: Automatically save analysis reports locally
- Show Optimization Suggestions: Enable intelligent optimization suggestion feature
- Open Mali Compiler main window
- Select the Shader file to analyze
- (Optional) Specify a particular GPU model
- Click "๐ Start Analysis"
- View performance analysis report and optimization suggestions
- Select Shader file in Project window
- Right-click and select
Tools > Mali Compiler Integration > Quick Compile - Or use menu bar
Tools > Mali Compiler Integration > Quick Compile
- Open Mali Compiler window
- Directly drag Shader file into the window
- Automatically start analysis process
- Meaning: Number of registers used during Shader execution
- Optimization Goal: Lower is better (recommended โค32)
- Impact: Excessive numbers limit the number of threads that can execute in parallel
- Meaning: Read-only registers storing constant data
- Characteristics: Shared among all threads, relatively minor impact
- Meaning: Percentage of 16-bit precision operations used
- Optimization Goal: Higher is better (recommended โฅ50%)
- Impact: 16-bit operations are twice as fast as 32-bit operations
- Total Cycles: Cumulative cycles of all instructions
- Shortest Path: Cycles for optimized execution path
- Longest Path: Cycles for most complex execution path
- A (Arithmetic): Arithmetic operation bottleneck
- T (Texture): Texture sampling bottleneck
- LS (Load/Store): Memory read/write bottleneck
- V (Varying): Interpolation calculation bottleneck
- Has uniform computation: Contains uniform computation, recommend moving to CPU
- Uses late ZS test: Uses late depth testing, affects Early-Z optimization
- Has side-effects: Has side effects, affects parallel execution
- Stack spilling: Register overflow, serious performance issue
- ๐ด Critical: Performance issues that must be addressed immediately
- ๐ High: Significantly affects performance, recommend priority optimization
- ๐ก Medium: Some impact, moderate optimization recommended
- ๐ข Low: Minor impact, optimize when time permits
// โ Avoid: Too many local variables
float temp1 = calcA();
float temp2 = calcB();
float temp3 = calcC();
float result = temp1 * temp2 + temp3;
// โ
Recommended: Merge calculations
float result = calcA() * calcB() + calcC();// โ Avoid: Unnecessary high precision
float4 color = tex2D(_MainTex, uv);
float brightness = dot(color.rgb, float3(0.299, 0.587, 0.114));
// โ
Recommended: Use appropriate precision
half4 color = tex2D(_MainTex, uv);
half brightness = dot(color.rgb, half3(0.299, 0.587, 0.114));// โ Avoid: Complex branches
if (condition1) {
if (condition2) {
// Complex calculation
}
}
// โ
Recommended: Use lerp or step
float factor = step(0.5, condition1) * step(0.5, condition2);
result = lerp(defaultValue, complexValue, factor);// โ Avoid: Too many texture samples
float4 tex1 = tex2D(_Tex1, uv);
float4 tex2 = tex2D(_Tex2, uv);
float4 tex3 = tex2D(_Tex3, uv);
float4 tex4 = tex2D(_Tex4, uv);
// โ
Recommended: Texture packing or reduced sampling
float4 packedTex = tex2D(_PackedTex, uv);
float4 tex1 = packedTex.rrra;
float4 tex2 = packedTex.ggga;- Characteristics: Traditional separate processing units
- Optimization Focus: Arithmetic operation optimization
- Display Info: Arithmetic unit statistics
- Characteristics: Parallel processing engine with more detailed unit statistics
- Optimization Focus: Balance FMA, CVT, SFU units
- Display Info: Detailed unit breakdown
- Cause: Incorrect malioc.exe path configuration
- Solution: Re-download and install Mali Offline Compiler, confirm correct path
- Cause: Unsupported Shader format or complex Surface Shader
- Solution: Use standard Unity Shader format, avoid overly complex macro definitions
- Cause: HLSL to GLSL conversion error
- Solution: Check Shader syntax, avoid using unsupported functions
- Cause: Excessive register usage
- Solution: Reduce local variables, lower precision, simplify calculation logic
- Enable Verbose Output: Turn on verbose output mode in advanced options
- Save Temporary Files: View converted GLSL code to locate conversion issues
- Gradual Simplification: Start with simple Shaders, gradually increase complexity
| Metric | Mobile Target | High-end Target |
|---|---|---|
| Work Registers | โค16 | โค32 |
| 16-bit Arithmetic Ratio | โฅ60% | โฅ40% |
| Texture Samples | โค2 | โค4 |
| Longest Path Cycles | โค50 | โค100 |
| GPU Model | Performance Tier | Use Case |
|---|---|---|
| Mali-G71/G72 | Entry-level | Simple games, basic effects |
| Mali-G76/G77 | Mid-range | Medium complexity games |
| Mali-G78/G310 | Mid-high-end | Complex games, rich effects |
| Mali-G510+ | High-end | Top-tier games, advanced effects |
If you encounter issues during use, we recommend:
- Check detailed error information in Unity Console
- Enable "Verbose Output" mode for more information
- Check Mali Offline Compiler version compatibility
- Ensure Shader format meets tool requirements
Note: This tool is based on ARM Mali Offline Compiler and requires a valid Mali Compiler installation to work properly. The tool automatically handles most HLSL to GLSL conversions, but complex Shaders may require manual adjustments.