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