xref: /aosp_15_r20/external/mesa3d/docs/perf.rst (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1*61046927SAndroid Build Coastguard WorkerPerformance Tips
2*61046927SAndroid Build Coastguard Worker================
3*61046927SAndroid Build Coastguard Worker
4*61046927SAndroid Build Coastguard WorkerPerformance tips for software rendering:
5*61046927SAndroid Build Coastguard Worker
6*61046927SAndroid Build Coastguard Worker#. Turn off smooth shading when you don't need it (glShadeModel)
7*61046927SAndroid Build Coastguard Worker#. Turn off depth buffering when you don't need it.
8*61046927SAndroid Build Coastguard Worker#. Turn off dithering when not needed.
9*61046927SAndroid Build Coastguard Worker#. Use double buffering as it's often faster than single buffering
10*61046927SAndroid Build Coastguard Worker#. Compile in the X Shared Memory extension option if it's supported on
11*61046927SAndroid Build Coastguard Worker   your system by adding -DSHM to CFLAGS and -lXext to XLIBS for your
12*61046927SAndroid Build Coastguard Worker   system in the Make-config file.
13*61046927SAndroid Build Coastguard Worker#. Recompile Mesa with more optimization if possible.
14*61046927SAndroid Build Coastguard Worker#. Try to maximize the amount of drawing done between glBegin/glEnd
15*61046927SAndroid Build Coastguard Worker   pairs.
16*61046927SAndroid Build Coastguard Worker#. Use the MESA_BACK_BUFFER variable to find best performance in double
17*61046927SAndroid Build Coastguard Worker   buffered mode. (X users only)
18*61046927SAndroid Build Coastguard Worker#. Optimized polygon rasterizers are employed when: rendering into back
19*61046927SAndroid Build Coastguard Worker   buffer which is an XImage RGB mode, not grayscale, not monochrome
20*61046927SAndroid Build Coastguard Worker   depth buffering is GL_LESS, or disabled flat or smooth shading
21*61046927SAndroid Build Coastguard Worker   dithered or non-dithered no other rasterization operations enabled
22*61046927SAndroid Build Coastguard Worker   (blending, stencil, etc)
23*61046927SAndroid Build Coastguard Worker#. Optimized line drawing is employed when: rendering into back buffer
24*61046927SAndroid Build Coastguard Worker   which is an XImage RGB mode, not grayscale, not monochrome depth
25*61046927SAndroid Build Coastguard Worker   buffering is GL_LESS or disabled flat shading dithered or
26*61046927SAndroid Build Coastguard Worker   non-dithered no other rasterization operations enabled (blending,
27*61046927SAndroid Build Coastguard Worker   stencil, etc)
28*61046927SAndroid Build Coastguard Worker#. Textured polygons are fastest when: using a 3-component (RGB), 2-D
29*61046927SAndroid Build Coastguard Worker   texture minification and magnification filters are GL_NEAREST texture
30*61046927SAndroid Build Coastguard Worker   coordinate wrap modes for S and T are GL_REPEAT GL_DECAL environment
31*61046927SAndroid Build Coastguard Worker   mode glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST ) depth
32*61046927SAndroid Build Coastguard Worker   buffering is GL_LESS or disabled
33*61046927SAndroid Build Coastguard Worker#. Lighting is fastest when: Two-sided lighting is disabled
34*61046927SAndroid Build Coastguard Worker   GL_LIGHT_MODEL_LOCAL_VIEWER is false GL_COLOR_MATERIAL is disabled No
35*61046927SAndroid Build Coastguard Worker   spot lights are used (all GL_SPOT_CUTOFFs are 180.0) No local lights
36*61046927SAndroid Build Coastguard Worker   are used (all position W's are 0.0) All material and light
37*61046927SAndroid Build Coastguard Worker   coefficients are >= zero
38*61046927SAndroid Build Coastguard Worker#. XFree86 users: if you want to use 24-bit color try starting your X
39*61046927SAndroid Build Coastguard Worker   server in 32-bit per pixel mode for better performance. That is,
40*61046927SAndroid Build Coastguard Worker   start your X server with startx -- -bpp 32 instead of startx -- -bpp
41*61046927SAndroid Build Coastguard Worker   24
42*61046927SAndroid Build Coastguard Worker#. Try disabling dithering with the MESA_NO_DITHER environment variable.
43*61046927SAndroid Build Coastguard Worker   If this environment variable is defined Mesa will disable dithering
44*61046927SAndroid Build Coastguard Worker   and the command glEnable(GL_DITHER) will be ignored.
45