Archived

This topic is now archived and is closed to further replies.

initial_y

about D3DUSAGE_SOFTWAREPROCESSING flag?

Recommended Posts

I have read the following words about vertex buffer in directx SDK document: Vertex buffers used with software vertex processing include the following: 1.All input streams for IDirect3DDevice8:rocessVertices. 2.All input streams for IDirect3DDevice8::DrawPrimitive and IDirect3DDevice8::DrawIndexedPrimitive when software vertex processing. It''s means the processvertices(),drawprimitive()and drawindexedprimitive()methods are all software vertex processing method?And I couldn''t use hardware vertex processing flag when create a vertex buffer? In which condition I can ensure that hardware vertex processing can use and what are the hardware vertex processing methods? goddess just one...

Share this post


Link to post
Share on other sites
ProcessVertices() is *always* performed in software.

DrawPrimitive, DrawPrimitiveUP, DrawIndexedPrimitive etc are performed in hardware (if the graphics chip is a hardware T&L chip...) *if*:
the device has been created with HARDWARE vertex processing,
AND the buffers have been created with vertex processing

OR

the device has been created with MIXED vertex processing
AND the vertex processing renderstate is set to HARDWARE


If the buffer is created with the SOFTWARE vertex processing flag OR the device was created with the SOFTWARE vertex processing flag, OR the vertex processing renderstate is set to SOFTWARE, then the vertex processing will be done on the host CPU (i.e. it takes advantage of SSE, 3DNow! etc, but doesn''t take advantage of hardware T&L)

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Out of interest then does this mean that if I set my GF2 as using HW T+L but my Vertex Buffer as SW T+L that I get SW T+L for that buffer only. If so then this could help as I am using Vertex Shaders (which GF2 doesn''t support in HW) so dropping back to SW completely. Will that work?

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

Share this post


Link to post
Share on other sites
A buffer declared as being for software VP on a hardware VP device has undefined behaviour - expect a crash, and error return, or major performance implications.

What you can do in the case of a card which supports hardware T&L but doesn''t have hardware vertex shaders (e.g. like a GeForce256) is create the device with MIXED vertex processing. Your code would be structured something like:

Initialisation:
- create device with MIXED vp.
- create all buffers for use with shaders with SOFTWARE vp.
- create all buffers for use with FF T&L with HARDWARE vp.
- create all buffers for ProcessVertices with SOFTWARE vp.

Runtime:
- SetRenderState(D3DRS_SOFTWAREVERTEXPROCESSING, FALSE);
- render *ALL* fixed function geometry from FF HWVP buffers.
- SetRenderState(D3DRS_SOFTWAREVERTEXPROCESSING, TRUE);
- render *ALL* shader geometry from SWVP buffers
- ProcessVertices() any SWVP buffers you need to do that on.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites