VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxsharedrc.h@ 41014

Last change on this file since 41014 was 40388, checked in by vboxsync, 13 years ago

wddm/3d: shared resource destroy handling fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/* $Id: vboxsharedrc.h 40388 2012-03-07 12:44:46Z vboxsync $ */
2/** @file
3 *
4 * VBox extension to Wine D3D - shared resource
5 *
6 * Copyright (C) 2010 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16#ifndef ___vboxsharedrc_h___
17#define ___vboxsharedrc_h___
18
19#define VBOXSHRC_F_SHARED 0x00000001 /* shared rc */
20#define VBOXSHRC_F_SHARED_OPENED 0x00000002 /* if set shared rc is opened, otherwise it is created */
21#define VBOXSHRC_F_GL_DISABLE 0x00000004 /* don't delete gl resources on d3d resource deletion */
22#define VBOXSHRC_F_GL_DELETE 0x00000008 /* don't delete gl resources on d3d resource deletion */
23
24#define VBOXSHRC_GET_SHAREFLAFS(_o) ((_o)->resource.sharerc_flags)
25#define VBOXSHRC_GET_SHAREHANDLE(_o) ((HANDLE)(_o)->resource.sharerc_handle)
26#define VBOXSHRC_SET_SHAREHANDLE(_o, _h) ((_o)->resource.sharerc_handle = (DWORD)(_h))
27#define VBOXSHRC_COPY_SHAREDATA(_oDst, _oSrc) do { \
28 VBOXSHRC_GET_SHAREFLAFS(_oDst) = VBOXSHRC_GET_SHAREFLAFS(_oSrc); \
29 VBOXSHRC_SET_SHAREHANDLE(_oDst, VBOXSHRC_GET_SHAREHANDLE(_oSrc)); \
30 } while (0)
31#define VBOXSHRC_SET_SHARED(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) |= VBOXSHRC_F_SHARED)
32#define VBOXSHRC_SET_SHARED_OPENED(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) |= VBOXSHRC_F_SHARED_OPENED)
33#define VBOXSHRC_SET_DISABLE(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) |= VBOXSHRC_F_GL_DISABLE)
34#define VBOXSHRC_SET_DELETE(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) = (VBOXSHRC_GET_SHAREFLAFS(_o) | VBOXSHRC_F_GL_DELETE) & (~VBOXSHRC_F_GL_DISABLE))
35
36#define VBOXSHRC_IS_SHARED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_SHARED))
37#define VBOXSHRC_IS_SHARED_OPENED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_SHARED_OPENED))
38#define VBOXSHRC_IS_SHARED_UNLOCKED(_o) (VBOXSHRC_IS_SHARED(_o) && !VBOXSHRC_IS_LOCKED(_o))
39#define VBOXSHRC_IS_DISABLED(_o) ( \
40 VBOXSHRC_IS_SHARED(_o) \
41 && (VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_GL_DISABLE) \
42 )
43#define VBOXSHRC_IS_DELETE(_o) ( \
44 VBOXSHRC_IS_SHARED(_o) \
45 && (VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_GL_DELETE) \
46 )
47
48#define VBOXSHRC_CAN_DELETE(_d, _o) (!VBOXSHRC_IS_DISABLED(_o))
49
50#define VBOXSHRC_LOCK(_o) do{ \
51 Assert(VBOXSHRC_IS_SHARED(_o)); \
52 ++(_o)->resource.sharerc_locks; \
53 } while (0)
54#define VBOXSHRC_UNLOCK(_o) do{ \
55 Assert(VBOXSHRC_IS_SHARED(_o)); \
56 --(_o)->resource.sharerc_locks; \
57 Assert((_o)->resource.sharerc_locks < UINT32_MAX/2); \
58 } while (0)
59#define VBOXSHRC_IS_LOCKED(_o) ( \
60 !!((_o)->resource.sharerc_locks) \
61 )
62
63#endif /* #ifndef ___vboxsharedrc_h___ */
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