Skip to main content
GameDev.net gamedev.net
🔒 Locked

Multi-stream Vertex Declaration Ambiguity

Started by Joshua Schpok Jan 28, 2003 at 10:20 AM 0 replies 350+ views
Original Post
Joshua Schpok
Joshua Schpok
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

Topic Locked

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

Sign in to reply to this topic.