VideoCommon: Cache native vertex formats

We are used to have a 1:1 mapping of GX vertex formats and the native (OGL + D3D) ones, but there are by far more GX ones.
This new cache maps them directly so that we don't flush on GX vertex format changes as long as the native one doesn't change.

The idea is stolen from galop1n.
This commit is contained in:
degasus
2014-06-05 17:55:21 +02:00
parent be1fe80bb6
commit bb2fc8ecbb
4 changed files with 30 additions and 8 deletions

View File

@ -76,6 +76,15 @@ struct PortableVertexDeclaration
AttributeFormat colors[2];
AttributeFormat texcoords[8];
AttributeFormat posmtx;
inline bool operator<(const PortableVertexDeclaration& b) const
{
return memcmp(this, &b, sizeof(PortableVertexDeclaration)) < 0;
}
inline bool operator==(const PortableVertexDeclaration& b) const
{
return memcmp(this, &b, sizeof(PortableVertexDeclaration)) == 0;
}
};
// The implementation of this class is specific for GL/DX, so NativeVertexFormat.cpp