Jump to content
  • Advertisement

Archived

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

snail0r

SetStreamSource, source parameter ?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

What different stream sources are there ? The function description in the microsoft documentation refers to streams ranging from 0 -> -1. Perhaps an obvious thing for many, however, the answer is still unknown to me and I would appreciate if someone could give me a good example of the different streams. --- Christopher Strömblad Hobby programmer

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
You define the streams yourself. If you are using fixed pipeline rendering, you must only use stream 0. All vertex data must be packed in a format appropriate for your FVF, in a single stream.

When using vertex shaders you may have multiple streams. You make a vertex declaration as part of the process of using shaders. This declaration describes the offsets and types of each data input for the shader. Occasionally, you want to render something twice, but not all data is needed in both passes, or different data is wanted in the second pass. Instead of creating a duplicate of all data, with minimal changes, you can seperate the parts that change into another stream.

Lets say your two passes require different UVs. Each pass supports two UVs. There are several ways to layout the data. For example:

VERTEXBUFFERA
Position
Normal
Diffuse
UV0
UV1

VERTEXBUFFERB
Position
Normal
Diffuse
UV2
UV3

VERTEXBUFFERC
Position
Normal
Diffuse
UV0
UV1
UV2
UV3

VERTEXBUFFERD
stream0
Position
Normal
Diffuse

VERTEXBUFFERE
UV0
UV1

VERTEXBUFFERF
UV2
UV3

Ok. So, how can we use these different forms of data?

VBA - Stream 0 used for first pass
VBB - Stream 0 used for second pass
What''s wrong? Pos,Norm,Diffuse are duplicated, wasting RAM

--

VBC - Stream 0 for first and second pass. We switch vertex declarations between:

Pos, Norm, Diffuse, UV, UV, skip, skip
and
Pos, Norm, Diffuse, skip, skip, UV, UV

What''s wrong? GPU will fetch extra data, and throw it away. Waste of GPU bandwidth

--

VBD - Set as stream 0 for both passes
VBE - Set as stream 1 in pass 0
VBF - Set as stream 1 in pass 1

Shared data is in it''s own buffer. Data that changes is swapped by selecting a VB for stream 1. No unused data needs to fetched, and Pos, Norm, and Diffuse are not duplicated in two buffers.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!