CreateDevice with D3DCREATE_HARDWARE_VERTEXPROCESSING and Vertex Buffers
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
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.
Hope this helps.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement