Export (0) Print
Expand All

Predicated Tiling

Describes predicated tiling in Xbox 360 development.

The Xbox 360 has 10 MB (10×1024×1024) of fast embedded dynamic RAM (EDRAM) that is dedicated for use as the back buffer, depth stencil buffer, and other render targets. Depending on the size and format of the render targets and the antialiasing level, it may not be possible to fit all targets in EDRAM at once. For example, 10 MB of EDRAM is enough to hold two 1280×720 32-bit surfaces with no multisample antialiasing (MSAA) or two 640×480 4× MSAA 32-bit surfaces. However, a 1280×720 2× MSAA 32-bits-per-pixel render target is 7,372,800 bytes. Combined with a 32-bit Z/stencil buffer of the same dimensions, it becomes apparent that 10 MB might not be sufficient.

Predicated tiling allows rendering to larger surfaces than can fit into EDRAM at any one time. In predicated tiling, the screen space is broken up into tiles (rectangles). The following figure shows the screen space broken into two tiles.

Bb464139.predicated_tiling(en-US,XNAGameStudio.30).jpg

In predicated tiling, the commands issued in the Draw method are recorded before execution. The recorded commands, such as DrawPrimitives calls, are then executed for each tile, predicated based on whether the rendered primitives intersect the tile. In the preceding figure, both the triangle primitives would be rendered in Tile 0. Once the primitives for a tile are fully rendered, the tile is then resolved into the texture that is used for the front buffer. Each successive tile is handled the same way and is resolved into the same texture.

Triggering Predicated Tiling

Predicated tiling occurs automatically for Xbox 360 games created with XNA Game Studio when the size and format of the render targets exceed the console's available EDRAM. In predicated tiling, the size of the render targets and the depth-stencil are no longer limited by EDRAM memory, although each individual tile has to fit into EDRAM.

Once predicated tiling has been triggered, all rendering commands in Draw are accumulated and played back for each tile in separate passes. An adjusted window offset and clip rectangle are used to render only those portions that intersect with the specified screen-space tile rectangle. Drawing is done only when the primitive drawing call is known to be visible on the given tile. This is determined by using hardware screen–space extent queries, which compute if the geometry lies within the tile. All rendering is then completed using the render target and depth stencil surface that are currently set.

Restrictions Encountered After Predicated Tiling Has Been Triggered

A few restrictions apply when predicated tiling has been triggered.

Resources that are referenced in the command buffer cannot be modified by the CPU, because the command buffer has to be played back more than once to accomplish the tiling. It is okay for the GPU to modify resources and then reuse them in the same pass, because the GPU can appropriately recreate the memory on every pass.

Specifically, in the Draw method of an Xbox 360 game, vertex buffers, index buffers, and textures should not be written to using SetData during the Draw method. This condition may lead to graphics corruption or crashes. For vertex buffers, this issue can be avoided by using DrawUserPrimitives or DrawUserIndexedPrimitives as the preferred alternative to VertexBuffer.SetData for dynamic vertex generation.

Data from an occlusion query (specifically, a call to IsComplete) on Xbox 360 is not available from within the tiling bracket. Access this data by switching to a different render target or end the frame. This condition does not apply to games targeting the Windows platform.

Community Additions

ADD
Show:
© 2014 Microsoft