I'm a little confused about this statement. Isn't the vertex declaration for HW_VTF with LUT already not 16 byte aligned? From I understand, the second vertex declaration would be 56 bytes, so does this mean that padding should be added or am I perhaps misunderstanding?dark_sylinc wrote:Just make sure the new vertex declaration:
a. Takes care of memory alignment (16-bytes), not very strict seems some GPUs don't seem to be affected (may be that's not where the bottleneck is).
Code: Select all
//Now create the instance buffer that will be incremented per instance, contains UV offsets
newSource = thisVertexData->vertexDeclaration->getMaxSource() + 1;
size_t offset = thisVertexData->vertexDeclaration->addElement( newSource, 0, VET_FLOAT2, VES_TEXTURE_COORDINATES,
thisVertexData->vertexDeclaration->getNextFreeTextureCoordinate() ).getSize();
if (useBoneMatrixLookup())
{
//if using bone matrix lookup we will need to add 3 more float4 to contain the matrix. containing
//the personal world transform of each entity.
offset += thisVertexData->vertexDeclaration->addElement( newSource, offset, VET_FLOAT4, VES_TEXTURE_COORDINATES,
thisVertexData->vertexDeclaration->getNextFreeTextureCoordinate() ).getSize();
offset += thisVertexData->vertexDeclaration->addElement( newSource, offset, VET_FLOAT4, VES_TEXTURE_COORDINATES,
thisVertexData->vertexDeclaration->getNextFreeTextureCoordinate() ).getSize();
offset += thisVertexData->vertexDeclaration->addElement( newSource, offset, VET_FLOAT4, VES_TEXTURE_COORDINATES,
thisVertexData->vertexDeclaration->getNextFreeTextureCoordinate() ).getSize();
}