by Matt McClellan, Kipp Owens, and Cody Northrop
Zone Rendering greatly reduces the required memory bandwidth for a 3D pipeline by rendering one small section of a scene at a time. As each frame is generated, the scene is divided into a number of varying zones, each small enough to fit into on-die cache. Since the hardware is working on a very small amount of data, triangle sorting and depth calculations can be done on chip which eliminates many slow steps of traditional rendering. For instance, all pixel color blending and depth calculations can be done at once, and no external depth buffer is required. Compared to brute force rendering methods that process a scene polygon by polygon, the amount of required graphics memory bandwidth used is minimal. Intel integrated graphics gets a big performance boost from using this technique. Details on how Zone Rendering works versus traditional rendering are available from the following two links:
- Intel® 82865G Graphics Controller: Zone Rendering White Paper
- ZR: a 3D API transparent technology for chunk rendering
While Zone Rendering is extremely beneficial, there are several things that can occur within an application that prevents the binning of pixels to occur. When these events occur the 3D pipeline is essentially serialized and Zone Rendering is dynamically disabled for Intel integrated graphics. Unable to process the data by zone, the graphics engine defaults to a traditional rendering pipeline that does not do any active pixel culling. Scenes with a lot of depth that normally benefit from Zone Rendering will slow down dramatically since pixels blocked by objects in the foreground are no longer skipped by the renderer. Noticeable differences in framerate can be perceived when this happens.
In order to avoid falling out of Zone Rendering, here are several methods, discussed fully in the following sections, that can reduce the chances of it happening:
- Change Render Targets Outside of Scene
- Avoid Reading Back from Buffers
- Avoid Locking the Buffers
- Take Care When Clearing Buffers
- Avoid Blitting 2D Data into a 3D Scene
Change Render Targets Outside of Scene
Changing rendering targets is used for creating a variety of effects. Where these calls are made can have a significant performance impact on the performance of Intel integrated graphics. It is recommended that if any changes to the render target are made, they should be done before or after the scene is rendered.
Figure 2. Correct render target change method.
For example, if a render to texture technique is used to create a shadow effect, the render to texture could be completed at a variety of points. Completing the render to texture before the scene will result in increased performance by allowing Zone Rendering mode to stay active and by avoiding unnecessary buffer evictions.
Avoid Reading Back from Buffers
Reading back from color, z, or stencil buffers, has a significant impact to performance on any graphics chip. The read backs themselves are slow and can potentially cause Intel’s integrated graphics to be forced out of Zone Rendering mode into classic rendering mode which further degrades performance. It is recommended to avoid reading back data from any of the buffers, but the z-buffer in particular is most costly on Intel graphics and perhaps the most easily avoidable. One advantage of Zone Rendering is that a z-buffer does not need to be maintained at all. Reading back from the z-buffer, however, forces the maintenance of a z-buffer and will degrade performance.
Avoid Locking the Buffers
Locking buffers is often done for synchronization reasons or for creating visual effects. Unfortunately, locking buffers can have a significant impact on performance and will possibly cause Intel’s integrated graphics devices to be forced out of Zone Rendering mode into classic rendering mode. It is recommended to lock buffers sparingly, if at all. The following are some methods that can be used for avoiding the locking of buffers:
- Use multiple vertex buffers
- Use dynamic vertex buffers
- Batch triangles as much as possible
Take Care When Clearing Buffers
There are a wide variety of reasons for clearing any one of the buffers (depth, color, or stencil). How these buffers are cleared will determine whether there is a Zone Rendering mode performance impact in the application.
Clearing the buffers together and once per frame is the best option. In cases when this is not possible, the depth and stencil buffers should be cleared together. Similarly, partially clearing buffers can have a negative impact on performance. Fast clear options that allow the entire buffer to clear quickly will not be implemented if a buffer is only partially cleared.
//NOT recommended, but if necessary to clear more than once // Clear the zbuffer, and stencil buffer together m_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, 0xff00bfff, 1.0f, 0L ); … // Clear the viewport m_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET, 0xff00bfff, 1.0f, 0L ); … m_pD3DDevice->BeginScene(); … m_pD3DDevice->EndScene();
Figure 3. Reducing buffer clears
Reduce Memory Usage If Necessary
Zone Rendering improves performance by reducing memory bandwidth requirements. However, Intel’s integrated graphics devices can be forced out of Zone Rendering mode into classic rendering mode by providing too much geometry, texture, and/or state information to memory. Hardware binning is unable to continue due to lack of available memory. Below is a list of potential ways to reduce the memory bandwidth required to render a scene:
- Use compressed textures
- Use D3DPOOL_MANAGED or D3DPOOL_DEFAULT when allocating surface, buffer, or texture memory
- Reduce texture size or quality
- Use varying level-of-detail for models
- Reduce the content footprint by employing efficient culling algorithms
Avoid Blitting 2D Data Into a 3D Scene
Using two dimensional data within a 3D scene is sometimes used to render objects like scoreboards and road signs. When that blit request is sent to or from a buffer, the data contained within must be updated, causing a pipeline flush and disabling Zone Rendering. One easy way to generate the same effect is to use a quad or a billboard that is aligned to the view frustrum. Similarly, a flip operation while rendering to a back buffer will cause serialization. Be sure you are done altering the back buffer before you flip.
Figure 4. Quad usage versus blitting.
This article is intended to help developers understand one of the underlying performance enhancing features that Intel Integrated Graphics uses. The software tips included should enable more applications to benefit from Zone Rendering.
- Complete source code that demonstrates several techniques for working around Z fighting issues in DirectX* 9.0.
- Alternatives to Using Z-Bias to Fix Z-Fighting Issues
- Intel® Extreme Graphics 2 [PDF, 318 KB] provides an overview of the chipset features and capabilities associated with Intel Extreme Graphics 2.
- Microsoft DirectX* contains the DirectX* runtime and software required to create DirectX-compliant applications.
- ATI Depth Bias Example* is a sample application that demonstrates the use of depth bias to eliminate z-fighting.
- Intel® Digital Media Developer Center provides insight, tips, tools, and training to cre ate top-notch media applications.
- Intel® Games Developer Center presents coding resources for game developers on Intel® architecture.