Sign in to follow this  
67rtyus

CreateDevice with D3DCREATE_HARDWARE_VERTEXPROCESSING and Vertex Buffers

Recommended Posts

Hi; When I was searching through in the DirectX 9 documentation this evening, I found something weird, which arised a question in me. In the page for the IDirect3DDevice9::CreateVertexBuffer, the documentation says: " When a vertex buffer is created, CreateVertexBuffer uses the usage parameter to decide whether to process vertices in hardware or software. If CreateDevice uses D3DCREATE_HARDWARE_VERTEXPROCESSING, CreateVertexBuffer must use 0. If CreateDevice uses D3DCREATE_SOFTWARE_VERTEXPROCESSING, CreateVertexBuffer must use either 0 or D3DUSAGE_SOFTWAREPROCESSING. For either value, vertices will be processed in software. If CreateDevice uses D3DCREATE_MIXED_VERTEXPROCESSING, CreateVertexBuffer can use either 0 or D3DUSAGE_SOFTWAREPROCESSING. " Well, I am using the D3DCREATE_HARDWARE_VERTEXPROCESSING parameter when calling the CreateDevice function, for I want to make T&L operations on the video card quickly, rather than doing with software. But at the same time, I render a gigantic terrain every frame, whose vertices are held in a big Vertex Buffer, which lies in the D3DPOOL_MANAGED pool with the usage flag D3DUSAGE_WRITEONLY. (This is same for the index buffers at the leaf nodes of the Quadtree structure for the terrain; D3DPOOL_MANAGED with D3DUSAGE_WRITEONLY flag). I use write only flag, because I load the vertex and index data for the terrain just for once at the start of the program and I don't touch them ever again. But the documentation says, the usage flag must be 0, because I use hardware vertex processing. My question is, what happens in my case, does the Direct3D ignores D3DUSAGE_WRITEONLY? And if it does ignore it, wouldn't that be unlogical, because the programs running with hardware vertex processing support,which I think the common and normal case, couldn't use anything useful for the Usage parameter, but 0? Thanks in advance

Share this post


Link to post
Share on other sites
It sounds like the docs are simply inaccurate. I think that when they say "0" they actually mean "does not contain the SOFTWAREPROCESSING bit". The docs you quoted don't leave an option for specifying anything other than 0 or SOFTWAREPROCESSING, while the D3D_USAGE docs clearly state you can use those flags on CreateVertexBuffer.

Hope this helps.

Share this post


Link to post
Share on other sites
The documentation is misleading here. 0 simply means don’t use D3DUSAGE_SOFTWAREPROCESSING. You still can and should use other usage flags like D3DUSAGE_WRITEONLY.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this