D3D: Implemented cache for dynamic render states

Most render states are now cached, rather than created every time, saving roughly 50% of ApplyState().
This is similar to https://github.com/dolphin-emu/dolphin/pull/365, except only limited to render state caching. Additionally, pending render state is kept in a compact structure, which avoids significant cost of hashing and comparing D3D state descriptions in https://github.com/dolphin-emu/dolphin/pull/365.
The life management of such object have to remains in a cache that own them
and let rendering code use the pointer without worrying, once upon a time,
in Dolphin were a mega hotspot of AddRef/Release on state objects… That's
absurd, and even more when you know that the state objects are never
released by d3d no matters their reference counter.


On Sun, Jun 8, 2014 at 11:01 PM, Tony Wasserka <notifications@github.com>
wrote:

> In Source/Core/VideoBackends/D3D/Render.cpp:
>
> >  } gx_state;
> >
> > +class GXStateCache
>
> I'd even suggest putting the class into a separate file. Render.cpp is
> already big enough, handling all kinds of stupid unrelated stuff.
>
> Also, it really needs some documentation. In particular, it should be
> documented for each method whether SAFE_RELEASE should be called on the
> returned object or not (doesn't seem like it needs to be, but it's fairly
> common that such getters increment the reference count of COM objects).
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/dolphin-emu/dolphin/pull/475/files#r13526191>.
>