msacm: Fix acmMetrics(ACM_METRIC_DRIVER_PRIORITY) return on error.
[wine/multimedia.git] / dlls / d3d8 / d3d8_main.c
blobdd537634b223202595963daad24eb618d71b5052
1 /* Direct3D 8
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "config.h"
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winreg.h"
26 #include "wingdi.h"
27 #include "winuser.h"
28 #include "wine/debug.h"
30 #include "d3d8.h"
31 #include "d3d8_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
35 int num_lock = 0;
36 void (*wine_tsx11_lock_ptr)(void) = NULL;
37 void (*wine_tsx11_unlock_ptr)(void) = NULL;
38 int vs_mode = VS_HW; /* Hardware by default */
39 int ps_mode = PS_NONE; /* Disabled by default */
41 HRESULT WINAPI D3D8GetSWInfo(void)
43 FIXME("(void): stub\n");
44 return 0;
47 void WINAPI DebugSetMute(void)
49 /* nothing to do */
52 IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
54 IDirect3D8Impl *object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
56 object->lpVtbl = &Direct3D8_Vtbl;
57 object->direct3d8 = object;
58 object->ref = 1;
59 object->WineD3D = WineDirect3DCreate(SDKVersion, 8, (IUnknown *)object);
61 TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D);
63 return (IDirect3D8 *)object;
66 /* At process attach */
67 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
69 TRACE("D3D8 DLLMain Reason=%ld\n", fdwReason);
70 if (fdwReason == DLL_PROCESS_ATTACH)
72 HMODULE mod;
73 char buffer[32];
74 DWORD size = sizeof(buffer);
75 HKEY hkey = 0;
77 DisableThreadLibraryCalls(hInstDLL);
79 mod = GetModuleHandleA( "winex11.drv" );
80 if (mod)
82 wine_tsx11_lock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_lock" );
83 wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_unlock" );
85 /* @@ Wine registry key: HKCU\Software\Wine\Direct3D */
86 if ( !RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Direct3D", &hkey) )
88 if ( !RegQueryValueExA( hkey, "VertexShaderMode", 0, NULL, (LPBYTE) buffer, &size) )
90 if (!strcmp(buffer,"none"))
92 TRACE("Disable vertex shaders\n");
93 vs_mode = VS_NONE;
95 else if (!strcmp(buffer,"emulation"))
97 TRACE("Force SW vertex shaders\n");
98 vs_mode = VS_SW;
101 if ( !RegQueryValueExA( hkey, "PixelShaderMode", 0, NULL, (LPBYTE) buffer, &size) )
103 if (!strcmp(buffer,"enabled"))
105 TRACE("Allow pixel shaders\n");
106 ps_mode = PS_HW;
110 if (vs_mode == VS_HW)
111 TRACE("Allow HW vertex shaders\n");
112 if (ps_mode == PS_NONE)
113 TRACE("Disable pixel shaders\n");
115 return TRUE;