VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/switcher/d3d9_main.c@ 35319

Last change on this file since 35319 was 35319, checked in by vboxsync, 14 years ago
  1. wddm: 64bit support 2. wddm: installation fixes (64bit support, unsigned driver warning) 3. propper fix for #5438 (compile with disabled CROGL)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1/* $Id: d3d9_main.c 35319 2010-12-24 15:42:36Z vboxsync $ */
2
3/** @file
4 * VBox D3D8 dll switcher
5 */
6
7/*
8 * Copyright (C) 2009 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#include "d3d9.h"
20#include "switcher.h"
21
22typedef void (WINAPI *DebugSetMuteProc)(void);
23typedef IDirect3D9* (WINAPI *Direct3DCreate9Proc)(UINT SDKVersion);
24typedef HRESULT (WINAPI *Direct3DCreate9ExProc)(UINT SDKVersion, IDirect3D9Ex **direct3d9ex);
25typedef void* (WINAPI *Direct3DShaderValidatorCreate9Proc)(void);
26typedef int (WINAPI *D3DPERF_BeginEventProc)(D3DCOLOR color, LPCWSTR name);
27typedef int (WINAPI *D3DPERF_EndEventProc)(void);
28typedef DWORD (WINAPI *D3DPERF_GetStatusProc)(void);
29typedef void (WINAPI *D3DPERF_SetOptionsProc)(DWORD options);
30typedef BOOL (WINAPI *D3DPERF_QueryRepeatFrameProc)(void);
31typedef void (WINAPI *D3DPERF_SetMarkerProc)(D3DCOLOR color, LPCWSTR name);
32typedef void (WINAPI *D3DPERF_SetRegionProc)(D3DCOLOR color, LPCWSTR name);
33
34typedef struct _D3D9ExTag
35{
36 int initialized;
37 const char *vboxName;
38 const char *msName;
39 DebugSetMuteProc pDebugSetMute;
40 Direct3DCreate9Proc pDirect3DCreate9;
41 Direct3DCreate9ExProc pDirect3DCreate9Ex;
42 Direct3DShaderValidatorCreate9Proc pDirect3DShaderValidatorCreate9;
43 D3DPERF_BeginEventProc pD3DPERF_BeginEvent;
44 D3DPERF_EndEventProc pD3DPERF_EndEvent;
45 D3DPERF_GetStatusProc pD3DPERF_GetStatus;
46 D3DPERF_SetOptionsProc pD3DPERF_SetOptions;
47 D3DPERF_QueryRepeatFrameProc pD3DPERF_QueryRepeatFrame;
48 D3DPERF_SetMarkerProc pD3DPERF_SetMarker;
49 D3DPERF_SetRegionProc pD3DPERF_SetRegion;
50} D3D9Export;
51
52#ifdef VBOX_WDDM_WOW64
53static D3D9Export g_swd3d9 = {0, "VBoxD3D9-x86.dll", "MSD3D9.dll",};
54#else
55static D3D9Export g_swd3d9 = {0, "VBoxD3D9.dll", "MSD3D9.dll",};
56#endif
57
58void FillD3DExports(HANDLE hDLL)
59{
60 SW_FILLPROC(g_swd3d9, hDLL, DebugSetMute);
61 SW_FILLPROC(g_swd3d9, hDLL, Direct3DCreate9);
62 SW_FILLPROC(g_swd3d9, hDLL, Direct3DCreate9Ex);
63 SW_FILLPROC(g_swd3d9, hDLL, Direct3DShaderValidatorCreate9);
64 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_BeginEvent);
65 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_EndEvent);
66 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_GetStatus);
67 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_SetOptions);
68 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_QueryRepeatFrame);
69 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_SetMarker);
70 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_SetRegion);
71}
72
73void WINAPI DebugSetMute(void)
74{
75 SW_CHECKCALL(g_swd3d9, DebugSetMute);
76 g_swd3d9.pDebugSetMute();
77}
78
79IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion)
80{
81 SW_CHECKRET(g_swd3d9, Direct3DCreate9, NULL);
82 return g_swd3d9.pDirect3DCreate9(SDKVersion);
83}
84
85HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex **direct3d9ex)
86{
87 SW_CHECKRET(g_swd3d9, Direct3DCreate9Ex, E_FAIL);
88 return g_swd3d9.pDirect3DCreate9Ex(SDKVersion, direct3d9ex);
89}
90
91void* WINAPI Direct3DShaderValidatorCreate9(void)
92{
93 SW_CHECKRET(g_swd3d9, Direct3DShaderValidatorCreate9, NULL);
94 return g_swd3d9.pDirect3DShaderValidatorCreate9();
95}
96
97int WINAPI D3DPERF_BeginEvent(D3DCOLOR color, LPCWSTR name)
98{
99 SW_CHECKRET(g_swd3d9, D3DPERF_BeginEvent, -1);
100 return g_swd3d9.pD3DPERF_BeginEvent(color, name);
101}
102
103int WINAPI D3DPERF_EndEvent(void)
104{
105 SW_CHECKRET(g_swd3d9, D3DPERF_EndEvent, -1);
106 return g_swd3d9.pD3DPERF_EndEvent();
107}
108
109DWORD WINAPI D3DPERF_GetStatus(void)
110{
111 SW_CHECKRET(g_swd3d9, D3DPERF_EndEvent, 0);
112 return g_swd3d9.pD3DPERF_GetStatus();
113}
114
115void WINAPI D3DPERF_SetOptions(DWORD options)
116{
117 SW_CHECKCALL(g_swd3d9, D3DPERF_SetOptions);
118 g_swd3d9.pD3DPERF_SetOptions(options);
119}
120
121BOOL WINAPI D3DPERF_QueryRepeatFrame(void)
122{
123 SW_CHECKRET(g_swd3d9, D3DPERF_QueryRepeatFrame, FALSE);
124 return g_swd3d9.pD3DPERF_QueryRepeatFrame();
125}
126
127void WINAPI D3DPERF_SetMarker(D3DCOLOR color, LPCWSTR name)
128{
129 SW_CHECKCALL(g_swd3d9, D3DPERF_SetMarker);
130 g_swd3d9.pD3DPERF_SetMarker(color, name);
131}
132
133void WINAPI D3DPERF_SetRegion(D3DCOLOR color, LPCWSTR name)
134{
135 SW_CHECKCALL(g_swd3d9, D3DPERF_SetRegion);
136 g_swd3d9.pD3DPERF_SetRegion(color, name);
137}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette