Archived

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

Multi-stream Vertex Declaration Ambiguity

This topic is 5434 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

I''ve been chewing on DX9 for a bit, and think I''ve uncovered an ambiguity for vertex declaration, or an error in the documentation. The question, in short, is how D3DVERTEXELEMENT9.Offset gets used: I understand it''s a byte offset per vertex element, but does it span streams? In other words, if stream 0 has spatial and color elements, color coming second would have a 12 byte offset in its vertex declaration:
  
D3DVERTEXELEMENT9 decl[] = 
{
    { 0, 0, D3DDECLTYPE_FLOAT3,   D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
    { 0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,    0 },
    D3DDECL_END()
};
  
However, if we split spatial and color elements into their own stream, does the offset still occur, or it restarts to 0:
  
D3DVERTEXELEMENT9 decl[] = 
{
    { 0, 0, D3DDECLTYPE_FLOAT3,   D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
    { 1, 0, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,    0 },
    D3DDECL_END()
};
  
It seems to happen both ways in the documentation. With: DXGraphics->Programming Guide->Programmable Pipeline->Programmable Stream Model Without: DXGraphics->Programming Guide->Programmable Pipeline->Programmable Stream Model->ColorVertex Shader Any insight, guys? Thanks, Schpok

Share this post


Link to post
Share on other sites