This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.

 

  Implicit Vertex Buffers Under Direct3D
  Submitted by



I thought I would post a little tidbit that may be obvious to some and not to others regarding implicit vertex buffers in Direct3D. Direct3D uses implicit vertex buffers when Direct3D does TnL. These implicit vertex buffers differ from the explicit vertex buffers an application might create with a IDirect3D7::CreateVertexBuffer call. The API puts the results from TnL into these buffers and passes them to the device driver. If the vertex buffer is in video memory, the device driver doesn't ( or shouldn't ) have to copy the vertex buffer from system to video memory for graphics device accessibility. Unfortunately, when the API creates implicit vertex buffers it will create the buffers in system memory if application doesn't disable clipping ( D3DRENDERSTATE_CLIPPING = FALSE ). The rationale is justified since clipping requires transformed vertices to be read back in from the implicit vertex buffer for clipping. The tip is to only enable API clipping when clipping is required. For those primitives inside the viewport ( or possibly guardband ) will be transformed directly into video memory avoiding an extra hidden vertex copy by the driver. Also, if it is feasible, sorting clipped vs. unclipped primitives (objects) can be helpful. This could be extended to only enable clipping if primitives are inside the guard band which can be somewhat risky if device drivers don't implement guard band clipping correctly.

The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.

 

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.