Partager via


Writing Pixels

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

In the final stage of the pixel processing pipeline, the values--such as pixel color, depth and stencil values--generated by the pixel processing up to this point are written to the appropriate coordinates at the appropriate buffers. There are several render states that control how the pixel's values are written into the buffers. You can set values for all of these render states by calling the IDirect3DMobileDevice::SetRenderState method.

You can control which colors are written to the render target by setting a value for the D3DMRS_COLORWRITEENABLE render state (see D3DMRENDERSTATETYPE). The value for this render state is a combination of one or more D3DMCOLORWRITEENABLE Values. When you set the flag for a particular color channel, that color channel is written to the render target. If the flag is clear, the color channel is not written. Bits that are not used for these flags are ignored.

You can toggle write operations to the depth buffer on or off by setting a value for the D3DMRS_ZWRITEENABLE render state.

You can control which bits are written into the stencil buffer by setting a value for the D3DMRS_STENCILWRITEMASK render state. Each bit in the render state value corresponds to a bit in the stencil buffer, low bit to low bit and proceeding up. If the bit is set in the render state value, then the corresponding bit in the stencil buffer may be written. For example, if the stencil buffer has 8 bits, and the stencil write mask is set to 0x000000FE, then the top 7 bits of the incoming stencil value will be written and the bottom bit will not.

Once the pixel data has been written into the render target, processing continues on to the next pixel.

See Also

Concepts

Per Pixel Operations