Commit c3421ea4 authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

Move into wined3d and call from d3d9 the GetAdapterId function and

copy all the gl declarations into the more global wined3d_gl header file.
parent 72c9008e
......@@ -215,52 +215,23 @@ UINT WINAPI IDirect3D8Impl_GetAdapterCount (LPDIRECT3D8 iface) {
HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier (LPDIRECT3D8 iface,
UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER8* pIdentifier) {
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
TRACE_(d3d_caps)("(%p}->(Adapter: %d, Flags: %lx, pId=%p)\n", This, Adapter, Flags, pIdentifier);
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
return D3DERR_INVALIDCALL;
}
if (Adapter == 0) { /* Display */
/* If we don't know the device settings, go query them now */
if (This->isGLInfoValid == FALSE) {
WineD3D_Context* ctx = WineD3DCreateFakeGLContext();
if (NULL != ctx) IDirect3D8Impl_FillGLCaps(iface, ctx->display);
WineD3DReleaseFakeGLContext(ctx);
}
if (This->isGLInfoValid == TRUE) {
TRACE_(d3d_caps)("device/Vendor Name and Version detection using FillGLCaps\n");
strcpy(pIdentifier->Driver, "Display");
strcpy(pIdentifier->Description, "Direct3D HAL");
pIdentifier->DriverVersion.u.HighPart = 0xa;
pIdentifier->DriverVersion.u.LowPart = This->gl_info.gl_driver_version;
pIdentifier->VendorId = This->gl_info.gl_vendor;
pIdentifier->DeviceId = This->gl_info.gl_card;
pIdentifier->SubSysId = 0;
pIdentifier->Revision = 0;
} else {
WARN_(d3d_caps)("Cannot get GLCaps for device/Vendor Name and Version detection using FillGLCaps, currently using NVIDIA identifiers\n");
strcpy(pIdentifier->Driver, "Display");
strcpy(pIdentifier->Description, "Direct3D HAL");
pIdentifier->DriverVersion.u.HighPart = 0xa;
pIdentifier->DriverVersion.u.LowPart = MAKEDWORD_VERSION(53, 96); /* last Linux Nvidia drivers */
pIdentifier->VendorId = VENDOR_NVIDIA;
pIdentifier->DeviceId = CARD_NVIDIA_GEFORCE4_TI4600;
pIdentifier->SubSysId = 0;
pIdentifier->Revision = 0;
}
/*FIXME: memcpy(&pIdentifier->DeviceIdentifier, ??, sizeof(??GUID)); */
if (Flags & D3DENUM_NO_WHQL_LEVEL) {
pIdentifier->WHQLLevel = 0;
} else {
pIdentifier->WHQLLevel = 1;
}
} else {
FIXME_(d3d_caps)("Adapter not primary display\n");
}
return D3D_OK;
WINED3DADAPTER_IDENTIFIER adapter_id;
/* dx8 and dx9 have different structures to be filled in, with incompatible
layouts so pass in pointers to the places to be filled via an internal
structure */
adapter_id.Driver = pIdentifier->Driver;
adapter_id.Description = pIdentifier->Description;
adapter_id.DeviceName = NULL;
adapter_id.DriverVersion = &pIdentifier->DriverVersion;
adapter_id.VendorId = &pIdentifier->VendorId;
adapter_id.DeviceId = &pIdentifier->DeviceId;
adapter_id.SubSysId = &pIdentifier->SubSysId;
adapter_id.Revision = &pIdentifier->Revision;
adapter_id.DeviceIdentifier = &pIdentifier->DeviceIdentifier;
adapter_id.WHQLLevel = &pIdentifier->WHQLLevel;
return IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id);
}
UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,UINT Adapter) {
......
......@@ -82,8 +82,23 @@ UINT WINAPI IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9 iface) {
HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9 iface, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) {
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
FIXME("(%p): stub\n", This);
return D3D_OK;
WINED3DADAPTER_IDENTIFIER adapter_id;
/* dx8 and dx9 have different structures to be filled in, with incompatible
layouts so pass in pointers to the places to be filled via an internal
structure */
adapter_id.Driver = pIdentifier->Driver;
adapter_id.Description = pIdentifier->Description;
adapter_id.DeviceName = pIdentifier->DeviceName;
adapter_id.DriverVersion = &pIdentifier->DriverVersion;
adapter_id.VendorId = &pIdentifier->VendorId;
adapter_id.DeviceId = &pIdentifier->DeviceId;
adapter_id.SubSysId = &pIdentifier->SubSysId;
adapter_id.Revision = &pIdentifier->Revision;
adapter_id.DeviceIdentifier = &pIdentifier->DeviceIdentifier;
adapter_id.WHQLLevel = &pIdentifier->WHQLLevel;
return IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id);
}
UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9 iface, UINT Adapter, D3DFORMAT Format) {
......
......@@ -36,6 +36,7 @@
#include "d3d9.h"
#include "d3d9types.h"
#include "wine/wined3d_interface.h"
#include "wine/wined3d_gl.h"
extern int vs_mode;
#define VS_NONE 0
......@@ -46,6 +47,26 @@ extern int ps_mode;
#define PS_NONE 0
#define PS_HW 1
/* X11 locking */
extern void (*wine_tsx11_lock_ptr)(void);
extern void (*wine_tsx11_unlock_ptr)(void);
/* As GLX relies on X, this is needed */
extern int num_lock;
#if 0
#define ENTER_GL() ++num_lock; if (num_lock > 1) FIXME("Recursive use of GL lock to: %d\n", num_lock); wine_tsx11_lock_ptr()
#define LEAVE_GL() if (num_lock != 1) FIXME("Recursive use of GL lock: %d\n", num_lock); --num_lock; wine_tsx11_unlock_ptr()
#else
#define ENTER_GL() wine_tsx11_lock_ptr()
#define LEAVE_GL() wine_tsx11_unlock_ptr()
#endif
/*****************************************************************************
* Defines
*/
/*****************************************************************************
* IWineD3D implementation structure
*/
......@@ -57,6 +78,10 @@ typedef struct IWineD3DImpl
/* WineD3D Information */
UINT dxVersion;
/* GL Information */
BOOL isGLInfoValid;
WineD3D_GL_Info gl_info;
} IWineD3DImpl;
extern IWineD3DVtbl IWineD3D_Vtbl;
......
......@@ -37,6 +37,25 @@
/*****************************************************************************
* WineD3D Structures
*/
typedef struct _WINED3DADAPTER_IDENTIFIER {
char *Driver;
char *Description;
char *DeviceName;
LARGE_INTEGER *DriverVersion;
DWORD *VendorId;
DWORD *DeviceId;
DWORD *SubSysId;
DWORD *Revision;
GUID *DeviceIdentifier;
DWORD *WHQLLevel;
} WINED3DADAPTER_IDENTIFIER;
/*****************************************************************************
* WineD3D interface
*/
typedef struct IWineD3D IWineD3D;
......@@ -50,7 +69,7 @@ typedef struct IWineD3D IWineD3D;
STDMETHOD_(UINT,GetAdapterModeCount)(THIS_ UINT Adapter, D3DFORMAT Format) PURE; \
STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter, UINT Mode, D3DFORMAT Format, D3DDISPLAYMODE * pMode) PURE; \
STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter, D3DDISPLAYMODE * pMode) PURE; \
STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter, DWORD Flags, WINED3DADAPTER_IDENTIFIER* pIdentifier) PURE; \
DECLARE_INTERFACE_(IWineD3D,IUnknown) { IWineD3D_METHODS };
#undef INTERFACE
......@@ -67,7 +86,7 @@ DECLARE_INTERFACE_(IWineD3D,IUnknown) { IWineD3D_METHODS };
#define IWineD3D_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b)
#define IWineD3D_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d)
#define IWineD3D_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b)
#define IWineD3D_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c)
#endif
/* Define the main WineD3D entrypoint */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment