Skip to main content
gamedev.net
🔒 Locked

Multiple declarations - One VB

Started by Stochastic Ooze 4 replies 550+ views
Original Post
Stochastic Ooze
Stochastic Ooze
Hey Is it possible to mix multiple vertex-formats in a single vertexbuffer? For instance: Bytes 0-100 : POSITION,COLOR Bytes 101-200 : POSITION,COLOR,TEXCOORDS To render this buffer i would then need 2 DIPs calls and 2 SetVertexDeclaration calls. But i wouldnt have to switch streams. Is it even a good idea? Thanks
Stochastic Ooze
Stochastic Ooze
I just realized that i would still need to call SetStreamSource to specify the offset and stride parameters.

I'm still curious though. Would it work?
jollyjeffers
jollyjeffers
Quote:
Original post by Stochastic Ooze
I'm still curious though. Would it work?

I've not tried it, but I don't think you can... but if you used an "FVF-less" VB then I guess you might be able to hack around it.

For your situation, have you considered using multiple vertex streams? That way you could have a VB with the POSITION/COLOR components and a second VB with TEXCOORD data. Then use the declaration to pull data in accordingly...

hth
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |
Stochastic Ooze
Stochastic Ooze
Thanks

I figured it might be considered a hack (or at least undocumented). I'd like to keep this clean.

I'll probably go for multiple streams. The performance penalty is pretty small compared to interleaved arrays right?
jollyjeffers
jollyjeffers
Quote:
Original post by Stochastic Ooze
I'll probably go for multiple streams. The performance penalty is pretty small compared to interleaved arrays right?

I've not seen any performance comparisons between multi-streams and regular interleaved data. Unless someone else wishes to post their results in this thread, you'll probably just have to go ahead and try it [smile]

In theory, some situations will require less state-changing due to a multi-stream design, such that a performance gain would be expected.

Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.