Streamed Date in DirectX

Started by
0 comments, last by Bunnz 22 years, 3 months ago
Hi In OpenGL there are two ways to store data: Interleaved: Vertex1, Color1, Tex1, Vertex2, Color2, Tex2, ... Streamed: Vertex1, Vertex2, ... Coor1, Color2, ... Tex1, Tex2, ... DirectX uses the FVF which is like interleaved data in OpenGL. Is there a way to do it with streamed data to in DirectX? Or which format is chosen by other independent 3d engines? Have fun Bunnz Visit: www.bunnz.com
Have fun BunnzPunch'n'Crunch
Advertisement
Method 1 (Best - what OGL does - assuming hardware support):

IDirect3DDevice8::SetStreamSource

IIRC you set up a vertex shader *declaration* to tell D3D/the chip which component is coming in which DMA stream. You don''t actually need to setup a vertex shader itself, you still pass the FVF to SetVertexShader().

For this to work with hardware vertex processing you need to have DX8 level drivers and T&L hardware. The GeForce2 Ultra for example supports 16 different vertex streams in DX8.


Method 2:

Use the stride parameter on Draw*PrimitiveUP(). Generally method 1 is the most preferable though since a) the UP method does an extra data copy to "safe" memory, and b) D3D/the driver will actually reassemble from the streamed format into interleaved format. Only use this method in extreme circumstances such as when you aren''t on DX8 level drivers.


Incidentally, checking the caps for the number of supported streams is the best method to check whether the driver is DX8 level or not (if the max streams is 0, then the driver is pre-DX8). A non-T&L card may report that it can do 1 stream, but since you''ll be using software VP in that case you can do as many as you require.

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

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

This topic is closed to new replies.

Advertisement