Hi Fabian,
Why do you need a proxy IDirect3D8 implementation in dx8vb? Is there any difference between dx8vb and d3d8?
Stefan
Am 31.10.2017 um 00:31 schrieb Fabian Maurer [email protected]:
Signed-off-by: Fabian Maurer [email protected]
dlls/dx8vb/Makefile.in | 2 +- dlls/dx8vb/directx8.c | 112 ++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 89 insertions(+), 25 deletions(-)
diff --git a/dlls/dx8vb/Makefile.in b/dlls/dx8vb/Makefile.in index 8438d022f4..33fe651503 100644 --- a/dlls/dx8vb/Makefile.in +++ b/dlls/dx8vb/Makefile.in @@ -1,5 +1,5 @@ MODULE = dx8vb.dll -IMPORTS = uuid ole32 +IMPORTS = uuid ole32 d3d8
C_SRCS = \ d3dx8.c \ diff --git a/dlls/dx8vb/directx8.c b/dlls/dx8vb/directx8.c index 338862a4ff..dd50c86008 100644 --- a/dlls/dx8vb/directx8.c +++ b/dlls/dx8vb/directx8.c @@ -21,6 +21,9 @@ #include "config.h"
#include "dx8vb_private.h" +#define __WINE_D3D8TYPES_H +#define __WINE_D3D8CAPS_H +#include "d3d8.h" #include "ocidl.h"
#include "wine/debug.h" @@ -36,6 +39,7 @@ typedef struct typedef struct { Direct3D8 Direct3D8_iface;
- IDirect3D8 *direct3d8; LONG ref;
} direct3d8;
@@ -95,7 +99,10 @@ static ULONG WINAPI direct3d8_Release(Direct3D8 *iface) TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
if (!ref)
{
IDirect3D8_Release(This->direct3d8); HeapFree(GetProcessHeap(), 0, This);
}
return ref;
} @@ -104,91 +111,145 @@ static ULONG WINAPI direct3d8_Release(Direct3D8 *iface)
static HRESULT WINAPI direct3d8_RegisterSoftwareDevice(Direct3D8 *iface, void *initializeFunction) {
- FIXME("(%p): stub!\n", initializeFunction);
- direct3d8 *This = impl_from_Direct3D8(iface);
- return E_NOTIMPL;
- HRESULT ret = IDirect3D8_RegisterSoftwareDevice(This->direct3d8, initializeFunction);
- FIXME("(%p) -> (%x)\n", initializeFunction, ret);
- return ret;
}
static int WINAPI direct3d8_GetAdapterCount(Direct3D8 *iface) {
- FIXME("(): stub!\n");
- direct3d8 *This = impl_from_Direct3D8(iface);
- int ret = IDirect3D8_GetAdapterCount(This->direct3d8);
- FIXME("() -> (%i)\n", ret);
- return 0;
- return ret;
}
static HRESULT WINAPI direct3d8_GetAdapterIdentifier(Direct3D8 *iface, int adapter, LONG flags, D3DADAPTER_IDENTIFIER8 *identifier) {
- FIXME("(%i, %i, %p): stub!\n", adapter, flags, identifier);
- direct3d8 *This = impl_from_Direct3D8(iface);
- return E_NOTIMPL;
- HRESULT ret = IDirect3D8_GetAdapterIdentifier(This->direct3d8, adapter, flags, identifier);
- FIXME("(%i, %i, %p) -> (%x)\n", adapter, flags, identifier, ret);
- return ret;
}
static int WINAPI direct3d8_GetAdapterModeCount(Direct3D8 *iface, int adapter) {
- FIXME("(%i): stub!\n", adapter);
- direct3d8 *This = impl_from_Direct3D8(iface);
- return 0;
- int ret = IDirect3D8_GetAdapterModeCount(This->direct3d8, adapter);
- FIXME("(%i) -> (%i)\n", adapter, ret);
- return ret;
}
static HRESULT WINAPI direct3d8_EnumAdapterModes(Direct3D8 *iface, int adapter, int mode, D3DDISPLAYMODE *displayMode) {
- FIXME("(%i, %i, %p): stub!\n", adapter, mode, displayMode);
- direct3d8 *This = impl_from_Direct3D8(iface);
- return E_NOTIMPL;
- HRESULT ret = IDirect3D8_EnumAdapterModes(This->direct3d8, adapter, mode, displayMode);
- FIXME("(%i, %i, %p) -> (%x)\n", adapter, mode, displayMode, ret);
- return ret;
}
static HRESULT WINAPI direct3d8_GetAdapterDisplayMode(Direct3D8 *iface, int adapter, D3DDISPLAYMODE *displayMode) {
- FIXME("(%i, %p): stub!\n", adapter, displayMode);
- direct3d8 *This = impl_from_Direct3D8(iface);
- HRESULT ret;
- return E_NOTIMPL;
- ret = IDirect3D8_GetAdapterDisplayMode(This->direct3d8, adapter, displayMode);
- TRACE("(%i, %p) -> (%x)\n", adapter, displayMode, ret);
- return ret;
}
static LONG WINAPI direct3d8_CheckDeviceType(Direct3D8 *iface, int adapter, D3DDEVTYPE checkType, D3DFORMAT displayFormat, D3DFORMAT backBufferFormat, LONG bWindowed) {
- FIXME("(%i, %u, %u, %u, %i): stub!\n", adapter, checkType, displayFormat, backBufferFormat, bWindowed);
- direct3d8 *This = impl_from_Direct3D8(iface);
- return 0;
- LONG ret = IDirect3D8_CheckDeviceType(This->direct3d8, adapter, checkType,
displayFormat, backBufferFormat, bWindowed);
- FIXME("(%i, %u, %u, %u, %i) -> (%i)\n", adapter, checkType, displayFormat, backBufferFormat, bWindowed, ret);
- return ret;
}
static LONG WINAPI direct3d8_CheckDeviceFormat(Direct3D8 *iface, int adapter, D3DDEVTYPE deviceType, D3DFORMAT adapterFormat, LONG usage, D3DRESOURCETYPE rType, D3DFORMAT checkFormat) {
- FIXME("(%i, %u, %u, %i, %u, %u): stub!\n", adapter, deviceType, adapterFormat, usage, rType, checkFormat);
- direct3d8 *This = impl_from_Direct3D8(iface);
- return 0;
- LONG ret = IDirect3D8_CheckDeviceFormat(This->direct3d8, adapter, deviceType,
adapterFormat, usage, rType, checkFormat);
- FIXME("(%i, %u, %u, %i, %u, %u) -> (%i)\n", adapter, deviceType, adapterFormat, usage, rType, checkFormat, ret);
- return ret;
}
static LONG WINAPI direct3d8_CheckDeviceMultiSampleType(Direct3D8 *iface, int adapter, D3DDEVTYPE deviceType, D3DFORMAT renderTargetFormat, LONG windowed, D3DMULTISAMPLE_TYPE multiSampleType) {
- FIXME("(%i, %u, %u, %i, %u): stub!\n", adapter, deviceType, renderTargetFormat, windowed, multiSampleType);
- direct3d8 *This = impl_from_Direct3D8(iface);
- LONG ret = IDirect3D8_CheckDeviceMultiSampleType(This->direct3d8, adapter, deviceType,
renderTargetFormat, windowed, multiSampleType);
- FIXME("(%i, %u, %u, %i, %u) -> (%i)\n", adapter, deviceType, renderTargetFormat, windowed, multiSampleType, ret);
- return 0;
- return ret;
}
static LONG WINAPI direct3d8_CheckDepthStencilMatch(Direct3D8 *iface, int adapter, D3DDEVTYPE deviceType, D3DFORMAT adapterFormat, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat) {
- FIXME("(%i, %u, %u, %u, %u): stub!\n", adapter, deviceType, adapterFormat, renderTargetFormat, depthStencilFormat);
- direct3d8 *This = impl_from_Direct3D8(iface);
- LONG ret = IDirect3D8_CheckDepthStencilMatch(This->direct3d8, adapter, deviceType, adapterFormat,
renderTargetFormat, depthStencilFormat);
- TRACE("(%i, %u, %u, %u, %u) ->(%i)\n", adapter, deviceType, adapterFormat,
renderTargetFormat, depthStencilFormat, ret);
- return 0;
- return ret;
}
static HRESULT WINAPI direct3d8_GetDeviceCaps(Direct3D8 *iface, int adapter, D3DDEVTYPE deviceType, D3DCAPS8 *caps) {
- FIXME("(%i, %u, %p): stub!\n", adapter, deviceType, caps);
- direct3d8 *This = impl_from_Direct3D8(iface);
- return E_NOTIMPL;
- HRESULT ret = IDirect3D8_GetDeviceCaps(This->direct3d8, adapter, deviceType, caps);
- TRACE("(%i, %u, %p) -> (%x)\n", adapter, deviceType, caps, ret);
- return ret;
}
static LONG WINAPI direct3d8_GetAdapterMonitor(Direct3D8 *iface, int adapter) {
- FIXME("(%i): stub!\n", adapter);
- direct3d8 *This = impl_from_Direct3D8(iface);
- LONG ret = (LONG)IDirect3D8_GetAdapterMonitor(This->direct3d8, adapter);
- TRACE("(%i) -> (%i)!\n", adapter, ret);
- return 0;
- return ret;
}
static HRESULT WINAPI direct3d8_CreateDevice(Direct3D8 *iface, int adapter, D3DDEVTYPE deviceType, HWND hFocusWindow, @@ -235,6 +296,9 @@ HRESULT direct3d8_create(Direct3D8 **ppv)
object->Direct3D8_iface.lpVtbl = &Direct3D8_Vtbl; object->ref = 1;
object->direct3d8 = Direct3DCreate8(D3D_SDK_VERSION);
if(!object->direct3d8)
ERR("Can't create D3D8 object\n");
*ppv = &object->Direct3D8_iface;
-- 2.15.0
Why do you need a proxy IDirect3D8 implementation in dx8vb? Is there any difference between dx8vb and d3d8?
The interfaces in dx8vb are different interfaces, with different GUID and sometimes slightly different method definitions and behavior. I don't know why they did it that way, but I don't see another way than to have a wrapper for all of these. If there is an easier way, I'd love to hear it.
Regards, Fabian Maurer
Am 2017-10-31 um 14:11 schrieb Fabian Maurer:
Why do you need a proxy IDirect3D8 implementation in dx8vb? Is there any difference between dx8vb and d3d8?
The interfaces in dx8vb are different interfaces, with different GUID and sometimes slightly different method definitions and behavior. I don't know why they did it that way, but I don't see another way than to have a wrapper for all of these. If there is an easier way, I'd love to hear it.
Hmm, in this case a wrapper is probably the best choice...
Regarding the GUIDs, some tests would be great, e.g. showing that d3d8 does not support them, but dx8vb does.
You'll have a mess on your hands with various getter functions. Luckily the IDirect3DResource8::{Get/Set}PrivateData methods are helpful for textures, surfaces, swapchains and buffers, and in d3d8 shaders are DWORD handles and vertex declarations don't exist. So you shouldn't have to maintain your own stateblocks.
D3DSPD_IUNKNOWN is handy for being notified of the destruction of a resource. You probably do have to keep your own refcounting and test if it works the same way as in real d3d8.
Regarding the GUIDs, some tests would be great, e.g. showing that d3d8 does not support them, but dx8vb does.
I somewhat doubt this is necessary, but sure, why not. Should be easy enough to add.
You'll have a mess on your hands with various getter functions. Luckily the IDirect3DResource8::{Get/Set}PrivateData methods are helpful for textures, surfaces, swapchains and buffers, and in d3d8 shaders are DWORD handles and vertex declarations don't exist. So you shouldn't have to maintain your own stateblocks.
D3DSPD_IUNKNOWN is handy for being notified of the destruction of a resource. You probably do have to keep your own refcounting and test if it works the same way as in real d3d8.
Yes for now it's easy, but it will get more complicated. I still hope I can deal with that, though. Thanks for the tips.
Regards, Fabian Maurer