Render Command Batching State

By default, calls to IDirect3DDevice2::DrawPrimitive and IDirect3DDevice2::DrawIndexedPrimitive within a scene are batched. That is, they are buffered together and passed to the Direct3D device driver in one call. Changes in rendering states within the scene are also buffered. The buffer contents are passed to the device driver when the buffer is full or when the IDirect3DDevice2::EndScene method is invoked. This technique improves performance.

However, if an application makes change to the scene that are not changes to the rendering state, they may occur out of order with relation to the source code. For instance, if the contents of a texture are altered between calls to IDirect3DDevice2::DrawPrimitive or IDirect3DDevice2::DrawIndexedPrimitive, both primitives may be drawn with the new texture contents. Your application can resolve this problem by flushing the batching buffer before it makes scene changes that are not alterations of the rendering state.

An application flushes the batching buffer by calling IDirect3DDevice2::SetRenderState and passing the enumerated value D3DRENDERSTATE_FLUSHBATCH as the first parameter. The second parameter should be zero.

Note  This render state is only useful to applications that render with texture handles (using the IDirect3DDevice2 interface). Batched primitives are implicitly flushed when rendering with the IDirect3DDevice3 interface, as well as when rendering with execute buffers.