|
|
Frequently Asked Questions Optimising Your Game for PowerVR in SGL Direct Ensure the operating mode is set to 'maximum performance' in the PowerVR display properties box. If you are using a Matrox graphics card with older drivers the mode will always be set to 'maximum compatibility'. More recent Matrox drivers have fixed this problem. For PowerVR Immediate mode Direct3D is about 20-25% slower than SGL Direct, or much slower still if the D3D transformation and lighting modules are used - do the geometry and lighting calculations in the application itself and supply D3DTLVERTEX structures in the vertex list of the execute buffer. The DrawPrimitive is not yet publicly available (Direct3D will automatically convert the instructions into execute buffer format). We expect DrawPrimitive to substantially exceed ExecuteBuffer performance when completed. SGL Direct is much faster than SGL meshes or convexes. SGL is intended as a high level language for ease of programming, though its long term future is under review. To maximise use of the Pentium's instruction cache do all transformation, lighting and projection for the entire scene before sending all of the triangles to the PowerVR driver with sgltri_triangles/quads calls. Share vertices between adjacent triangles wherever possible to minimise the size of the vertex buffer to be traversed. Overlapping and optimal 2D and texture memory accessing times (see previous chapter). Also, to improve reaction times (though not the frame rate) do the blit/flip as soon as the hardware render is complete - don't leave it until just before the next render call. Minimise the number of calls to sgltri_triangles/quads. Group polygons together by sorting by texture instead of Z. For games (usually Playstation conversions) that store multiple textures in single large hardware texture maps, reconfigure the artwork so all opaque textures are in separate texture maps from the translucent textures (including colour key transparency). This also allows use of 555 colour depth instead of 444. Alternatively in D3D switch off alpha blending for triangles that don't use translucent parts of textures; or in SGL Direct set the SGLTT_OPAQUE flag when using opaque areas of 4444 textures. Use mipmapping for all textures. SGLTT_MIPMAPOFFSET can be used to reduce or remove any undesirable blurring effects of mipmapping. If switching bilinear off increases performance then mipmapping will definitely help, especially in bilinear mode. Remember that PowerVR always has at least 3.5Mb of texture memory so there is planty of space for the extra 30% for mipmapping. Using 'adaptive bilinear' filtering on mipmapped textures is often faster than normal bilinear because the adaptive mode interpolates between the mipmap levels (two texture reads per pixel) instead of always within the current level (four reads per pixel). Both use normal bilinear (four reads) for the top mipmap level. To experiment with these bilinear modes go to the 'Advanced' section of the PowerVR display properties box. Use quads as well as triangles (a quad is 35-40% faster than two triangles). In both Direct3D and SGL Direct you can use 4,5,6,7... sided polygons. See earlier chapter for how to do this. There is a separate chapter on texturing and translucency that describes how to maximise translucent polygon performance. For high frame rate games that have static backgrounds, do the background in 2D, and use DONT_RENDER_EMPTY_REGIONS. When doing this put the background only into the bounding box of regions that contain 3D objects. See the chapter on clipping for more information. Smaller 2D items may be faster to render in 3D than to blit in 2D. Specify pixel bounding boxes for shadows and light volumes. Make the bounding boxes as small as possible to fit the shadows. This reduces the number of 32x32 regions in which the shadow volumes are compared with the positions of the visisble objects. Instead of doing multiple renders, put all scenes/viewports for the frame into a single render. (Multiple renders can cause bad overlap problems unless the CPU can be kept usefully busy while each of the hardware renders takes place.) Use the fast texture loading function, sgl_direct_set_texture. Store the textures in preprocessed native format (0555 or 4444) to achieve the maximum upload speed. To reduce swapping out to virtual memory store textures in 8-bit palettised format to halve system memory usage. They are expanded to 16bit for the hardware texture memory on upload, though since PowerVR has at least 3.5Mb this should present no problem. Try to keep as many of the games textures as possible in hardware texture memory. Use sgl_get_texture_mem_info for detailed information on what storage space is left. Don't do software Z sorting as PowerVR does this in hardware without any performance cost.
|
Confidential / provided under Non-Disclosure Agreement Copyright © 1999-2000, PowerVR Technologies and partners. PowerVR Technologies is a division of Imagination Technologies Limited. |