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.
64bits ABI enforce a 16B alignment on all allocations, no needs for more.

Also, you should prefer the using type alias, so much easier to read (even
more easier with function pointers) :)

using NativeVertexLoaderMap = std::map<PortableVertexDeclaration,
std::unique_ptr<NativeVertexFormat>>;




On Fri, Jul 4, 2014 at 2:34 PM, Tony Wasserka <notifications@github.com>
wrote:

> In Source/Core/VideoCommon/VertexLoaderManager.cpp:
>
> > @@ -33,11 +34,13 @@ struct hash<VertexLoaderUID>
> >  }
> >
> >  typedef std::unordered_map<VertexLoaderUID, VertexLoader*> VertexLoaderMap;
> > +typedef std::map<PortableVertexDeclaration, std::unique_ptr<NativeVertexFormat>> NativeVertexLoaderMap;
>
> Just curious, might any performance be gained by using aligned allocation
> for PortableVertexDeclaration here?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/dolphin-emu/dolphin/pull/463/files#r14558033>.
>