2002-09-28 00:46:16 +02:00
|
|
|
/*
|
|
|
|
* IDirect3D8 implementation
|
|
|
|
*
|
2004-04-16 01:58:15 +02:00
|
|
|
* Copyright 2002-2004 Jason Edmeades
|
2004-04-20 01:04:58 +02:00
|
|
|
* Copyright 2003-2004 Raphael Junqueira
|
2004-04-16 01:58:15 +02:00
|
|
|
* Copyright 2004 Christian Costa
|
2002-09-28 00:46:16 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2003-04-22 06:05:08 +02:00
|
|
|
#include "config.h"
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2003-01-07 21:36:20 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2002-09-28 00:46:16 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
2003-09-16 22:24:49 +02:00
|
|
|
#include "winuser.h"
|
2002-09-28 00:46:16 +02:00
|
|
|
#include "wine/debug.h"
|
2003-06-05 00:55:19 +02:00
|
|
|
#include "wine/unicode.h"
|
2002-09-28 00:46:16 +02:00
|
|
|
|
|
|
|
#include "d3d8_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
2004-04-26 22:12:28 +02:00
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(d3d_caps);
|
2002-09-28 00:46:16 +02:00
|
|
|
|
2003-04-22 06:05:08 +02:00
|
|
|
/* x11drv GDI escapes */
|
|
|
|
#define X11DRV_ESCAPE 6789
|
|
|
|
enum x11drv_escape_codes
|
|
|
|
{
|
|
|
|
X11DRV_GET_DISPLAY, /* get X11 display for a DC */
|
|
|
|
X11DRV_GET_DRAWABLE, /* get current drawable for a DC */
|
|
|
|
X11DRV_GET_FONT, /* get current X font for a DC */
|
|
|
|
};
|
|
|
|
|
2003-05-17 20:33:02 +02:00
|
|
|
#define NUM_FORMATS 7
|
|
|
|
static const D3DFORMAT device_formats[NUM_FORMATS] = {
|
|
|
|
D3DFMT_P8,
|
|
|
|
D3DFMT_R3G3B2,
|
|
|
|
D3DFMT_R5G6B5,
|
|
|
|
D3DFMT_X1R5G5B5,
|
|
|
|
D3DFMT_X4R4G4B4,
|
|
|
|
D3DFMT_R8G8B8,
|
|
|
|
D3DFMT_X8R8G8B8
|
2002-09-28 00:46:16 +02:00
|
|
|
};
|
|
|
|
|
2003-10-03 06:35:07 +02:00
|
|
|
static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display);
|
2003-05-17 20:33:02 +02:00
|
|
|
|
2004-04-26 22:12:28 +02:00
|
|
|
|
2002-09-28 00:46:16 +02:00
|
|
|
/* retrieve the X display to use on a given DC */
|
|
|
|
inline static Display *get_display( HDC hdc )
|
|
|
|
{
|
|
|
|
Display *display;
|
|
|
|
enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
|
|
|
|
|
|
|
|
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
|
|
|
|
sizeof(display), (LPSTR)&display )) display = NULL;
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* IDirect3D IUnknown parts follow: */
|
|
|
|
HRESULT WINAPI IDirect3D8Impl_QueryInterface(LPDIRECT3D8 iface,REFIID riid,LPVOID *ppobj)
|
|
|
|
{
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2002-09-28 00:46:16 +02:00
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
2002-12-17 02:15:15 +01:00
|
|
|
|| IsEqualGUID(riid, &IID_IDirect3D8)) {
|
2002-09-28 00:46:16 +02:00
|
|
|
IDirect3D8Impl_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return D3D_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONG WINAPI IDirect3D8Impl_AddRef(LPDIRECT3D8 iface) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2005-01-24 12:31:45 +01:00
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
|
|
|
|
|
|
|
|
return ref;
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ULONG WINAPI IDirect3D8Impl_Release(LPDIRECT3D8 iface) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2005-01-24 12:31:45 +01:00
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
|
|
|
|
2004-09-28 04:12:12 +02:00
|
|
|
if (ref == 0) {
|
|
|
|
IWineD3D_Release(This->WineD3D);
|
2002-09-28 00:46:16 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2004-09-28 04:12:12 +02:00
|
|
|
}
|
2002-09-28 00:46:16 +02:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* IDirect3D Interface follow: */
|
2004-09-28 04:12:12 +02:00
|
|
|
HRESULT WINAPI IDirect3D8Impl_RegisterSoftwareDevice (LPDIRECT3D8 iface, void* pInitializeFunction) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2004-09-28 04:12:12 +02:00
|
|
|
return IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
2004-09-28 04:12:12 +02:00
|
|
|
UINT WINAPI IDirect3D8Impl_GetAdapterCount (LPDIRECT3D8 iface) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2004-09-28 04:12:12 +02:00
|
|
|
return IWineD3D_GetAdapterCount(This->WineD3D);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier (LPDIRECT3D8 iface,
|
|
|
|
UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER8* pIdentifier) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2004-09-29 23:26:47 +02:00
|
|
|
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);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
2004-09-28 04:12:12 +02:00
|
|
|
UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,UINT Adapter) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2004-09-28 04:12:12 +02:00
|
|
|
return IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, D3DFMT_UNKNOWN);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
2004-09-28 04:12:12 +02:00
|
|
|
HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface, UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2004-09-28 04:12:12 +02:00
|
|
|
return IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, D3DFMT_UNKNOWN, Mode, pMode);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
2004-09-28 04:12:12 +02:00
|
|
|
HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface, UINT Adapter, D3DDISPLAYMODE* pMode) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2004-09-28 04:12:12 +02:00
|
|
|
return IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, pMode);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirect3D8Impl_CheckDeviceType (LPDIRECT3D8 iface,
|
|
|
|
UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat,
|
|
|
|
D3DFORMAT BackBufferFormat, BOOL Windowed) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2004-10-05 04:14:06 +02:00
|
|
|
return IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, DisplayFormat,
|
|
|
|
BackBufferFormat, Windowed);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 iface,
|
|
|
|
UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
|
|
|
|
DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2004-10-05 04:14:06 +02:00
|
|
|
return IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, AdapterFormat,
|
|
|
|
Usage, RType, CheckFormat);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
2003-06-05 00:55:19 +02:00
|
|
|
HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(LPDIRECT3D8 iface,
|
|
|
|
UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat,
|
|
|
|
BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2004-10-05 04:14:06 +02:00
|
|
|
return IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, SurfaceFormat,
|
|
|
|
Windowed, MultiSampleType, NULL);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
2003-06-05 00:55:19 +02:00
|
|
|
HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(LPDIRECT3D8 iface,
|
|
|
|
UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
|
|
|
|
D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2004-10-05 04:14:06 +02:00
|
|
|
return IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType, AdapterFormat,
|
|
|
|
RenderTargetFormat, DepthStencilFormat);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
2003-06-05 00:55:19 +02:00
|
|
|
HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2005-06-17 11:59:03 +02:00
|
|
|
HRESULT hrc = D3D_OK;
|
|
|
|
WINED3DCAPS *pWineCaps;
|
|
|
|
|
|
|
|
TRACE("(%p) Relay %d %u %p \n", This, Adapter, DeviceType, pCaps);
|
|
|
|
|
|
|
|
if(NULL == pCaps){
|
|
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
}
|
|
|
|
pWineCaps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS));
|
|
|
|
if(pWineCaps == NULL){
|
|
|
|
return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/
|
|
|
|
}
|
|
|
|
D3D8CAPSTOWINECAPS(pCaps, pWineCaps)
|
|
|
|
hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps);
|
|
|
|
HeapFree(GetProcessHeap(), 0, pWineCaps);
|
|
|
|
TRACE("(%p) returning %p\n", This, pCaps);
|
|
|
|
return hrc;
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
2003-06-05 00:55:19 +02:00
|
|
|
HMONITOR WINAPI IDirect3D8Impl_GetAdapterMonitor(LPDIRECT3D8 iface, UINT Adapter) {
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2004-09-28 04:12:12 +02:00
|
|
|
return IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
2003-06-05 00:55:19 +02:00
|
|
|
static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) {
|
|
|
|
const char *GL_Extensions = NULL;
|
|
|
|
const char *GLX_Extensions = NULL;
|
|
|
|
GLint gl_max;
|
2004-04-23 01:46:05 +02:00
|
|
|
const char* gl_string = NULL;
|
|
|
|
const char* gl_string_cursor = NULL;
|
|
|
|
Bool test = 0;
|
|
|
|
int major, minor;
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2003-06-05 00:55:19 +02:00
|
|
|
|
2004-05-21 22:53:19 +02:00
|
|
|
if (This->gl_info.bIsFilled) return;
|
2004-04-20 01:04:58 +02:00
|
|
|
This->gl_info.bIsFilled = 1;
|
2004-04-23 23:27:30 +02:00
|
|
|
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)("(%p, %p)\n", This, display);
|
|
|
|
|
2004-04-23 23:27:30 +02:00
|
|
|
if (NULL != display) {
|
2004-05-19 06:33:42 +02:00
|
|
|
test = glXQueryVersion(display, &major, &minor);
|
2004-04-23 23:27:30 +02:00
|
|
|
This->gl_info.glx_version = ((major & 0x0000FFFF) << 16) | (minor & 0x0000FFFF);
|
2004-05-19 06:33:42 +02:00
|
|
|
gl_string = glXGetClientString(display, GLX_VENDOR);
|
2004-04-23 23:27:30 +02:00
|
|
|
} else {
|
|
|
|
gl_string = glGetString(GL_VENDOR);
|
|
|
|
}
|
2004-04-26 22:12:28 +02:00
|
|
|
|
2004-04-23 01:46:05 +02:00
|
|
|
if (strstr(gl_string, "NVIDIA")) {
|
|
|
|
This->gl_info.gl_vendor = VENDOR_NVIDIA;
|
|
|
|
} else if (strstr(gl_string, "ATI")) {
|
|
|
|
This->gl_info.gl_vendor = VENDOR_ATI;
|
|
|
|
} else {
|
|
|
|
This->gl_info.gl_vendor = VENDOR_WINE;
|
|
|
|
}
|
2004-04-26 22:12:28 +02:00
|
|
|
|
|
|
|
TRACE_(d3d_caps)("found GL_VENDOR (%s)->(0x%04x)\n", debugstr_a(gl_string), This->gl_info.gl_vendor);
|
|
|
|
|
2004-04-23 01:46:05 +02:00
|
|
|
gl_string = glGetString(GL_VERSION);
|
|
|
|
switch (This->gl_info.gl_vendor) {
|
|
|
|
case VENDOR_NVIDIA:
|
|
|
|
gl_string_cursor = strstr(gl_string, "NVIDIA");
|
|
|
|
gl_string_cursor = strstr(gl_string_cursor, " ");
|
|
|
|
while (*gl_string_cursor && ' ' == *gl_string_cursor) ++gl_string_cursor;
|
|
|
|
if (*gl_string_cursor) {
|
|
|
|
char tmp[16];
|
|
|
|
int cursor = 0;
|
|
|
|
|
|
|
|
while (*gl_string_cursor <= '9' && *gl_string_cursor >= '0') {
|
|
|
|
tmp[cursor++] = *gl_string_cursor;
|
|
|
|
++gl_string_cursor;
|
|
|
|
}
|
|
|
|
tmp[cursor] = 0;
|
|
|
|
major = atoi(tmp);
|
|
|
|
|
2004-04-26 22:12:28 +02:00
|
|
|
if (*gl_string_cursor != '.') WARN_(d3d_caps)("malformed GL_VERSION (%s)\n", debugstr_a(gl_string));
|
2004-04-23 01:46:05 +02:00
|
|
|
++gl_string_cursor;
|
|
|
|
|
|
|
|
while (*gl_string_cursor <= '9' && *gl_string_cursor >= '0') {
|
|
|
|
tmp[cursor++] = *gl_string_cursor;
|
|
|
|
++gl_string_cursor;
|
|
|
|
}
|
|
|
|
tmp[cursor] = 0;
|
|
|
|
minor = atoi(tmp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case VENDOR_ATI:
|
2004-05-21 22:53:19 +02:00
|
|
|
major = minor = 0;
|
|
|
|
gl_string_cursor = strchr(gl_string, '-');
|
2005-02-24 11:05:06 +01:00
|
|
|
if (gl_string_cursor) {
|
2004-05-21 22:53:19 +02:00
|
|
|
int error = 0;
|
2005-02-24 11:05:06 +01:00
|
|
|
gl_string_cursor++;
|
|
|
|
|
2004-05-21 22:53:19 +02:00
|
|
|
/* Check if version number is of the form x.y.z */
|
|
|
|
if (*gl_string_cursor > '9' && *gl_string_cursor < '0')
|
|
|
|
error = 1;
|
|
|
|
if (!error && *(gl_string_cursor+2) > '9' && *(gl_string_cursor+2) < '0')
|
|
|
|
error = 1;
|
|
|
|
if (!error && *(gl_string_cursor+4) > '9' && *(gl_string_cursor+4) < '0')
|
|
|
|
error = 1;
|
|
|
|
if (!error && *(gl_string_cursor+1) != '.' && *(gl_string_cursor+3) != '.')
|
|
|
|
error = 1;
|
|
|
|
/* Mark version number as malformed */
|
|
|
|
if (error)
|
|
|
|
gl_string_cursor = 0;
|
|
|
|
}
|
|
|
|
if (!gl_string_cursor)
|
|
|
|
WARN_(d3d_caps)("malformed GL_VERSION (%s)\n", debugstr_a(gl_string));
|
|
|
|
else {
|
|
|
|
major = *gl_string_cursor - '0';
|
|
|
|
minor = (*(gl_string_cursor+2) - '0') * 256 + (*(gl_string_cursor+4) - '0');
|
|
|
|
}
|
|
|
|
break;
|
2004-04-23 01:46:05 +02:00
|
|
|
default:
|
|
|
|
major = 0;
|
|
|
|
minor = 9;
|
|
|
|
}
|
2004-04-26 22:12:28 +02:00
|
|
|
This->gl_info.gl_driver_version = MAKEDWORD_VERSION(major, minor);
|
2004-04-23 01:46:05 +02:00
|
|
|
|
2004-05-21 22:53:19 +02:00
|
|
|
FIXME_(d3d_caps)("found GL_VERSION (%s)->(0x%08lx)\n", debugstr_a(gl_string), This->gl_info.gl_driver_version);
|
|
|
|
|
2004-04-23 01:46:05 +02:00
|
|
|
gl_string = glGetString(GL_RENDERER);
|
|
|
|
strcpy(This->gl_info.gl_renderer, gl_string);
|
2004-04-20 01:04:58 +02:00
|
|
|
|
2004-04-26 22:12:28 +02:00
|
|
|
switch (This->gl_info.gl_vendor) {
|
|
|
|
case VENDOR_NVIDIA:
|
|
|
|
if (strstr(This->gl_info.gl_renderer, "GeForce4 Ti")) {
|
|
|
|
This->gl_info.gl_card = CARD_NVIDIA_GEFORCE4_TI4600;
|
|
|
|
} else if (strstr(This->gl_info.gl_renderer, "GeForceFX")) {
|
|
|
|
This->gl_info.gl_card = CARD_NVIDIA_GEFORCEFX_5900ULTRA;
|
|
|
|
} else {
|
|
|
|
This->gl_info.gl_card = CARD_NVIDIA_GEFORCE4_TI4600;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VENDOR_ATI:
|
2004-05-21 22:53:19 +02:00
|
|
|
if (strstr(This->gl_info.gl_renderer, "RADEON 9800 PRO")) {
|
|
|
|
This->gl_info.gl_card = CARD_ATI_RADEON_9800PRO;
|
|
|
|
} else if (strstr(This->gl_info.gl_renderer, "RADEON 9700 PRO")) {
|
|
|
|
This->gl_info.gl_card = CARD_ATI_RADEON_9700PRO;
|
|
|
|
} else {
|
|
|
|
This->gl_info.gl_card = CARD_ATI_RADEON_8500;
|
|
|
|
}
|
2004-04-26 22:12:28 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
This->gl_info.gl_card = CARD_WINE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME_(d3d_caps)("found GL_RENDERER (%s)->(0x%04x)\n", debugstr_a(This->gl_info.gl_renderer), This->gl_info.gl_card);
|
2004-05-21 22:53:19 +02:00
|
|
|
|
|
|
|
/*
|
2003-06-05 00:55:19 +02:00
|
|
|
* Initialize openGL extension related variables
|
2004-05-21 22:53:19 +02:00
|
|
|
* with Default values
|
2003-06-05 00:55:19 +02:00
|
|
|
*/
|
|
|
|
memset(&This->gl_info.supported, 0, sizeof(This->gl_info.supported));
|
|
|
|
This->gl_info.max_textures = 1;
|
|
|
|
This->gl_info.ps_arb_version = PS_VERSION_NOT_SUPPORTED;
|
|
|
|
This->gl_info.vs_arb_version = VS_VERSION_NOT_SUPPORTED;
|
|
|
|
This->gl_info.vs_nv_version = VS_VERSION_NOT_SUPPORTED;
|
|
|
|
This->gl_info.vs_ati_version = VS_VERSION_NOT_SUPPORTED;
|
|
|
|
|
2003-06-05 01:01:49 +02:00
|
|
|
#define USE_GL_FUNC(type, pfn) This->gl_info.pfn = NULL;
|
|
|
|
GL_EXT_FUNCS_GEN;
|
|
|
|
#undef USE_GL_FUNC
|
|
|
|
|
2003-06-05 00:55:19 +02:00
|
|
|
/* Retrieve opengl defaults */
|
|
|
|
glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
|
|
|
|
This->gl_info.max_clipplanes = min(MAX_CLIPPLANES, gl_max);
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)("ClipPlanes support - num Planes=%d\n", gl_max);
|
2003-06-05 00:55:19 +02:00
|
|
|
|
|
|
|
glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
|
2003-09-30 02:21:07 +02:00
|
|
|
This->gl_info.max_lights = gl_max;
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)("Lights support - max lights=%d\n", gl_max);
|
2003-06-05 00:55:19 +02:00
|
|
|
|
|
|
|
/* Parse the gl supported features, in theory enabling parts of our code appropriately */
|
|
|
|
GL_Extensions = glGetString(GL_EXTENSIONS);
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)("GL_Extensions reported:\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
|
|
|
|
if (NULL == GL_Extensions) {
|
|
|
|
ERR(" GL_Extensions returns NULL\n");
|
|
|
|
} else {
|
|
|
|
while (*GL_Extensions != 0x00) {
|
|
|
|
const char *Start = GL_Extensions;
|
|
|
|
char ThisExtn[256];
|
|
|
|
|
|
|
|
memset(ThisExtn, 0x00, sizeof(ThisExtn));
|
|
|
|
while (*GL_Extensions != ' ' && *GL_Extensions != 0x00) {
|
|
|
|
GL_Extensions++;
|
|
|
|
}
|
|
|
|
memcpy(ThisExtn, Start, (GL_Extensions - Start));
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)("- %s\n", ThisExtn);
|
2003-06-05 00:55:19 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ARB
|
|
|
|
*/
|
|
|
|
if (strcmp(ThisExtn, "GL_ARB_fragment_program") == 0) {
|
|
|
|
This->gl_info.ps_arb_version = PS_VERSION_11;
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ARB Pixel Shader support - version=%02x\n", This->gl_info.ps_arb_version);
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[ARB_FRAGMENT_PROGRAM] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_ARB_multisample") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ARB Multisample support\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[ARB_MULTISAMPLE] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_ARB_multitexture") == 0) {
|
|
|
|
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max);
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ARB Multitexture support - GL_MAX_TEXTURE_UNITS_ARB=%u\n", gl_max);
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[ARB_MULTITEXTURE] = TRUE;
|
|
|
|
This->gl_info.max_textures = min(8, gl_max);
|
|
|
|
} else if (strcmp(ThisExtn, "GL_ARB_texture_cube_map") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ARB Texture Cube Map support\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[ARB_TEXTURE_CUBE_MAP] = TRUE;
|
2004-04-29 02:20:18 +02:00
|
|
|
TRACE_(d3d_caps)(" IMPLIED: NVIDIA (NV) Texture Gen Reflection support\n");
|
|
|
|
This->gl_info.supported[NV_TEXGEN_REFLECTION] = TRUE;
|
2003-06-05 00:55:19 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_ARB_texture_compression") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ARB Texture Compression support\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[ARB_TEXTURE_COMPRESSION] = TRUE;
|
2004-03-30 07:14:57 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_ARB_texture_env_add") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ARB Texture Env Add support\n");
|
2004-03-30 07:14:57 +02:00
|
|
|
This->gl_info.supported[ARB_TEXTURE_ENV_ADD] = TRUE;
|
2003-06-06 20:12:59 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_ARB_texture_env_combine") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ARB Texture Env combine support\n");
|
2003-06-06 20:12:59 +02:00
|
|
|
This->gl_info.supported[ARB_TEXTURE_ENV_COMBINE] = TRUE;
|
2003-06-05 00:55:19 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_ARB_texture_env_dot3") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ARB Dot3 support\n");
|
2004-03-30 07:14:57 +02:00
|
|
|
This->gl_info.supported[ARB_TEXTURE_ENV_DOT3] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_ARB_texture_border_clamp") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ARB Texture border clamp support\n");
|
2004-03-30 07:14:57 +02:00
|
|
|
This->gl_info.supported[ARB_TEXTURE_BORDER_CLAMP] = TRUE;
|
2004-04-20 01:04:58 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_ARB_texture_mirrored_repeat") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ARB Texture mirrored repeat support\n");
|
2004-04-20 01:04:58 +02:00
|
|
|
This->gl_info.supported[ARB_TEXTURE_MIRRORED_REPEAT] = TRUE;
|
2003-06-05 00:55:19 +02:00
|
|
|
} else if (strstr(ThisExtn, "GL_ARB_vertex_program")) {
|
|
|
|
This->gl_info.vs_arb_version = VS_VERSION_11;
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ARB Vertex Shader support - version=%02x\n", This->gl_info.vs_arb_version);
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[ARB_VERTEX_PROGRAM] = TRUE;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* EXT
|
|
|
|
*/
|
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_fog_coord") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Fog coord support\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[EXT_FOG_COORD] = TRUE;
|
2003-06-05 01:05:46 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_paletted_texture") == 0) { /* handle paletted texture extensions */
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Paletted texture support\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[EXT_PALETTED_TEXTURE] = TRUE;
|
2003-06-05 01:05:46 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_point_parameters") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Point parameters support\n");
|
2003-06-05 01:05:46 +02:00
|
|
|
This->gl_info.supported[EXT_POINT_PARAMETERS] = TRUE;
|
2003-06-05 00:55:19 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_secondary_color") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Secondary coord support\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[EXT_SECONDARY_COLOR] = TRUE;
|
2004-04-29 02:20:18 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_stencil_wrap") == 0) {
|
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Stencil wrap support\n");
|
|
|
|
This->gl_info.supported[EXT_STENCIL_WRAP] = TRUE;
|
2003-06-05 00:55:19 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_texture_compression_s3tc") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Texture S3TC compression support\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[EXT_TEXTURE_COMPRESSION_S3TC] = TRUE;
|
2004-03-30 07:14:57 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_texture_env_add") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Texture Env Add support\n");
|
2004-03-30 07:14:57 +02:00
|
|
|
This->gl_info.supported[EXT_TEXTURE_ENV_ADD] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_texture_env_combine") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Texture Env combine support\n");
|
2004-03-30 07:14:57 +02:00
|
|
|
This->gl_info.supported[EXT_TEXTURE_ENV_COMBINE] = TRUE;
|
2003-06-06 20:12:59 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_texture_env_dot3") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Dot3 support\n");
|
2004-03-30 07:14:57 +02:00
|
|
|
This->gl_info.supported[EXT_TEXTURE_ENV_DOT3] = TRUE;
|
2003-06-05 00:55:19 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_texture_filter_anisotropic") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Texture Anisotropic filter support\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[EXT_TEXTURE_FILTER_ANISOTROPIC] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_texture_lod") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Texture LOD support\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[EXT_TEXTURE_LOD] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_texture_lod_bias") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Texture LOD bias support\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[EXT_TEXTURE_LOD_BIAS] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_vertex_weighting") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: EXT Vertex weighting support\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[EXT_VERTEX_WEIGHTING] = TRUE;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* NVIDIA
|
|
|
|
*/
|
2004-04-26 22:12:28 +02:00
|
|
|
} else if (strstr(ThisExtn, "GL_NV_fog_distance")) {
|
|
|
|
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Fog Distance support\n");
|
|
|
|
This->gl_info.supported[NV_FOG_DISTANCE] = TRUE;
|
2004-04-29 02:20:18 +02:00
|
|
|
} else if (strstr(ThisExtn, "GL_NV_fragment_program")) {
|
|
|
|
This->gl_info.ps_nv_version = PS_VERSION_11;
|
|
|
|
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Pixel Shader support - version=%02x\n", This->gl_info.ps_nv_version);
|
|
|
|
} else if (strcmp(ThisExtn, "GL_NV_register_combiners") == 0) {
|
|
|
|
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Register combiners (1) support\n");
|
|
|
|
This->gl_info.supported[NV_REGISTER_COMBINERS] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_NV_register_combiners2") == 0) {
|
|
|
|
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Register combiners (2) support\n");
|
|
|
|
This->gl_info.supported[NV_REGISTER_COMBINERS2] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_NV_texgen_reflection") == 0) {
|
|
|
|
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Gen Reflection support\n");
|
|
|
|
This->gl_info.supported[NV_TEXGEN_REFLECTION] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_NV_texture_env_combine4") == 0) {
|
|
|
|
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Env combine (4) support\n");
|
|
|
|
This->gl_info.supported[NV_TEXTURE_ENV_COMBINE4] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_NV_texture_shader") == 0) {
|
|
|
|
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (1) support\n");
|
|
|
|
This->gl_info.supported[NV_TEXTURE_SHADER] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_NV_texture_shader2") == 0) {
|
|
|
|
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (2) support\n");
|
|
|
|
This->gl_info.supported[NV_TEXTURE_SHADER2] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_NV_texture_shader3") == 0) {
|
|
|
|
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (3) support\n");
|
|
|
|
This->gl_info.supported[NV_TEXTURE_SHADER3] = TRUE;
|
2003-06-05 00:55:19 +02:00
|
|
|
} else if (strstr(ThisExtn, "GL_NV_vertex_program")) {
|
|
|
|
This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program1_1")) ? VS_VERSION_11 : VS_VERSION_10);
|
|
|
|
This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program2")) ? VS_VERSION_20 : VS_VERSION_10);
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Vertex Shader support - version=%02x\n", This->gl_info.vs_nv_version);
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[NV_VERTEX_PROGRAM] = TRUE;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ATI
|
|
|
|
*/
|
|
|
|
/** TODO */
|
2004-03-30 07:14:57 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_ATI_texture_env_combine3") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ATI Texture Env combine (3) support\n");
|
2004-03-30 07:14:57 +02:00
|
|
|
This->gl_info.supported[ATI_TEXTURE_ENV_COMBINE3] = TRUE;
|
|
|
|
} else if (strcmp(ThisExtn, "GL_ATI_texture_mirror_once") == 0) {
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ATI Texture Mirror Once support\n");
|
2004-03-30 07:14:57 +02:00
|
|
|
This->gl_info.supported[ATI_TEXTURE_MIRROR_ONCE] = TRUE;
|
2003-06-05 00:55:19 +02:00
|
|
|
} else if (strcmp(ThisExtn, "GL_EXT_vertex_shader") == 0) {
|
|
|
|
This->gl_info.vs_ati_version = VS_VERSION_11;
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)(" FOUND: ATI (EXT) Vertex Shader support - version=%02x\n", This->gl_info.vs_ati_version);
|
2003-06-05 00:55:19 +02:00
|
|
|
This->gl_info.supported[EXT_VERTEX_SHADER] = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (*GL_Extensions == ' ') GL_Extensions++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-05 01:01:49 +02:00
|
|
|
#define USE_GL_FUNC(type, pfn) This->gl_info.pfn = (type) glXGetProcAddressARB(#pfn);
|
|
|
|
GL_EXT_FUNCS_GEN;
|
|
|
|
#undef USE_GL_FUNC
|
|
|
|
|
2003-10-03 06:35:07 +02:00
|
|
|
if (display != NULL) {
|
|
|
|
GLX_Extensions = glXQueryExtensionsString(display, DefaultScreen(display));
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)("GLX_Extensions reported:\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
|
2003-10-03 06:35:07 +02:00
|
|
|
if (NULL == GLX_Extensions) {
|
|
|
|
ERR(" GLX_Extensions returns NULL\n");
|
|
|
|
} else {
|
|
|
|
while (*GLX_Extensions != 0x00) {
|
|
|
|
const char *Start = GLX_Extensions;
|
|
|
|
char ThisExtn[256];
|
|
|
|
|
|
|
|
memset(ThisExtn, 0x00, sizeof(ThisExtn));
|
|
|
|
while (*GLX_Extensions != ' ' && *GLX_Extensions != 0x00) {
|
|
|
|
GLX_Extensions++;
|
|
|
|
}
|
|
|
|
memcpy(ThisExtn, Start, (GLX_Extensions - Start));
|
2004-04-26 22:12:28 +02:00
|
|
|
TRACE_(d3d_caps)("- %s\n", ThisExtn);
|
2003-10-03 06:35:07 +02:00
|
|
|
if (*GLX_Extensions == ' ') GLX_Extensions++;
|
|
|
|
}
|
2003-06-05 00:55:19 +02:00
|
|
|
}
|
|
|
|
}
|
2003-06-06 20:12:59 +02:00
|
|
|
|
|
|
|
#define USE_GL_FUNC(type, pfn) This->gl_info.pfn = (type) glXGetProcAddressARB(#pfn);
|
|
|
|
GLX_EXT_FUNCS_GEN;
|
|
|
|
#undef USE_GL_FUNC
|
|
|
|
|
2003-10-03 06:35:07 +02:00
|
|
|
/* Only save the values obtained when a display is provided */
|
|
|
|
if (display != NULL) This->isGLInfoValid = TRUE;
|
|
|
|
|
2003-06-05 00:55:19 +02:00
|
|
|
}
|
|
|
|
|
2005-01-09 18:37:02 +01:00
|
|
|
/* Internal function called back during the CreateDevice to create a render target */
|
|
|
|
HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Height,
|
2005-03-29 21:01:00 +02:00
|
|
|
WINED3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
|
2005-01-09 18:37:02 +01:00
|
|
|
DWORD MultisampleQuality, BOOL Lockable,
|
|
|
|
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) {
|
|
|
|
HRESULT res = D3D_OK;
|
|
|
|
IDirect3DSurface8Impl *d3dSurface = NULL;
|
|
|
|
|
|
|
|
/* Note - Throw away MultisampleQuality and SharedHandle - only relevant for d3d9 */
|
|
|
|
res = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)device, Width, Height,
|
2005-03-29 21:01:00 +02:00
|
|
|
(D3DFORMAT)Format, MultiSample, Lockable,
|
2005-01-09 18:37:02 +01:00
|
|
|
(IDirect3DSurface8 **)&d3dSurface);
|
|
|
|
if (res == D3D_OK) {
|
|
|
|
*ppSurface = d3dSurface->wineD3DSurface;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-06-23 13:05:24 +02:00
|
|
|
/* Callback for creating the inplicite swapchain when the device is created */
|
|
|
|
HRESULT WINAPI D3D8CB_CreateAdditionalSwapChain(IUnknown *device,
|
|
|
|
WINED3DPRESENT_PARAMETERS* pPresentationParameters,
|
|
|
|
IWineD3DSwapChain ** ppSwapChain){
|
|
|
|
HRESULT res = D3D_OK;
|
|
|
|
IDirect3DSwapChain8Impl *d3dSwapChain = NULL;
|
|
|
|
/* We have to pass the presentation parameters back and forth */
|
|
|
|
D3DPRESENT_PARAMETERS localParameters;
|
|
|
|
localParameters.BackBufferWidth = *(pPresentationParameters->BackBufferWidth);
|
|
|
|
localParameters.BackBufferHeight = *(pPresentationParameters->BackBufferHeight);
|
|
|
|
localParameters.BackBufferFormat = *(pPresentationParameters->BackBufferFormat);
|
|
|
|
localParameters.BackBufferCount = *(pPresentationParameters->BackBufferCount);
|
|
|
|
localParameters.MultiSampleType = *(pPresentationParameters->MultiSampleType);
|
|
|
|
/* d3d9 only */
|
|
|
|
/* localParameters.MultiSampleQuality = *(pPresentationParameters->MultiSampleQuality); */
|
|
|
|
localParameters.SwapEffect = *(pPresentationParameters->SwapEffect);
|
|
|
|
localParameters.hDeviceWindow = *(pPresentationParameters->hDeviceWindow);
|
|
|
|
localParameters.Windowed = *(pPresentationParameters->Windowed);
|
|
|
|
localParameters.EnableAutoDepthStencil = *(pPresentationParameters->EnableAutoDepthStencil);
|
|
|
|
localParameters.AutoDepthStencilFormat = *(pPresentationParameters->AutoDepthStencilFormat);
|
|
|
|
localParameters.Flags = *(pPresentationParameters->Flags);
|
|
|
|
localParameters.FullScreen_RefreshRateInHz = *(pPresentationParameters->FullScreen_RefreshRateInHz);
|
|
|
|
/* not in d3d8 */
|
|
|
|
/* localParameters.PresentationInterval = *(pPresentationParameters->PresentationInterval); */
|
|
|
|
|
|
|
|
TRACE("(%p) rellaying\n", device);
|
|
|
|
/*copy the presentation parameters*/
|
|
|
|
res = IDirect3DDevice8_CreateAdditionalSwapChain((IDirect3DDevice8 *)device, &localParameters, (IDirect3DSwapChain8 **)&d3dSwapChain);
|
|
|
|
|
|
|
|
if (res == D3D_OK){
|
|
|
|
*ppSwapChain = d3dSwapChain->wineD3DSwapChain;
|
|
|
|
} else {
|
|
|
|
FIXME("failed to create additional swap chain\n");
|
|
|
|
*ppSwapChain = NULL;
|
|
|
|
}
|
|
|
|
/* Copy back the presentation parameters */
|
|
|
|
TRACE("(%p) setting up return parameters\n", device);
|
|
|
|
*pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
|
|
|
|
*pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
|
|
|
|
*pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
|
|
|
|
*pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
|
|
|
|
*pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
|
2005-06-30 20:19:33 +02:00
|
|
|
/* *pPresentationParameters->MultiSampleQuality leave alone in case wined3d set something internally */
|
2005-06-23 13:05:24 +02:00
|
|
|
*pPresentationParameters->SwapEffect = localParameters.SwapEffect;
|
|
|
|
*pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
|
|
|
|
*pPresentationParameters->Windowed = localParameters.Windowed;
|
|
|
|
*pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
|
|
|
|
*pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
|
|
|
|
*pPresentationParameters->Flags = localParameters.Flags;
|
|
|
|
*pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
|
2005-06-30 20:19:33 +02:00
|
|
|
/* *pPresentationParameters->PresentationInterval leave alone in case wined3d set something internally */
|
2005-06-23 13:05:24 +02:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2002-09-28 00:46:16 +02:00
|
|
|
HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
|
|
|
|
UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
|
|
|
|
DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters,
|
|
|
|
IDirect3DDevice8** ppReturnedDeviceInterface) {
|
|
|
|
IDirect3DDevice8Impl *object;
|
|
|
|
HWND whichHWND;
|
2002-12-18 06:05:41 +01:00
|
|
|
int num;
|
|
|
|
XVisualInfo template;
|
2003-11-17 21:04:08 +01:00
|
|
|
HDC hDc;
|
2004-10-08 22:52:33 +02:00
|
|
|
WINED3DPRESENT_PARAMETERS localParameters;
|
2002-09-28 00:46:16 +02:00
|
|
|
|
2004-09-08 03:50:37 +02:00
|
|
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
2002-10-19 01:48:57 +02:00
|
|
|
TRACE("(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)\n", This, Adapter, DeviceType,
|
2002-09-28 00:46:16 +02:00
|
|
|
hFocusWindow, BehaviourFlags, pPresentationParameters, ppReturnedDeviceInterface);
|
|
|
|
|
2004-05-19 06:33:42 +02:00
|
|
|
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
|
|
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
}
|
|
|
|
|
2002-09-28 00:46:16 +02:00
|
|
|
/* Allocate the storage for the device */
|
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice8Impl));
|
2002-12-18 06:05:41 +01:00
|
|
|
if (NULL == object) {
|
|
|
|
return D3DERR_OUTOFVIDEOMEMORY;
|
|
|
|
}
|
2002-09-28 00:46:16 +02:00
|
|
|
object->lpVtbl = &Direct3DDevice8_Vtbl;
|
|
|
|
object->ref = 1;
|
|
|
|
object->direct3d8 = This;
|
2003-01-15 00:05:39 +01:00
|
|
|
/** The device AddRef the direct3d8 Interface else crash in propers clients codes */
|
|
|
|
IDirect3D8_AddRef((LPDIRECT3D8) object->direct3d8);
|
2003-01-28 02:12:23 +01:00
|
|
|
|
2004-10-08 22:52:33 +02:00
|
|
|
/* Allocate an associated WineD3DDevice object */
|
|
|
|
localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
|
|
|
|
localParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight;
|
|
|
|
localParameters.BackBufferFormat = &pPresentationParameters->BackBufferFormat;
|
|
|
|
localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
|
|
|
|
localParameters.MultiSampleType = &pPresentationParameters->MultiSampleType;
|
|
|
|
localParameters.MultiSampleQuality = NULL; /* New at dx9 */
|
|
|
|
localParameters.SwapEffect = &pPresentationParameters->SwapEffect;
|
|
|
|
localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
|
|
|
|
localParameters.Windowed = &pPresentationParameters->Windowed;
|
|
|
|
localParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil;
|
|
|
|
localParameters.AutoDepthStencilFormat = &pPresentationParameters->AutoDepthStencilFormat;
|
|
|
|
localParameters.Flags = &pPresentationParameters->Flags;
|
|
|
|
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
|
|
|
|
localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval; /* Renamed in dx9 */
|
2005-06-23 13:05:24 +02:00
|
|
|
IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D8CB_CreateAdditionalSwapChain);
|
2004-10-08 22:52:33 +02:00
|
|
|
|
2003-01-28 02:12:23 +01:00
|
|
|
/** use StateBlock Factory here, for creating the startup stateBlock */
|
|
|
|
object->StateBlock = NULL;
|
|
|
|
IDirect3DDeviceImpl_CreateStateBlock(object, D3DSBT_ALL, NULL);
|
|
|
|
object->UpdateStateBlock = object->StateBlock;
|
2002-10-07 20:24:28 +02:00
|
|
|
|
|
|
|
/* Save the creation parameters */
|
|
|
|
object->CreateParms.AdapterOrdinal = Adapter;
|
|
|
|
object->CreateParms.DeviceType = DeviceType;
|
|
|
|
object->CreateParms.hFocusWindow = hFocusWindow;
|
|
|
|
object->CreateParms.BehaviorFlags = BehaviourFlags;
|
|
|
|
|
2003-05-17 20:33:02 +02:00
|
|
|
*ppReturnedDeviceInterface = (LPDIRECT3DDEVICE8) object;
|
2002-09-28 00:46:16 +02:00
|
|
|
|
|
|
|
/* Initialize settings */
|
|
|
|
object->PresentParms.BackBufferCount = 1; /* Opengl only supports one? */
|
|
|
|
object->adapterNo = Adapter;
|
|
|
|
object->devType = DeviceType;
|
|
|
|
|
2003-11-17 21:04:08 +01:00
|
|
|
/* Initialize openGl - Note the visual is chosen as the window is created and the glcontext cannot
|
|
|
|
use different properties after that point in time. FIXME: How to handle when requested format
|
2004-01-06 23:08:33 +01:00
|
|
|
doesn't match actual visual? Cannot choose one here - code removed as it ONLY works if the one
|
2003-11-17 21:04:08 +01:00
|
|
|
it chooses is identical to the one already being used! */
|
|
|
|
/* FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat */
|
2002-09-28 00:46:16 +02:00
|
|
|
|
2003-11-17 21:04:08 +01:00
|
|
|
/* Which hwnd are we using? */
|
|
|
|
whichHWND = pPresentationParameters->hDeviceWindow;
|
|
|
|
if (!whichHWND) {
|
|
|
|
whichHWND = hFocusWindow;
|
|
|
|
}
|
|
|
|
object->win_handle = whichHWND;
|
2005-01-31 17:34:07 +01:00
|
|
|
object->win = (Window)GetPropA( whichHWND, "__wine_x11_whole_window" );
|
2003-05-17 20:33:02 +02:00
|
|
|
|
2003-11-17 21:04:08 +01:00
|
|
|
hDc = GetDC(whichHWND);
|
|
|
|
object->display = get_display(hDc);
|
2003-05-17 20:33:02 +02:00
|
|
|
|
2003-11-17 21:04:08 +01:00
|
|
|
TRACE("(%p)->(DepthStencil:(%u,%s), BackBufferFormat:(%u,%s))\n", This,
|
|
|
|
pPresentationParameters->AutoDepthStencilFormat, debug_d3dformat(pPresentationParameters->AutoDepthStencilFormat),
|
|
|
|
pPresentationParameters->BackBufferFormat, debug_d3dformat(pPresentationParameters->BackBufferFormat));
|
2003-05-17 20:33:02 +02:00
|
|
|
|
2003-11-17 21:04:08 +01:00
|
|
|
ENTER_GL();
|
2002-09-28 00:46:16 +02:00
|
|
|
|
2003-11-17 21:04:08 +01:00
|
|
|
/* Create a context based off the properties of the existing visual */
|
|
|
|
template.visualid = (VisualID)GetPropA(GetDesktopWindow(), "__wine_x11_visual_id");
|
|
|
|
object->visInfo = XGetVisualInfo(object->display, VisualIDMask, &template, &num);
|
|
|
|
if (NULL == object->visInfo) {
|
|
|
|
ERR("cannot really get XVisual\n");
|
|
|
|
LEAVE_GL();
|
|
|
|
return D3DERR_NOTAVAILABLE;
|
|
|
|
}
|
|
|
|
object->glCtx = glXCreateContext(object->display, object->visInfo, NULL, GL_TRUE);
|
|
|
|
if (NULL == object->glCtx) {
|
|
|
|
ERR("cannot create glxContext\n");
|
|
|
|
LEAVE_GL();
|
|
|
|
return D3DERR_NOTAVAILABLE;
|
|
|
|
}
|
|
|
|
LEAVE_GL();
|
2002-09-28 00:46:16 +02:00
|
|
|
|
2003-11-17 21:04:08 +01:00
|
|
|
ReleaseDC(whichHWND, hDc);
|
|
|
|
|
2002-09-28 00:46:16 +02:00
|
|
|
if (object->glCtx == NULL) {
|
|
|
|
ERR("Error in context creation !\n");
|
|
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
} else {
|
2002-10-19 01:48:57 +02:00
|
|
|
TRACE("Context created (HWND=%p, glContext=%p, Window=%ld, VisInfo=%p)\n",
|
2003-05-17 20:33:02 +02:00
|
|
|
whichHWND, object->glCtx, object->win, object->visInfo);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
|
2003-04-20 04:47:22 +02:00
|
|
|
/* If not windowed, need to go fullscreen, and resize the HWND to the appropriate */
|
|
|
|
/* dimensions */
|
|
|
|
if (!pPresentationParameters->Windowed) {
|
2003-09-16 22:24:49 +02:00
|
|
|
#if 1
|
2003-06-05 00:55:19 +02:00
|
|
|
DEVMODEW devmode;
|
|
|
|
HDC hdc;
|
|
|
|
int bpp = 0;
|
|
|
|
memset(&devmode, 0, sizeof(DEVMODEW));
|
|
|
|
devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, "Gamers CG", -1, devmode.dmDeviceName, CCHDEVICENAME);
|
|
|
|
hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
|
|
|
|
bpp = GetDeviceCaps(hdc, BITSPIXEL);
|
|
|
|
DeleteDC(hdc);
|
|
|
|
devmode.dmBitsPerPel = (bpp >= 24) ? 32 : bpp;/*Stupid XVidMode cannot change bpp D3DFmtGetBpp(object, pPresentationParameters->BackBufferFormat);*/
|
|
|
|
devmode.dmPelsWidth = pPresentationParameters->BackBufferWidth;
|
|
|
|
devmode.dmPelsHeight = pPresentationParameters->BackBufferHeight;
|
|
|
|
ChangeDisplaySettingsExW(devmode.dmDeviceName, &devmode, object->win_handle, CDS_FULLSCREEN, NULL);
|
|
|
|
#else
|
2003-04-20 04:47:22 +02:00
|
|
|
FIXME("Requested full screen support not implemented, expect windowed operation\n");
|
2003-06-05 00:55:19 +02:00
|
|
|
#endif
|
2003-06-13 20:53:06 +02:00
|
|
|
|
|
|
|
/* Make popup window */
|
|
|
|
SetWindowLongA(whichHWND, GWL_STYLE, WS_POPUP);
|
2003-06-05 00:55:19 +02:00
|
|
|
SetWindowPos(object->win_handle, HWND_TOP, 0, 0,
|
|
|
|
pPresentationParameters->BackBufferWidth,
|
|
|
|
pPresentationParameters->BackBufferHeight, SWP_SHOWWINDOW | SWP_FRAMECHANGED);
|
2003-04-20 04:47:22 +02:00
|
|
|
}
|
|
|
|
|
2002-09-28 00:46:16 +02:00
|
|
|
TRACE("Creating back buffer\n");
|
|
|
|
/* MSDN: If Windowed is TRUE and either of the BackBufferWidth/Height values is zero,
|
|
|
|
then the corresponding dimension of the client area of the hDeviceWindow
|
|
|
|
(or the focus window, if hDeviceWindow is NULL) is taken. */
|
|
|
|
if (pPresentationParameters->Windowed && ((pPresentationParameters->BackBufferWidth == 0) ||
|
2003-05-17 20:33:02 +02:00
|
|
|
(pPresentationParameters->BackBufferHeight == 0))) {
|
2002-09-28 00:46:16 +02:00
|
|
|
RECT Rect;
|
|
|
|
|
|
|
|
GetClientRect(whichHWND, &Rect);
|
|
|
|
|
2003-05-17 20:33:02 +02:00
|
|
|
if (pPresentationParameters->BackBufferWidth == 0) {
|
2002-09-28 00:46:16 +02:00
|
|
|
pPresentationParameters->BackBufferWidth = Rect.right;
|
|
|
|
TRACE("Updating width to %d\n", pPresentationParameters->BackBufferWidth);
|
|
|
|
}
|
2003-05-17 20:33:02 +02:00
|
|
|
if (pPresentationParameters->BackBufferHeight == 0) {
|
2002-09-28 00:46:16 +02:00
|
|
|
pPresentationParameters->BackBufferHeight = Rect.bottom;
|
|
|
|
TRACE("Updating height to %d\n", pPresentationParameters->BackBufferHeight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-15 06:16:16 +02:00
|
|
|
/* Save the presentation parms now filled in correctly */
|
|
|
|
memcpy(&object->PresentParms, pPresentationParameters, sizeof(D3DPRESENT_PARAMETERS));
|
|
|
|
|
|
|
|
|
2003-05-11 05:35:27 +02:00
|
|
|
IDirect3DDevice8Impl_CreateRenderTarget((LPDIRECT3DDEVICE8) object,
|
|
|
|
pPresentationParameters->BackBufferWidth,
|
|
|
|
pPresentationParameters->BackBufferHeight,
|
|
|
|
pPresentationParameters->BackBufferFormat,
|
2003-06-04 23:55:29 +02:00
|
|
|
pPresentationParameters->MultiSampleType,
|
|
|
|
TRUE,
|
2003-05-11 05:35:27 +02:00
|
|
|
(LPDIRECT3DSURFACE8*) &object->frontBuffer);
|
|
|
|
|
|
|
|
IDirect3DDevice8Impl_CreateRenderTarget((LPDIRECT3DDEVICE8) object,
|
2002-09-28 00:46:16 +02:00
|
|
|
pPresentationParameters->BackBufferWidth,
|
|
|
|
pPresentationParameters->BackBufferHeight,
|
|
|
|
pPresentationParameters->BackBufferFormat,
|
2003-06-04 23:55:29 +02:00
|
|
|
pPresentationParameters->MultiSampleType,
|
|
|
|
TRUE,
|
2002-09-28 00:46:16 +02:00
|
|
|
(LPDIRECT3DSURFACE8*) &object->backBuffer);
|
|
|
|
|
2003-06-04 23:55:29 +02:00
|
|
|
if (pPresentationParameters->EnableAutoDepthStencil) {
|
|
|
|
IDirect3DDevice8Impl_CreateDepthStencilSurface((LPDIRECT3DDEVICE8) object,
|
|
|
|
pPresentationParameters->BackBufferWidth,
|
|
|
|
pPresentationParameters->BackBufferHeight,
|
|
|
|
pPresentationParameters->AutoDepthStencilFormat,
|
|
|
|
D3DMULTISAMPLE_NONE,
|
|
|
|
(LPDIRECT3DSURFACE8*) &object->depthStencilBuffer);
|
|
|
|
} else {
|
|
|
|
object->depthStencilBuffer = NULL;
|
|
|
|
}
|
2003-08-05 20:29:20 +02:00
|
|
|
TRACE("FrontBuf @ %p, BackBuf @ %p, DepthStencil @ %p\n",object->frontBuffer, object->backBuffer, object->depthStencilBuffer);
|
2003-06-04 23:55:29 +02:00
|
|
|
|
|
|
|
/* init the default renderTarget management */
|
|
|
|
object->drawable = object->win;
|
|
|
|
object->render_ctx = object->glCtx;
|
2004-05-02 06:22:31 +02:00
|
|
|
object->renderTarget = object->backBuffer;
|
2003-06-04 23:55:29 +02:00
|
|
|
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->renderTarget);
|
|
|
|
object->stencilBufferTarget = object->depthStencilBuffer;
|
2003-06-05 00:12:34 +02:00
|
|
|
if (NULL != object->stencilBufferTarget) {
|
2003-06-04 23:55:29 +02:00
|
|
|
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->stencilBufferTarget);
|
2003-06-05 00:12:34 +02:00
|
|
|
}
|
2003-06-04 23:55:29 +02:00
|
|
|
|
2002-09-28 00:46:16 +02:00
|
|
|
ENTER_GL();
|
2003-01-02 18:59:01 +01:00
|
|
|
|
2002-09-28 00:46:16 +02:00
|
|
|
if (glXMakeCurrent(object->display, object->win, object->glCtx) == False) {
|
2002-12-18 06:05:41 +01:00
|
|
|
ERR("Error in setting current context (context %p drawable %ld)!\n", object->glCtx, object->win);
|
2002-09-28 00:46:16 +02:00
|
|
|
}
|
|
|
|
checkGLcall("glXMakeCurrent");
|
|
|
|
|
|
|
|
/* Clear the screen */
|
|
|
|
glClearColor(1.0, 0.0, 0.0, 0.0);
|
|
|
|
checkGLcall("glClearColor");
|
|
|
|
glColor3f(1.0, 1.0, 1.0);
|
|
|
|
checkGLcall("glColor3f");
|
|
|
|
|
|
|
|
glEnable(GL_LIGHTING);
|
|
|
|
checkGLcall("glEnable");
|
|
|
|
|
2002-11-06 20:56:32 +01:00
|
|
|
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
|
|
|
|
checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);");
|
|
|
|
|
2002-12-18 06:05:41 +01:00
|
|
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
2003-06-04 23:55:29 +02:00
|
|
|
checkGLcall("glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);");
|
2002-09-28 00:46:16 +02:00
|
|
|
|
2003-06-05 00:12:34 +02:00
|
|
|
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
|
|
|
|
checkGLcall("glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);");
|
2003-06-05 00:04:44 +02:00
|
|
|
|
2003-06-04 23:55:29 +02:00
|
|
|
/*
|
|
|
|
* Initialize openGL extension related variables
|
|
|
|
* with Default values
|
|
|
|
*/
|
2003-06-05 00:55:19 +02:00
|
|
|
IDirect3D8Impl_FillGLCaps(iface, object->display);
|
2002-11-06 20:56:32 +01:00
|
|
|
|
2002-12-23 02:34:59 +01:00
|
|
|
/* Setup all the devices defaults */
|
2003-01-28 02:12:23 +01:00
|
|
|
IDirect3DDeviceImpl_InitStartupStateBlock(object);
|
2002-09-28 00:46:16 +02:00
|
|
|
|
2002-12-23 02:34:59 +01:00
|
|
|
LEAVE_GL();
|
2002-12-18 06:05:41 +01:00
|
|
|
|
2002-09-28 00:46:16 +02:00
|
|
|
{ /* Set a default viewport */
|
|
|
|
D3DVIEWPORT8 vp;
|
|
|
|
vp.X = 0;
|
|
|
|
vp.Y = 0;
|
|
|
|
vp.Width = pPresentationParameters->BackBufferWidth;
|
|
|
|
vp.Height = pPresentationParameters->BackBufferHeight;
|
|
|
|
vp.MinZ = 0.0f;
|
|
|
|
vp.MaxZ = 1.0f;
|
|
|
|
IDirect3DDevice8Impl_SetViewport((LPDIRECT3DDEVICE8) object, &vp);
|
|
|
|
}
|
|
|
|
|
2003-07-19 05:02:42 +02:00
|
|
|
/* Initialize the current view state */
|
|
|
|
object->modelview_valid = 1;
|
|
|
|
object->proj_valid = 0;
|
|
|
|
object->view_ident = 1;
|
|
|
|
object->last_was_rhw = 0;
|
2003-09-30 02:21:07 +02:00
|
|
|
glGetIntegerv(GL_MAX_LIGHTS, &object->maxConcurrentLights);
|
2003-09-25 22:22:21 +02:00
|
|
|
TRACE("(%p,%d) All defaults now set up, leaving CreateDevice with %p\n", This, Adapter, object);
|
2004-05-02 06:22:31 +02:00
|
|
|
|
|
|
|
/* Clear the screen */
|
|
|
|
IDirect3DDevice8Impl_Clear((LPDIRECT3DDEVICE8) object, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0);
|
|
|
|
|
2002-09-28 00:46:16 +02:00
|
|
|
return D3D_OK;
|
|
|
|
}
|
|
|
|
|
2005-05-27 22:17:35 +02:00
|
|
|
const IDirect3D8Vtbl Direct3D8_Vtbl =
|
2002-09-28 00:46:16 +02:00
|
|
|
{
|
|
|
|
IDirect3D8Impl_QueryInterface,
|
|
|
|
IDirect3D8Impl_AddRef,
|
|
|
|
IDirect3D8Impl_Release,
|
|
|
|
IDirect3D8Impl_RegisterSoftwareDevice,
|
|
|
|
IDirect3D8Impl_GetAdapterCount,
|
|
|
|
IDirect3D8Impl_GetAdapterIdentifier,
|
|
|
|
IDirect3D8Impl_GetAdapterModeCount,
|
|
|
|
IDirect3D8Impl_EnumAdapterModes,
|
|
|
|
IDirect3D8Impl_GetAdapterDisplayMode,
|
|
|
|
IDirect3D8Impl_CheckDeviceType,
|
|
|
|
IDirect3D8Impl_CheckDeviceFormat,
|
|
|
|
IDirect3D8Impl_CheckDeviceMultiSampleType,
|
|
|
|
IDirect3D8Impl_CheckDepthStencilMatch,
|
|
|
|
IDirect3D8Impl_GetDeviceCaps,
|
|
|
|
IDirect3D8Impl_GetAdapterMonitor,
|
|
|
|
IDirect3D8Impl_CreateDevice
|
|
|
|
};
|