#### Archived

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

# Multiple Vertex Streams

This topic is 5851 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I was wondering how to use multiple streams. I know I can set multiple streams, but when I call a DrawPrimitives wich one is used, is it the last one I set or are many used at the same time. What's the advantage of using many if he uses the last one that is set? I haven't found any info on how it works in the SDK. I would apreciate any information. Searching in the forum I found an awnser that doesn't make any sense. It is said that for example you can have your Vertex Position in one stream and you tex coord in another, this way you can change the tex coord to use with your vertex. But you can only set one FVF, so I guess you set the total FVF, but then you can't set your stream source because the span needs to be the exact size of the vertex specified in set vertex shader. I don't see how it could work, and it's not much usefull anyway. And so I am left with even more questions... [edited by - Kern on August 14, 2002 11:41:10 AM]

##### Share on other sites
I found a document from NVidia(http://developer.nvidia.com/docs/IO/1360/ATT/DX8_Overview.ppt) that tells me that with the fixed pipeline(FVF) only stream 0 is valid. So only Vertex Shader can take advantage of multiple streams, but in that same paper it''s writen that the GeForce and GeForce2 have 8 streams and of course no vertex shaders, so 7 of them are completely useless?!?

This is getting increasingly confusing...

##### Share on other sites
You can set more than one FVF, and you feed different streams binded to different buffers.

The SDK help has several examples on how to process more than one shader.Have a look inthere

##### Share on other sites
You''re thinking in fixed function shaders, which really don''t use multiple streams. A vertex stream is merely a pathway to pass data to a vertex shader (and in fixed function shaders, it would be stream 0). That data can be anything, and I mean anything, you want. It''s the shader''s job to convert this data is something ready to display.

So to build on an earlier example, you can provide one stream with one the vertex coordinate data, a second stream for texture coordinates, and a third stream that represents an offset value to apply to each vertex coordinate.

Each stream is passed to your vertex shader, which in turn grabs the coordinates from the first stream, adds the offset position from the third stream and stores the coordinates. The texture coordinates for the same vertex are grabbed from the second stream and stored. The shader ends and the next vertex is processed. Primitives are drawn using those vertices you processed and everything continues the same.

*** 500 error x 7 (this is getting worse every time now)

home.att.net/~rpgbook
Author, Programming Role-Playing Games with DirectX

##### Share on other sites
OB1st : How can you set more than one FVF? the SDK says that SetVertexShader set the CURENT shader, the curent is the only active one.

Jim : I know Shader can use multiple streams, I was confused on why does a card that doesn''t have shader have multiple streams and can the fixed pipeline use multiple stream or not and how.

Thanks for the awnsers.

##### Share on other sites
Did you look into vertexdata->programble pixel and vertex processing->integration of vertex shaders into the geometry pipeline.

I copied small portion below
"Calling IDirect3DDevice8::CreateVertexShader with the pFunction parameter equal to NULL is used to create a shader for the fixed-function pipeline. When pFunction is not NULL, the shader is programmable. A call to IDirect3DDevice8::SetVertexShader sets the current active shader, which defines whether the rendering pipeline should use programmable or fixed-function vertex processing."

If that does not help you, then I may have miss understood the question

##### Share on other sites
quote:

Jim : I know Shader can use multiple streams, I was confused on why does a card that doesn''t have shader have multiple streams and can the fixed pipeline use multiple stream or not and how.

DirectX allows multiple streams, even if your video card doesn''t support them. AFAIK, there are no fixed function shaders that use multiple streams. Also, you can only specify one FVF or vertex declaration at one time.

Quoting the SDK:

The flexible vertex format (FVF) is used to describe the contents of vertices stored interleaved in a single data stream. A FVF code is generally used to specify data to be processed by fixed function vertex processing.

home.att.net/~rpgbook
Author, Programming Role-Playing Games with DirectX

##### Share on other sites
Thanks for the awnsers guys, I now know that I have 16 streams(GeForce 3) and can''t use 15 of them unless I use Programable Vertex Shader... and if I had a GeForce 2 I would have 8, and absolutely no way of using 7 of them, weird thing...

Anyway, I initialy hoped that the multiple streams could be used to accelerate things, but it''s not.

##### Share on other sites
>>and if I had a GeForce 2 I would have 8, and absolutely no way of using 7 of them, weird thing...<<

I know it definitely can''t do Pixel Shaders, but I thought the GeForce 2 can do Vertex Shaders, can''t it? If so, then you could use all 8 just fine

-John

##### Share on other sites
I use 2 streams one for the xyz, normal, texture uvs. Another for the rgba. It works with the fixed function pipeline as follows

    DWORD decl[] ={    D3DVSD_STREAM( 0 ),    D3DVSD_REG( D3DVSDE_POSITION, D3DVSDT_FLOAT3 ),    D3DVSD_REG( D3DVSDE_NORMAL,D3DVSDT_FLOAT3  ),    D3DVSD_REG( D3DVSDE_TEXCOORD0 ,D3DVSDT_FLOAT2   ),    D3DVSD_STREAM( 1 ),    D3DVSD_REG( D3DVSDE_DIFFUSE, D3DVSDT_D3DCOLOR ),    D3DVSD_END()};DWORD Handle;DXDisplay->CreateVertexShader( decl, NULL, &Handle, hw ? 0 : 1 );//....//Then you call DXDisplay->SetStreamSource( 0, Verts, sizeof(VERT_STRUCT) );DXDisplay->SetStreamSource( 1, Colours, sizeof(COLOUR_STRUCT) );DXDisplay->SetVertexShader( Handle ); // instead of your FVF_format.

Works a treat on my geforce 3.

Mark Duffill[The Jackal]
Eurocom Entertainment Software

[edited by - mark duffill on August 15, 2002 5:34:10 AM]

1. 1
2. 2
3. 3
JoeJ
20
4. 4
5. 5
frob
19

• 11
• 11
• 12
• 13
• 9
• ### Forum Statistics

• Total Topics
632213
• Total Posts
3004849

×