I define my vertices as below. However, I do not always use all the fields. For example, when drawing a plain triangle, the texture coordinates would not be used.
Now of course everything works fine, but is it more efficient to define another kind of vertex that does not have the texture coordinates?
struct Vertex
{
struct
{
float x, y, z; // World Coordinates, z is the depth
float s0, t0; // Texture coordinate
unsigned char r, g, b, a; // tint
float padding[2]; // AMD says pad to 32 (edit)BYTE, boundary
};
};
Nope, that’s fine. Being 16- or 32-byte aligned is usually more of a win than minimizing memory footprint.