dxgi, directx 11 and code duplication

Henri Verbeet hverbeet at gmail.com
Tue May 28 02:09:36 CDT 2013


On 28 May 2013 00:36, John Yani <vanuan at gmail.com> wrote:
> Hi. I'm trying to set up a minimal implementation that will allow to run
> Assasin's Creed III.
It's somewhat unlikely that you'll be able to make the game work just
by implementing these functions, your best chance in that regard may
be to disable dxgi in winecfg and hope it falls back to d3d9.

> I need an advice on how to implement CreateDXGIFactory1 without duplicating
> a lot of code.
> There are problems with a straight-forward implementation:
>
> interface IWineDXGIFactory : IDXGIFactory
> {
>     struct wined3d *get_wined3d();
> }
>
> interface IWineDXGIFactory1 : IDXGIFactory1
> {
>     struct wined3d *get_wined3d();
> }
>
> The problem is how to reuse functions where IWineDXGIFactory is used.
> Obviously we can't pass IWineDXGIFactory1 object where IWineDXGIFactory is
> required. Because the next time we call get_wined3d, a crash will occur (a
> different function will be called).
>
> Is there a more elegant solution than duplicating code and replacing all
> occurencdes of IWineDXGIFactory by IWineDXGIFactory1?
>
Note that IDXGIFactory1 is derived from IDXGIFactory. You should
probably make IWineDXGIFactory derived from IDXGIFactory1 instead of
from IDXGIFactory, and then just add the extra methods to
dxgi_factory_vtbl. Depending on if you can QueryInterface a
IDXGIFactory1 interface from a dxgi factory created by
CreateDXGIFactory() or not you may need to add some kind of flag to
struct dxgi_factory to handle that in dxgi_factory_QueryInterface().
See also for example d3d9_QueryInterface() in dlls/d3d9/directx.c, it
has a similar construction for IDirect3D9Ex.



More information about the wine-devel mailing list