VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp@ 42557

Last change on this file since 42557 was 42557, checked in by vboxsync, 12 years ago

wddm/3d: prevent sporadic metro apps exit on startup (speedup d3d init)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 33.6 KB
Line 
1/* $Id: VBoxDispD3DIf.cpp 42557 2012-08-02 20:31:05Z vboxsync $ */
2
3/** @file
4 * VBoxVideo Display D3D User mode dll
5 */
6
7/*
8 * Copyright (C) 2011 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 "VBoxDispD3DIf.h"
20#include "VBoxDispD3DCmn.h"
21
22#include <iprt/assert.h>
23
24void VBoxDispD3DClose(VBOXDISPD3D *pD3D)
25{
26 FreeLibrary(pD3D->hD3DLib);
27 pD3D->hD3DLib = NULL;
28}
29
30
31HRESULT VBoxDispD3DOpen(VBOXDISPD3D *pD3D)
32{
33#ifdef VBOX_WDDM_WOW64
34 pD3D->hD3DLib = LoadLibraryW(L"VBoxD3D9wddm-x86.dll");
35#else
36 pD3D->hD3DLib = LoadLibraryW(L"VBoxD3D9wddm.dll");
37#endif
38 if (!pD3D->hD3DLib)
39 {
40 DWORD winErr = GetLastError();
41 WARN((__FUNCTION__": LoadLibraryW failed, winErr = (%d)", winErr));
42 return E_FAIL;
43 }
44
45 do
46 {
47 pD3D->pfnDirect3DCreate9Ex = (PFNVBOXDISPD3DCREATE9EX)GetProcAddress(pD3D->hD3DLib, "Direct3DCreate9Ex");
48 if (!pD3D->pfnDirect3DCreate9Ex)
49 {
50 WARN(("no Direct3DCreate9Ex"));
51 break;
52 }
53
54 pD3D->pfnVBoxWineExD3DDev9CreateTexture = (PFNVBOXWINEEXD3DDEV9_CREATETEXTURE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9CreateTexture");
55 if (!pD3D->pfnVBoxWineExD3DDev9CreateTexture)
56 {
57 WARN(("no VBoxWineExD3DDev9CreateTexture"));
58 break;
59 }
60
61 pD3D->pfnVBoxWineExD3DDev9CreateCubeTexture = (PFNVBOXWINEEXD3DDEV9_CREATECUBETEXTURE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9CreateCubeTexture");
62 if (!pD3D->pfnVBoxWineExD3DDev9CreateCubeTexture)
63 {
64 WARN(("no VBoxWineExD3DDev9CreateCubeTexture"));
65 break;
66 }
67
68 pD3D->pfnVBoxWineExD3DDev9Flush = (PFNVBOXWINEEXD3DDEV9_FLUSH)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9Flush");
69 if (!pD3D->pfnVBoxWineExD3DDev9Flush)
70 {
71 WARN(("no VBoxWineExD3DDev9Flush"));
72 break;
73 }
74
75 pD3D->pfnVBoxWineExD3DDev9Update = (PFNVBOXWINEEXD3DDEV9_UPDATE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9Update");
76 if (!pD3D->pfnVBoxWineExD3DDev9Update)
77 {
78 WARN(("no VBoxWineExD3DDev9Update"));
79 break;
80 }
81
82 pD3D->pfnVBoxWineExD3DDev9Term = (PFNVBOXWINEEXD3DDEV9_TERM)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9Term");
83 if (!pD3D->pfnVBoxWineExD3DDev9Term)
84 {
85 WARN(("no VBoxWineExD3DDev9Term"));
86 break;
87 }
88
89 pD3D->pfnVBoxWineExD3DRc9SetShRcState = (PFNVBOXWINEEXD3DRC9_SETSHRCSTATE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DRc9SetShRcState");
90 if (!pD3D->pfnVBoxWineExD3DRc9SetShRcState)
91 {
92 WARN(("no VBoxWineExD3DRc9SetShRcState"));
93 break;
94 }
95
96 pD3D->pfnVBoxWineExD3DSwapchain9Present = (PFNVBOXWINEEXD3DSWAPCHAIN9_PRESENT)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DSwapchain9Present");
97 if (!pD3D->pfnVBoxWineExD3DSwapchain9Present)
98 {
99 WARN(("no VBoxWineExD3DSwapchain9Present"));
100 break;
101 }
102
103 return S_OK;
104
105 } while (0);
106
107 VBoxDispD3DClose(pD3D);
108
109 return E_FAIL;
110}
111
112
113
114static FORMATOP gVBoxFormatOps3D[] = {
115 {D3DDDIFMT_A8R8G8B8,
116 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
117 FORMATOP_SAME_FORMAT_RENDERTARGET|
118 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET|
119 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|
120 FORMATOP_MEMBEROFGROUP_ARGB|
121 FORMATOP_SRGBWRITE|FORMATOP_VERTEXTEXTURE, 0, 0, 0},
122
123 {D3DDDIFMT_X8R8G8B8,
124 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
125 FORMATOP_SAME_FORMAT_RENDERTARGET|
126 FORMATOP_DISPLAYMODE|FORMATOP_3DACCELERATION|
127 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|
128 FORMATOP_MEMBEROFGROUP_ARGB|
129 FORMATOP_SRGBWRITE|FORMATOP_VERTEXTEXTURE, 0, 0, 0},
130
131 {D3DDDIFMT_A2R10G10B10,
132 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
133 FORMATOP_SAME_FORMAT_RENDERTARGET|
134 0|
135 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|
136 FORMATOP_MEMBEROFGROUP_ARGB|
137 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
138
139 {D3DDDIFMT_X1R5G5B5,
140 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
141 FORMATOP_SAME_FORMAT_RENDERTARGET|
142 0|
143 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|
144 FORMATOP_MEMBEROFGROUP_ARGB|
145 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
146
147 {D3DDDIFMT_A1R5G5B5,
148 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
149 FORMATOP_SAME_FORMAT_RENDERTARGET|
150 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET|
151 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|
152 FORMATOP_MEMBEROFGROUP_ARGB|
153 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
154
155 {D3DDDIFMT_A4R4G4B4,
156 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
157 FORMATOP_SAME_FORMAT_RENDERTARGET|
158 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET|
159 FORMATOP_OFFSCREENPLAIN|
160 0|
161 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
162
163 {D3DDDIFMT_R5G6B5,
164 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
165 FORMATOP_SAME_FORMAT_RENDERTARGET|
166 FORMATOP_DISPLAYMODE|FORMATOP_3DACCELERATION|
167 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|
168 FORMATOP_MEMBEROFGROUP_ARGB|
169 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
170
171 {D3DDDIFMT_L16,
172 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|
173 0|
174 0|
175 FORMATOP_OFFSCREENPLAIN|
176 0|
177 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
178
179 {D3DDDIFMT_A8L8,
180 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|
181 0|
182 0|
183 FORMATOP_OFFSCREENPLAIN|
184 0|
185 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
186
187 {D3DDDIFMT_A8,
188 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|
189 0|
190 0|
191 FORMATOP_OFFSCREENPLAIN|
192 0|
193 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
194
195 {D3DDDIFMT_L8,
196 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|
197 0|
198 0|
199 FORMATOP_OFFSCREENPLAIN|
200 0|
201 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
202
203 {D3DDDIFMT_D16, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},
204 {D3DDDIFMT_D24S8, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},
205 {D3DDDIFMT_D24X8, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},
206 {D3DDDIFMT_D16_LOCKABLE, FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},
207 {D3DDDIFMT_X8D24, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},
208 {D3DDDIFMT_D32F_LOCKABLE, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},
209 {D3DDDIFMT_S8D24, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},
210
211 {D3DDDIFMT_DXT1,
212 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE|
213 0|
214 0|
215 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|
216 0|
217 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
218
219 {D3DDDIFMT_DXT2,
220 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE|
221 0|
222 0|
223 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|
224 0|
225 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
226
227 {D3DDDIFMT_DXT3,
228 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE|
229 0|
230 0|
231 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|
232 0|
233 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
234
235 {D3DDDIFMT_DXT4,
236 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE|
237 0|
238 0|
239 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|
240 0|
241 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
242
243 {D3DDDIFMT_DXT5,
244 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE|
245 0|
246 0|
247 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|
248 0|
249 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
250
251 {D3DDDIFMT_X8L8V8U8,
252 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|
253 0|
254 0|
255 0|
256 FORMATOP_BUMPMAP|
257 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
258
259 {D3DDDIFMT_A2W10V10U10,
260 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|
261 0|
262 0|
263 0|
264 FORMATOP_BUMPMAP|
265 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
266
267 {D3DDDIFMT_V8U8,
268 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|
269 0|
270 0|
271 0|
272 FORMATOP_BUMPMAP|
273 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
274
275 {D3DDDIFMT_Q8W8V8U8,
276 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
277 0|
278 0|
279 FORMATOP_OFFSCREENPLAIN|
280 FORMATOP_BUMPMAP|
281 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
282
283 {D3DDDIFMT_CxV8U8, FORMATOP_NOFILTER|FORMATOP_NOALPHABLEND|FORMATOP_NOTEXCOORDWRAPNORMIP, 0, 0, 0},
284
285 {D3DDDIFMT_R16F,
286 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
287 FORMATOP_SAME_FORMAT_RENDERTARGET|
288 0|
289 FORMATOP_OFFSCREENPLAIN|
290 0|
291 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
292
293 {D3DDDIFMT_R32F,
294 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
295 FORMATOP_SAME_FORMAT_RENDERTARGET|
296 0|
297 FORMATOP_OFFSCREENPLAIN|
298 0|
299 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
300
301 {D3DDDIFMT_G16R16F,
302 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
303 FORMATOP_SAME_FORMAT_RENDERTARGET|
304 0|
305 FORMATOP_OFFSCREENPLAIN|
306 0|
307 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
308
309 {D3DDDIFMT_G32R32F,
310 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
311 FORMATOP_SAME_FORMAT_RENDERTARGET|
312 0|
313 FORMATOP_OFFSCREENPLAIN|
314 0|
315 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
316
317 {D3DDDIFMT_A16B16G16R16F,
318 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
319 FORMATOP_SAME_FORMAT_RENDERTARGET|
320 0|
321 FORMATOP_OFFSCREENPLAIN|
322 0|
323 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
324
325 {D3DDDIFMT_A32B32G32R32F,
326 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
327 FORMATOP_SAME_FORMAT_RENDERTARGET|
328 0|
329 FORMATOP_OFFSCREENPLAIN|
330 0|
331 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
332
333 {D3DDDIFMT_G16R16,
334 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
335 FORMATOP_SAME_FORMAT_RENDERTARGET|
336 0|
337 FORMATOP_OFFSCREENPLAIN|
338 0|
339 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
340
341 {D3DDDIFMT_A16B16G16R16,
342 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
343 FORMATOP_SAME_FORMAT_RENDERTARGET|
344 0|
345 FORMATOP_OFFSCREENPLAIN|
346 0|
347 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
348
349 {D3DDDIFMT_V16U16,
350 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|
351 0|
352 0|
353 0|
354 FORMATOP_BUMPMAP|
355 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
356
357 {D3DDDIFMT_P8, FORMATOP_DISPLAYMODE|FORMATOP_3DACCELERATION|FORMATOP_OFFSCREENPLAIN, 0, 0, 0},
358
359 {D3DDDIFMT_UYVY,
360 0|
361 0|
362 0|
363 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|
364 FORMATOP_NOFILTER|
365 FORMATOP_NOALPHABLEND|
366 FORMATOP_NOTEXCOORDWRAPNORMIP, 0, 0, 0},
367
368 {D3DDDIFMT_YUY2,
369 0|
370 0|
371 0|
372 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|
373 FORMATOP_NOFILTER|
374 FORMATOP_NOALPHABLEND|
375 FORMATOP_NOTEXCOORDWRAPNORMIP, 0, 0, 0},
376
377 {D3DDDIFMT_Q16W16V16U16,
378 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
379 FORMATOP_SAME_FORMAT_RENDERTARGET|
380 0|
381 FORMATOP_OFFSCREENPLAIN|
382 FORMATOP_BUMPMAP|FORMATOP_DMAP|
383 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
384
385 {D3DDDIFMT_X8B8G8R8,
386 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
387 FORMATOP_SAME_FORMAT_RENDERTARGET|
388 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET|
389 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|
390 FORMATOP_DMAP|FORMATOP_MEMBEROFGROUP_ARGB|
391 FORMATOP_SRGBWRITE|FORMATOP_AUTOGENMIPMAP|FORMATOP_VERTEXTEXTURE|
392 FORMATOP_OVERLAY, 0, 0, 0},
393
394 {D3DDDIFMT_BINARYBUFFER, FORMATOP_OFFSCREENPLAIN, 0, 0, 0},
395
396 {D3DDDIFMT_A4L4,
397 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|
398 0|
399 0|
400 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|
401 FORMATOP_DMAP|
402 FORMATOP_VERTEXTEXTURE, 0, 0, 0},
403
404 {D3DDDIFMT_A2B10G10R10,
405 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|
406 FORMATOP_SAME_FORMAT_RENDERTARGET|
407 0|
408 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|
409 FORMATOP_DMAP|FORMATOP_MEMBEROFGROUP_ARGB|
410 FORMATOP_AUTOGENMIPMAP|FORMATOP_VERTEXTEXTURE, 0, 0, 0},
411};
412
413static FORMATOP gVBoxFormatOpsBase[] = {
414 {D3DDDIFMT_X8R8G8B8, FORMATOP_DISPLAYMODE, 0, 0, 0},
415
416 {D3DDDIFMT_R8G8B8, FORMATOP_DISPLAYMODE, 0, 0, 0},
417
418 {D3DDDIFMT_R5G6B5, FORMATOP_DISPLAYMODE, 0, 0, 0},
419
420 {D3DDDIFMT_P8, FORMATOP_DISPLAYMODE, 0, 0, 0},
421};
422
423static DDSURFACEDESC gVBoxSurfDescsBase[] = {
424 {
425 sizeof (DDSURFACEDESC), /* DWORD dwSize; */
426 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */
427 0, /* DWORD dwHeight; */
428 0, /* DWORD dwWidth; */
429 {
430 0, /* Union */
431 /* LONG lPitch; */
432 /* DWORD dwLinearSize; */
433 },
434 0, /* DWORD dwBackBufferCount; */
435 {
436 0, /* Union */
437 /* DWORD dwMipMapCount; */
438 /* DWORD dwZBufferBitDepth; */
439 /* DWORD dwRefreshRate; */
440 },
441 0, /* DWORD dwAlphaBitDepth; */
442 0, /* DWORD dwReserved; */
443 NULL, /* LPVOID lpSurface; */
444 {
445 0, /* DWORD dwColorSpaceLowValue; */
446 0, /* DWORD dwColorSpaceHighValue; */
447 }, /* DDCOLORKEY ddckCKDestOverlay; */
448 {
449 0, /* DWORD dwColorSpaceLowValue; */
450 0, /* DWORD dwColorSpaceHighValue; */
451 }, /* DDCOLORKEY ddckCKDestBlt; */
452 {
453 0, /* DWORD dwColorSpaceLowValue; */
454 0, /* DWORD dwColorSpaceHighValue; */
455 }, /* DDCOLORKEY ddckCKSrcOverlay; */
456 {
457 0, /* DWORD dwColorSpaceLowValue; */
458 0, /* DWORD dwColorSpaceHighValue; */
459 }, /* DDCOLORKEY ddckCKSrcBlt; */
460 {
461 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */
462 DDPF_RGB, /* DWORD dwFlags; */
463 0, /* DWORD dwFourCC; */
464 {
465 32, /* union */
466 /* DWORD dwRGBBitCount; */
467 /* DWORD dwYUVBitCount; */
468 /* DWORD dwZBufferBitDepth; */
469 /* DWORD dwAlphaBitDepth; */
470 /* DWORD dwLuminanceBitCount; */
471 /* DWORD dwBumpBitCount; */
472 },
473 {
474 0xff0000, /* union */
475 /* DWORD dwRBitMask; */
476 /* DWORD dwYBitMask; */
477 /* DWORD dwStencilBitDepth; */
478 /* DWORD dwLuminanceBitMask; */
479 /* DWORD dwBumpDuBitMask; */
480 },
481 {
482 0xff00,
483 /* DWORD dwGBitMask; */
484 /* DWORD dwUBitMask; */
485 /* DWORD dwZBitMask; */
486 /* DWORD dwBumpDvBitMask; */
487 },
488 {
489 0xff,
490 /* DWORD dwBBitMask; */
491 /* DWORD dwVBitMask; */
492 /* DWORD dwStencilBitMask; */
493 /* DWORD dwBumpLuminanceBitMask; */
494 },
495 {
496 0,
497 /* DWORD dwRGBAlphaBitMask; */
498 /* DWORD dwYUVAlphaBitMask; */
499 /* DWORD dwLuminanceAlphaBitMask; */
500 /* DWORD dwRGBZBitMask; */
501 /* DWORD dwYUVZBitMask; */
502 },
503 }, /* DDPIXELFORMAT ddpfPixelFormat; */
504 {
505 DDSCAPS_BACKBUFFER
506 | DDSCAPS_COMPLEX
507 | DDSCAPS_FLIP
508 | DDSCAPS_FRONTBUFFER
509 | DDSCAPS_LOCALVIDMEM
510 | DDSCAPS_PRIMARYSURFACE
511 | DDSCAPS_VIDEOMEMORY
512 | DDSCAPS_VISIBLE /* DWORD dwCaps; */
513 } /* DDSCAPS ddsCaps; */
514 },
515 {
516 sizeof (DDSURFACEDESC), /* DWORD dwSize; */
517 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */
518 0, /* DWORD dwHeight; */
519 0, /* DWORD dwWidth; */
520 {
521 0, /* Union */
522 /* LONG lPitch; */
523 /* DWORD dwLinearSize; */
524 },
525 0, /* DWORD dwBackBufferCount; */
526 {
527 0, /* Union */
528 /* DWORD dwMipMapCount; */
529 /* DWORD dwZBufferBitDepth; */
530 /* DWORD dwRefreshRate; */
531 },
532 0, /* DWORD dwAlphaBitDepth; */
533 0, /* DWORD dwReserved; */
534 NULL, /* LPVOID lpSurface; */
535 {
536 0, /* DWORD dwColorSpaceLowValue; */
537 0, /* DWORD dwColorSpaceHighValue; */
538 }, /* DDCOLORKEY ddckCKDestOverlay; */
539 {
540 0, /* DWORD dwColorSpaceLowValue; */
541 0, /* DWORD dwColorSpaceHighValue; */
542 }, /* DDCOLORKEY ddckCKDestBlt; */
543 {
544 0, /* DWORD dwColorSpaceLowValue; */
545 0, /* DWORD dwColorSpaceHighValue; */
546 }, /* DDCOLORKEY ddckCKSrcOverlay; */
547 {
548 0, /* DWORD dwColorSpaceLowValue; */
549 0, /* DWORD dwColorSpaceHighValue; */
550 }, /* DDCOLORKEY ddckCKSrcBlt; */
551 {
552 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */
553 DDPF_RGB, /* DWORD dwFlags; */
554 0, /* DWORD dwFourCC; */
555 {
556 24, /* union */
557 /* DWORD dwRGBBitCount; */
558 /* DWORD dwYUVBitCount; */
559 /* DWORD dwZBufferBitDepth; */
560 /* DWORD dwAlphaBitDepth; */
561 /* DWORD dwLuminanceBitCount; */
562 /* DWORD dwBumpBitCount; */
563 },
564 {
565 0xff0000, /* union */
566 /* DWORD dwRBitMask; */
567 /* DWORD dwYBitMask; */
568 /* DWORD dwStencilBitDepth; */
569 /* DWORD dwLuminanceBitMask; */
570 /* DWORD dwBumpDuBitMask; */
571 },
572 {
573 0xff00,
574 /* DWORD dwGBitMask; */
575 /* DWORD dwUBitMask; */
576 /* DWORD dwZBitMask; */
577 /* DWORD dwBumpDvBitMask; */
578 },
579 {
580 0xff,
581 /* DWORD dwBBitMask; */
582 /* DWORD dwVBitMask; */
583 /* DWORD dwStencilBitMask; */
584 /* DWORD dwBumpLuminanceBitMask; */
585 },
586 {
587 0,
588 /* DWORD dwRGBAlphaBitMask; */
589 /* DWORD dwYUVAlphaBitMask; */
590 /* DWORD dwLuminanceAlphaBitMask; */
591 /* DWORD dwRGBZBitMask; */
592 /* DWORD dwYUVZBitMask; */
593 },
594 }, /* DDPIXELFORMAT ddpfPixelFormat; */
595 {
596 DDSCAPS_BACKBUFFER
597 | DDSCAPS_COMPLEX
598 | DDSCAPS_FLIP
599 | DDSCAPS_FRONTBUFFER
600 | DDSCAPS_LOCALVIDMEM
601 | DDSCAPS_PRIMARYSURFACE
602 | DDSCAPS_VIDEOMEMORY
603 | DDSCAPS_VISIBLE /* DWORD dwCaps; */
604 } /* DDSCAPS ddsCaps; */
605 },
606 {
607 sizeof (DDSURFACEDESC), /* DWORD dwSize; */
608 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */
609 0, /* DWORD dwHeight; */
610 0, /* DWORD dwWidth; */
611 {
612 0, /* Union */
613 /* LONG lPitch; */
614 /* DWORD dwLinearSize; */
615 },
616 0, /* DWORD dwBackBufferCount; */
617 {
618 0, /* Union */
619 /* DWORD dwMipMapCount; */
620 /* DWORD dwZBufferBitDepth; */
621 /* DWORD dwRefreshRate; */
622 },
623 0, /* DWORD dwAlphaBitDepth; */
624 0, /* DWORD dwReserved; */
625 NULL, /* LPVOID lpSurface; */
626 {
627 0, /* DWORD dwColorSpaceLowValue; */
628 0, /* DWORD dwColorSpaceHighValue; */
629 }, /* DDCOLORKEY ddckCKDestOverlay; */
630 {
631 0, /* DWORD dwColorSpaceLowValue; */
632 0, /* DWORD dwColorSpaceHighValue; */
633 }, /* DDCOLORKEY ddckCKDestBlt; */
634 {
635 0, /* DWORD dwColorSpaceLowValue; */
636 0, /* DWORD dwColorSpaceHighValue; */
637 }, /* DDCOLORKEY ddckCKSrcOverlay; */
638 {
639 0, /* DWORD dwColorSpaceLowValue; */
640 0, /* DWORD dwColorSpaceHighValue; */
641 }, /* DDCOLORKEY ddckCKSrcBlt; */
642 {
643 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */
644 DDPF_RGB, /* DWORD dwFlags; */
645 0, /* DWORD dwFourCC; */
646 {
647 16, /* union */
648 /* DWORD dwRGBBitCount; */
649 /* DWORD dwYUVBitCount; */
650 /* DWORD dwZBufferBitDepth; */
651 /* DWORD dwAlphaBitDepth; */
652 /* DWORD dwLuminanceBitCount; */
653 /* DWORD dwBumpBitCount; */
654 },
655 {
656 0xf800, /* union */
657 /* DWORD dwRBitMask; */
658 /* DWORD dwYBitMask; */
659 /* DWORD dwStencilBitDepth; */
660 /* DWORD dwLuminanceBitMask; */
661 /* DWORD dwBumpDuBitMask; */
662 },
663 {
664 0x7e0,
665 /* DWORD dwGBitMask; */
666 /* DWORD dwUBitMask; */
667 /* DWORD dwZBitMask; */
668 /* DWORD dwBumpDvBitMask; */
669 },
670 {
671 0x1f,
672 /* DWORD dwBBitMask; */
673 /* DWORD dwVBitMask; */
674 /* DWORD dwStencilBitMask; */
675 /* DWORD dwBumpLuminanceBitMask; */
676 },
677 {
678 0,
679 /* DWORD dwRGBAlphaBitMask; */
680 /* DWORD dwYUVAlphaBitMask; */
681 /* DWORD dwLuminanceAlphaBitMask; */
682 /* DWORD dwRGBZBitMask; */
683 /* DWORD dwYUVZBitMask; */
684 },
685 }, /* DDPIXELFORMAT ddpfPixelFormat; */
686 {
687 DDSCAPS_BACKBUFFER
688 | DDSCAPS_COMPLEX
689 | DDSCAPS_FLIP
690 | DDSCAPS_FRONTBUFFER
691 | DDSCAPS_LOCALVIDMEM
692 | DDSCAPS_PRIMARYSURFACE
693 | DDSCAPS_VIDEOMEMORY
694 | DDSCAPS_VISIBLE /* DWORD dwCaps; */
695 } /* DDSCAPS ddsCaps; */
696 },
697};
698
699#ifdef VBOX_WITH_VIDEOHWACCEL
700
701static void vboxVhwaPopulateOverlayFourccSurfDesc(DDSURFACEDESC *pDesc, uint32_t fourcc)
702{
703 memset(pDesc, 0, sizeof (DDSURFACEDESC));
704
705 pDesc->dwSize = sizeof (DDSURFACEDESC);
706 pDesc->dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT;
707 pDesc->ddpfPixelFormat.dwSize = sizeof (DDPIXELFORMAT);
708 pDesc->ddpfPixelFormat.dwFlags = DDPF_FOURCC;
709 pDesc->ddpfPixelFormat.dwFourCC = fourcc;
710 pDesc->ddsCaps.dwCaps = DDSCAPS_BACKBUFFER
711 | DDSCAPS_COMPLEX
712 | DDSCAPS_FLIP
713 | DDSCAPS_FRONTBUFFER
714 | DDSCAPS_LOCALVIDMEM
715 | DDSCAPS_OVERLAY
716 | DDSCAPS_VIDEOMEMORY
717 | DDSCAPS_VISIBLE;
718}
719
720static bool vboxPixFormatMatch(DDPIXELFORMAT *pFormat1, DDPIXELFORMAT *pFormat2)
721{
722 return !memcmp(pFormat1, pFormat2, sizeof (DDPIXELFORMAT));
723}
724
725HRESULT vboxSurfDescMerge(DDSURFACEDESC *paDescs, uint32_t *pcDescs, uint32_t cMaxDescs, DDSURFACEDESC *pDesc)
726{
727 uint32_t cDescs = *pcDescs;
728
729 Assert(cMaxDescs >= cDescs);
730 Assert(pDesc->dwFlags == (DDSD_CAPS | DDSD_PIXELFORMAT));
731 if (pDesc->dwFlags != (DDSD_CAPS | DDSD_PIXELFORMAT))
732 return E_INVALIDARG;
733
734 for (uint32_t i = 0; i < cDescs; ++i)
735 {
736 DDSURFACEDESC *pCur = &paDescs[i];
737 if (vboxPixFormatMatch(&pCur->ddpfPixelFormat, &pDesc->ddpfPixelFormat))
738 {
739 if (pDesc->dwFlags & DDSD_CAPS)
740 {
741 pCur->dwFlags |= DDSD_CAPS;
742 pCur->ddsCaps.dwCaps |= pDesc->ddsCaps.dwCaps;
743 }
744 return S_OK;
745 }
746 }
747
748 if (cMaxDescs > cDescs)
749 {
750 paDescs[cDescs] = *pDesc;
751 ++cDescs;
752 *pcDescs = cDescs;
753 return VINF_SUCCESS;
754 }
755 return E_FAIL;
756}
757
758HRESULT vboxFormatOpsMerge(FORMATOP *paOps, uint32_t *pcOps, uint32_t cMaxOps, FORMATOP *pOp)
759{
760 uint32_t cOps = *pcOps;
761
762 Assert(cMaxOps >= cOps);
763
764 for (uint32_t i = 0; i < cOps; ++i)
765 {
766 FORMATOP *pCur = &paOps[i];
767 if (pCur->Format == pOp->Format)
768 {
769 pCur->Operations |= pOp->Operations;
770 Assert(pCur->FlipMsTypes == pOp->FlipMsTypes);
771 Assert(pCur->BltMsTypes == pOp->BltMsTypes);
772 Assert(pCur->PrivateFormatBitCount == pOp->PrivateFormatBitCount);
773 return S_OK;
774 }
775 }
776
777 if (cMaxOps > cOps)
778 {
779 paOps[cOps] = *pOp;
780 ++cOps;
781 *pcOps = cOps;
782 return VINF_SUCCESS;
783 }
784 return E_FAIL;
785}
786
787HRESULT VBoxDispD3DGlobal2DFormatsInit(PVBOXWDDMDISP_ADAPTER pAdapter)
788{
789 HRESULT hr = S_OK;
790 memset(&pAdapter->D3D, 0, sizeof (pAdapter->D3D));
791 memset(&pAdapter->Formats, 0, sizeof (pAdapter->Formats));
792
793 /* just calc the max number of formats */
794 uint32_t cFormats = RT_ELEMENTS(gVBoxFormatOpsBase);
795 uint32_t cSurfDescs = RT_ELEMENTS(gVBoxSurfDescsBase);
796 uint32_t cOverlayFormats = 0;
797 for (uint32_t i = 0; i < pAdapter->cHeads; ++i)
798 {
799 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa;
800 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED)
801 {
802 cOverlayFormats += pVhwa->Settings.cFormats;
803 }
804 }
805
806 cFormats += cOverlayFormats;
807 cSurfDescs += cOverlayFormats;
808
809 uint32_t cbFormatOps = cFormats * sizeof (FORMATOP);
810 cbFormatOps = (cbFormatOps + 7) & ~3;
811 /* ensure the surf descs are 8 byte aligned */
812 uint32_t offSurfDescs = (cbFormatOps + 7) & ~3;
813 uint32_t cbSurfDescs = cSurfDescs * sizeof (DDSURFACEDESC);
814 uint32_t cbBuf = offSurfDescs + cbSurfDescs;
815 uint8_t* pvBuf = (uint8_t*)RTMemAllocZ(cbBuf);
816 if (pvBuf)
817 {
818 pAdapter->Formats.paFormstOps = (FORMATOP*)pvBuf;
819 memcpy ((void*)pAdapter->Formats.paFormstOps , gVBoxFormatOpsBase, sizeof (gVBoxFormatOpsBase));
820 pAdapter->Formats.cFormstOps = RT_ELEMENTS(gVBoxFormatOpsBase);
821
822 FORMATOP fo = {D3DDDIFMT_UNKNOWN, 0, 0, 0, 0};
823 for (uint32_t i = 0; i < pAdapter->cHeads; ++i)
824 {
825 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa;
826 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED)
827 {
828 for (uint32_t j = 0; j < pVhwa->Settings.cFormats; ++j)
829 {
830 fo.Format = pVhwa->Settings.aFormats[j];
831 fo.Operations = FORMATOP_OVERLAY;
832 hr = vboxFormatOpsMerge((FORMATOP *)pAdapter->Formats.paFormstOps, &pAdapter->Formats.cFormstOps, cFormats, &fo);
833 if (FAILED(hr))
834 {
835 WARN(("vboxFormatOpsMerge failed, hr 0x%x", hr));
836 }
837 }
838 }
839 }
840
841 pAdapter->Formats.paSurfDescs = (DDSURFACEDESC*)(pvBuf + offSurfDescs);
842 memcpy ((void*)pAdapter->Formats.paSurfDescs , gVBoxSurfDescsBase, sizeof (gVBoxSurfDescsBase));
843 pAdapter->Formats.cSurfDescs = RT_ELEMENTS(gVBoxSurfDescsBase);
844
845 DDSURFACEDESC sd;
846 for (uint32_t i = 0; i < pAdapter->cHeads; ++i)
847 {
848 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa;
849 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED)
850 {
851 for (uint32_t j = 0; j < pVhwa->Settings.cFormats; ++j)
852 {
853 uint32_t fourcc = vboxWddmFormatToFourcc(pVhwa->Settings.aFormats[j]);
854 if (fourcc)
855 {
856 vboxVhwaPopulateOverlayFourccSurfDesc(&sd, fourcc);
857 hr = vboxSurfDescMerge((DDSURFACEDESC *)pAdapter->Formats.paSurfDescs, &pAdapter->Formats.cSurfDescs, cSurfDescs, &sd);
858 if (FAILED(hr))
859 {
860 WARN(("vboxFormatOpsMerge failed, hr 0x%x", hr));
861 }
862 }
863 }
864 }
865 }
866 }
867 else
868 {
869 WARN(("RTMemAllocZ failed"));
870 return E_FAIL;
871 }
872 return S_OK;
873}
874
875void VBoxDispD3DGlobal2DFormatsTerm(PVBOXWDDMDISP_ADAPTER pAdapter)
876{
877 if (pAdapter->Formats.paFormstOps)
878 RTMemFree((void *)pAdapter->Formats.paFormstOps);
879}
880
881#endif
882
883static CRITICAL_SECTION g_VBoxDispD3DGlobalCritSect;
884static VBOXWDDMDISP_D3D g_VBoxDispD3DGlobalD3D;
885static VBOXWDDMDISP_FORMATS g_VBoxDispD3DGlobalD3DFormats;
886static uint32_t g_cVBoxDispD3DGlobalOpens;
887
888void vboxDispD3DGlobalLock()
889{
890 EnterCriticalSection(&g_VBoxDispD3DGlobalCritSect);
891}
892
893void vboxDispD3DGlobalUnlock()
894{
895 LeaveCriticalSection(&g_VBoxDispD3DGlobalCritSect);
896}
897
898void VBoxDispD3DGlobalInit()
899{
900 g_cVBoxDispD3DGlobalOpens = 0;
901 InitializeCriticalSection(&g_VBoxDispD3DGlobalCritSect);
902}
903
904void VBoxDispD3DGlobalTerm()
905{
906 DeleteCriticalSection(&g_VBoxDispD3DGlobalCritSect);
907}
908
909static void vboxDispD3DGlobalD3DFormatsInit(PVBOXWDDMDISP_FORMATS pFormats)
910{
911 memset(pFormats, 0, sizeof (pFormats));
912 pFormats->paFormstOps = gVBoxFormatOps3D;
913 pFormats->cFormstOps = RT_ELEMENTS(gVBoxFormatOps3D);
914}
915
916static HRESULT vboxWddmGetD3D9Caps(PVBOXWDDMDISP_D3D pD3D, D3DCAPS9 *pCaps)
917{
918 HRESULT hr = pD3D->pD3D9If->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pCaps);
919 if (FAILED(hr))
920 {
921 WARN(("GetDeviceCaps failed hr(0x%x)",hr));
922 return hr;
923 }
924
925 vboxDispDumpD3DCAPS9(pCaps);
926
927 return S_OK;
928}
929
930static void vboxDispD3DGlobalDoClose(PVBOXWDDMDISP_D3D pD3D)
931{
932 pD3D->pD3D9If->Release();
933 VBoxDispD3DClose(&pD3D->D3D);
934}
935
936static HRESULT vboxDispD3DGlobalDoOpen(PVBOXWDDMDISP_D3D pD3D)
937{
938 memset(pD3D, 0, sizeof (*pD3D));
939 HRESULT hr = VBoxDispD3DOpen(&pD3D->D3D);
940 if (SUCCEEDED(hr))
941 {
942 hr = pD3D->D3D.pfnDirect3DCreate9Ex(D3D_SDK_VERSION, &pD3D->pD3D9If);
943 if (SUCCEEDED(hr))
944 {
945 hr = vboxWddmGetD3D9Caps(pD3D, &pD3D->Caps);
946 if (SUCCEEDED(hr))
947 {
948 pD3D->cMaxSimRTs = pD3D->Caps.NumSimultaneousRTs;
949 Assert(pD3D->cMaxSimRTs);
950 Assert(pD3D->cMaxSimRTs < UINT32_MAX/2);
951 LOG(("SUCCESS 3D Enabled, pD3D (0x%p)", pD3D));
952 return S_OK;
953 }
954 else
955 {
956 WARN(("vboxWddmGetD3D9Caps failed hr = 0x%x", hr));
957 }
958 pD3D->pD3D9If->Release();
959 }
960 else
961 {
962 WARN(("pfnDirect3DCreate9Ex failed hr = 0x%x", hr));
963 }
964 VBoxDispD3DClose(&pD3D->D3D);
965 }
966 else
967 {
968 WARN(("VBoxDispD3DOpen failed hr = 0x%x", hr));
969 }
970 return hr;
971}
972
973HRESULT VBoxDispD3DGlobalOpen(PVBOXWDDMDISP_D3D pD3D, PVBOXWDDMDISP_FORMATS pFormats)
974{
975 vboxDispD3DGlobalLock();
976 if (!g_cVBoxDispD3DGlobalOpens)
977 {
978 HRESULT hr = vboxDispD3DGlobalDoOpen(&g_VBoxDispD3DGlobalD3D);
979 if (!SUCCEEDED(hr))
980 {
981 WARN(("vboxDispD3DGlobalDoOpen failed hr = 0x%x", hr));
982 return hr;
983 }
984
985 vboxDispD3DGlobalD3DFormatsInit(&g_VBoxDispD3DGlobalD3DFormats);
986 }
987 ++g_cVBoxDispD3DGlobalOpens;
988 vboxDispD3DGlobalUnlock();
989
990 *pD3D = g_VBoxDispD3DGlobalD3D;
991 *pFormats = g_VBoxDispD3DGlobalD3DFormats;
992 return S_OK;
993}
994
995void VBoxDispD3DGlobalClose(PVBOXWDDMDISP_D3D pD3D, PVBOXWDDMDISP_FORMATS pFormats)
996{
997 vboxDispD3DGlobalLock();
998 --g_cVBoxDispD3DGlobalOpens;
999 if (!g_cVBoxDispD3DGlobalOpens)
1000 {
1001 vboxDispD3DGlobalDoClose(&g_VBoxDispD3DGlobalD3D);
1002 }
1003 vboxDispD3DGlobalUnlock();
1004}
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