wined3d_main.c revision 3c5c04d7b0973be0757addef8ba44b9352b38386
/*
* Direct3D wine internal interface main
*
* Copyright 2002-2003 The wine-d3d team
* Copyright 2002-2003 Raphael Junqueira
* Copyright 2004 Jason Edmeades
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
* Copyright 2009 Henri Verbeet for CodeWeavers
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#include "config.h"
#include "initguid.h"
#include "wined3d_private.h"
struct wined3d_wndproc
{
};
struct wined3d_wndproc_table
{
struct wined3d_wndproc *entries;
unsigned int count;
unsigned int size;
};
static struct wined3d_wndproc_table wndproc_table;
int num_lock = 0;
static CRITICAL_SECTION wined3d_cs;
static CRITICAL_SECTION_DEBUG wined3d_cs_debug =
{
0, 0, &wined3d_cs,
};
/* When updating default value here, make sure to update winecfg as well,
* where appropriate. */
{
VS_HW, /* Hardware by default */
PS_HW, /* Hardware by default */
TRUE, /* Use of GLSL enabled by default */
#ifdef VBOX_WITH_WDDM
ORM_FBO, /* Use FBO to do offscreen rendering */
#else
ORM_BACKBUFFER, /* Use backbuffer to do offscreen rendering */
#endif
RTL_READTEX, /* Default render target locking method */
PCI_VENDOR_NONE,/* PCI Vendor ID */
PCI_DEVICE_NONE,/* PCI Device ID */
0, /* The default of memory is set in FillGLCaps */
NULL, /* No wine logo by default */
FALSE, /* Disable multisampling for now due to Nvidia driver bugs which happens for some users */
FALSE, /* No strict draw ordering. */
};
{
#ifdef VBOX_WITH_WDDM
hr = VBoxExtCheckInit();
{
return NULL;
}
#endif
if (!object)
{
ERR("Failed to allocate wined3d object memory.\n");
#ifdef VBOX_WITH_WDDM
#endif
return NULL;
}
{
#ifdef VBOX_WITH_WDDM
#endif
return NULL;
}
}
static inline DWORD get_config_key(HKEY defkey, HKEY appkey, const char* name, char* buffer, DWORD size)
{
return ERROR_FILE_NOT_FOUND;
}
{
if (0 != appkey && !RegQueryValueExA( appkey, name, 0, &type, (LPBYTE) data, &size ) && (type == REG_DWORD)) return 0;
if (0 != defkey && !RegQueryValueExA( defkey, name, 0, &type, (LPBYTE) data, &size ) && (type == REG_DWORD)) return 0;
return ERROR_FILE_NOT_FOUND;
}
static void CDECL wined3d_do_nothing(void)
{
}
{
{
return FALSE;
}
/* We need our own window class for a fake window which we use to retrieve GL capabilities */
/* We might need CS_OWNDC in the future if we notice strange things on Windows.
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
if (!RegisterClassA(&wc))
{
ERR("Failed to register window class 'WineD3D_OpenGL'!\n");
if (!TlsFree(wined3d_context_tls_idx))
{
}
return FALSE;
}
if (mod)
{
}
else /* We are most likely on Windows */
{
}
/* @@ Wine registry key: HKCU\Software\Wine\Direct3D */
{
/* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\Direct3D */
{
RegCloseKey( tmpkey );
}
}
{
{
{
TRACE("Disable vertex shaders\n");
}
}
{
{
TRACE("Allow pixel shaders\n");
}
{
TRACE("Disable pixel shaders\n");
}
}
{
{
TRACE("Use of GL Shading Language disabled\n");
}
}
{
{
TRACE("Using the backbuffer for offscreen rendering\n");
}
{
TRACE("Using FBOs for offscreen rendering\n");
}
}
{
{
TRACE("Disabling render target locking\n");
}
{
TRACE("Using glReadPixels for render target reading and glDrawPixels for writing\n");
}
{
TRACE("Using glReadPixels for render target reading and textures for writing\n");
}
}
{
int pci_device_id = tmpvalue;
/* A pci device id is 16-bit */
if(pci_device_id > 0xffff)
{
ERR("Invalid value for VideoPciDeviceID. The value should be smaller or equal to 65535 or 0xffff\n");
}
else
{
}
}
{
int pci_vendor_id = tmpvalue;
/* A pci device id is 16-bit */
if(pci_vendor_id > 0xffff)
{
ERR("Invalid value for VideoPciVendorID. The value should be smaller or equal to 65535 or 0xffff\n");
}
else
{
}
}
{
if(TmpVideoMemorySize > 0)
{
TRACE("Use %iMB = %d byte for emulated_textureram\n",
}
else
}
{
}
{
{
TRACE("Allow multisampling\n");
}
}
{
TRACE("Enforcing strict draw ordering.\n");
}
}
TRACE("Allow HW vertex shaders\n");
TRACE("Disable pixel shaders\n");
TRACE("If supported by your system, GL Shading Language will be used\n");
return TRUE;
}
{
unsigned int i;
if (!TlsFree(wined3d_context_tls_idx))
{
}
for (i = 0; i < wndproc_table.count; ++i)
{
}
return TRUE;
}
void WINAPI wined3d_mutex_lock(void)
{
}
void WINAPI wined3d_mutex_unlock(void)
{
}
{
unsigned int i;
for (i = 0; i < wndproc_table.count; ++i)
{
{
return &wndproc_table.entries[i];
}
}
return NULL;
}
{
struct wined3d_wndproc *entry;
if (!entry)
{
}
}
{
struct wined3d_wndproc *entry;
{
struct wined3d_wndproc *new_entries;
if (!wndproc_table.entries) new_entries = HeapAlloc(GetProcessHeap(), 0, new_size * sizeof(*new_entries));
else new_entries = HeapReAlloc(GetProcessHeap(), 0, wndproc_table.entries, new_size * sizeof(*new_entries));
if (!new_entries)
{
ERR("Failed to grow table.\n");
return FALSE;
}
}
return TRUE;
}
{
unsigned int i;
for (i = 0; i < wndproc_table.count; ++i)
{
{
return;
}
}
}
/* At process attach */
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
return wined3d_dll_init(hInstDLL);
case DLL_PROCESS_DETACH:
return wined3d_dll_destroy(hInstDLL);
case DLL_THREAD_DETACH:
{
if (!context_set_current(NULL))
{
ERR("Failed to clear current context.\n");
}
return TRUE;
}
default:
return TRUE;
}
}