VirtualBox

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

Last change on this file since 33876 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1/* $Id: d3d9_main.c 28800 2010-04-27 08:22:32Z 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
52static D3D9Export g_swd3d9 = {0, "VBoxD3D9.dll", "MSD3D9.dll",};
53
54void FillD3DExports(HANDLE hDLL)
55{
56 SW_FILLPROC(g_swd3d9, hDLL, DebugSetMute);
57 SW_FILLPROC(g_swd3d9, hDLL, Direct3DCreate9);
58 SW_FILLPROC(g_swd3d9, hDLL, Direct3DCreate9Ex);
59 SW_FILLPROC(g_swd3d9, hDLL, Direct3DShaderValidatorCreate9);
60 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_BeginEvent);
61 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_EndEvent);
62 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_GetStatus);
63 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_SetOptions);
64 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_QueryRepeatFrame);
65 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_SetMarker);
66 SW_FILLPROC(g_swd3d9, hDLL, D3DPERF_SetRegion);
67}
68
69void WINAPI DebugSetMute(void)
70{
71 SW_CHECKCALL(g_swd3d9, DebugSetMute);
72 g_swd3d9.pDebugSetMute();
73}
74
75IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion)
76{
77 SW_CHECKRET(g_swd3d9, Direct3DCreate9, NULL);
78 return g_swd3d9.pDirect3DCreate9(SDKVersion);
79}
80
81HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex **direct3d9ex)
82{
83 SW_CHECKRET(g_swd3d9, Direct3DCreate9Ex, E_FAIL);
84 return g_swd3d9.pDirect3DCreate9Ex(SDKVersion, direct3d9ex);
85}
86
87void* WINAPI Direct3DShaderValidatorCreate9(void)
88{
89 SW_CHECKRET(g_swd3d9, Direct3DShaderValidatorCreate9, NULL);
90 return g_swd3d9.pDirect3DShaderValidatorCreate9();
91}
92
93int WINAPI D3DPERF_BeginEvent(D3DCOLOR color, LPCWSTR name)
94{
95 SW_CHECKRET(g_swd3d9, D3DPERF_BeginEvent, -1);
96 return g_swd3d9.pD3DPERF_BeginEvent(color, name);
97}
98
99int WINAPI D3DPERF_EndEvent(void)
100{
101 SW_CHECKRET(g_swd3d9, D3DPERF_EndEvent, -1);
102 return g_swd3d9.pD3DPERF_EndEvent();
103}
104
105DWORD WINAPI D3DPERF_GetStatus(void)
106{
107 SW_CHECKRET(g_swd3d9, D3DPERF_EndEvent, 0);
108 return g_swd3d9.pD3DPERF_GetStatus();
109}
110
111void WINAPI D3DPERF_SetOptions(DWORD options)
112{
113 SW_CHECKCALL(g_swd3d9, D3DPERF_SetOptions);
114 g_swd3d9.pD3DPERF_SetOptions(options);
115}
116
117BOOL WINAPI D3DPERF_QueryRepeatFrame(void)
118{
119 SW_CHECKRET(g_swd3d9, D3DPERF_QueryRepeatFrame, FALSE);
120 return g_swd3d9.pD3DPERF_QueryRepeatFrame();
121}
122
123void WINAPI D3DPERF_SetMarker(D3DCOLOR color, LPCWSTR name)
124{
125 SW_CHECKCALL(g_swd3d9, D3DPERF_SetMarker);
126 g_swd3d9.pD3DPERF_SetMarker(color, name);
127}
128
129void WINAPI D3DPERF_SetRegion(D3DCOLOR color, LPCWSTR name)
130{
131 SW_CHECKCALL(g_swd3d9, D3DPERF_SetRegion);
132 g_swd3d9.pD3DPERF_SetRegion(color, name);
133}
Note: See TracBrowser for help on using the repository browser.

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