VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h@ 33836

Last change on this file since 33836 was 33836, checked in by vboxsync, 14 years ago

wddm/3d: add cube textures support

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.4 KB
Line 
1/** @file
2 *
3 * VBoxVideo Display D3D User mode dll
4 *
5 * Copyright (C) 2010 Oracle Corporation
6 *
7 * This file is part of VirtualBox Open Source Edition (OSE), as
8 * available from http://www.virtualbox.org. This file is free software;
9 * you can redistribute it and/or modify it under the terms of the GNU
10 * General Public License (GPL) as published by the Free Software
11 * Foundation, in version 2 as it comes in the "COPYING" file of the
12 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14 */
15#ifndef ___VBoxDispD3D_h___
16#define ___VBoxDispD3D_h___
17
18#include "VBoxDispD3DIf.h"
19#include "../../Miniport/wddm/VBoxVideoIf.h"
20#ifdef VBOX_WITH_CRHGSMI
21#include "VBoxUhgsmiDisp.h"
22#endif
23
24#include <iprt/cdefs.h>
25#include <iprt/list.h>
26
27#define VBOXWDDMDISP_MAX_VERTEX_STREAMS 16
28#define VBOXWDDMDISP_MAX_SWAPCHAIN_SIZE 16
29
30#ifdef VBOX_WITH_VIDEOHWACCEL
31typedef struct VBOXDISPVHWA_INFO
32{
33 VBOXVHWA_INFO Settings;
34}VBOXDISPVHWA_INFO;
35
36/* represents settings secific to
37 * display device (head) on the multiple-head graphics card
38 * currently used for 2D (overlay) only since in theory its settings
39 * can differ per each frontend's framebuffer. */
40typedef struct VBOXWDDMDISP_HEAD
41{
42 VBOXDISPVHWA_INFO Vhwa;
43} VBOXWDDMDISP_HEAD;
44#endif
45
46typedef struct VBOXWDDMDISP_ADAPTER
47{
48 HANDLE hAdapter;
49 UINT uIfVersion;
50 UINT uRtVersion;
51 VBOXDISPD3D D3D;
52 VBOXDISPWORKER WndWorker;
53 IDirect3D9Ex * pD3D9If;
54 D3DDDI_ADAPTERCALLBACKS RtCallbacks;
55 uint32_t cFormstOps;
56 FORMATOP *paFormstOps;
57 uint32_t cSurfDescs;
58 DDSURFACEDESC *paSurfDescs;
59 UINT cMaxSimRTs;
60#ifdef VBOX_WITH_VIDEOHWACCEL
61 uint32_t cHeads;
62 VBOXWDDMDISP_HEAD aHeads[1];
63#endif
64} VBOXWDDMDISP_ADAPTER, *PVBOXWDDMDISP_ADAPTER;
65
66typedef struct VBOXWDDMDISP_CONTEXT
67{
68 RTLISTNODE ListNode;
69 struct VBOXWDDMDISP_DEVICE *pDevice;
70 D3DDDICB_CREATECONTEXT ContextInfo;
71} VBOXWDDMDISP_CONTEXT, *PVBOXWDDMDISP_CONTEXT;
72
73typedef struct VBOXWDDMDISP_STREAMSOURCEUM
74{
75 CONST VOID* pvBuffer;
76 UINT cbStride;
77} VBOXWDDMDISP_STREAMSOURCEUM, *PVBOXWDDMDISP_STREAMSOURCEUM;
78
79typedef struct VBOXWDDMDISP_INDICIESUM
80{
81 CONST VOID* pvBuffer;
82 UINT cbSize;
83} VBOXWDDMDISP_INDICIESUM, *PVBOXWDDMDISP_INDICIESUM;
84
85struct VBOXWDDMDISP_ALLOCATION;
86
87typedef struct VBOXWDDMDISP_STREAM_SOURCE_INFO
88{
89 UINT uiOffset;
90 UINT uiStride;
91} VBOXWDDMDISP_STREAM_SOURCE_INFO;
92
93typedef struct VBOXWDDMDISP_INDICES_INFO
94{
95 UINT uiStride;
96} VBOXWDDMDISP_INDICES_INFO;
97
98typedef struct VBOXWDDMDISP_RENDERTGT_FLAGS
99{
100 union
101 {
102 struct
103 {
104 UINT bAdded : 1;
105 UINT bRemoved : 1;
106 UINT Reserved : 30;
107 };
108 uint32_t Value;
109 };
110}VBOXWDDMDISP_RENDERTGT_FLAGS;
111
112typedef struct VBOXWDDMDISP_RENDERTGT
113{
114 struct VBOXWDDMDISP_ALLOCATION *pAlloc;
115 UINT cNumFlips;
116 VBOXWDDMDISP_RENDERTGT_FLAGS fFlags;
117} VBOXWDDMDISP_RENDERTGT, *PVBOXWDDMDISP_RENDERTGT;
118
119#define VBOXWDDMDISP_INDEX_UNDEFINED (~0)
120typedef struct VBOXWDDMDISP_SWAPCHAIN_FLAGS
121{
122 union
123 {
124 struct
125 {
126 UINT bChanged : 1;
127 UINT Reserved : 31;
128 };
129 uint32_t Value;
130 };
131}VBOXWDDMDISP_SWAPCHAIN_FLAGS;
132
133typedef struct VBOXWDDMDISP_SWAPCHAIN
134{
135 RTLISTNODE ListEntry;
136 UINT iBB; /* Backbuffer index */
137 UINT cRTs; /* Number of render targets in the swapchain */
138 VBOXWDDMDISP_SWAPCHAIN_FLAGS fFlags;
139#ifndef VBOXWDDM_WITH_VISIBLE_FB
140 IDirect3DSurface9 *pRenderTargetFbCopy;
141 BOOL bRTFbCopyUpToDate;
142#endif
143 IDirect3DSwapChain9 *pSwapChainIf;
144 HWND hWnd;
145 VBOXDISP_KMHANDLE hSwapchainKm;
146 VBOXWDDMDISP_RENDERTGT aRTs[VBOXWDDMDISP_MAX_SWAPCHAIN_SIZE];
147} VBOXWDDMDISP_SWAPCHAIN, *PVBOXWDDMDISP_SWAPCHAIN;
148
149
150//typedef struct VBOXWDDMDISP_SCREEN
151//{
152// RTLISTNODE SwapchainList;
153// IDirect3DDevice9 *pDevice9If;
154//// struct VBOXWDDMDISP_RESOURCE *pDstSharedRc;
155// uint32_t iRenderTargetFrontBuf;
156// HWND hWnd;
157//} VBOXWDDMDISP_SCREEN, *PVBOXWDDMDISP_SCREEN;
158
159typedef struct VBOXWDDMDISP_DEVICE
160{
161 HANDLE hDevice;
162 PVBOXWDDMDISP_ADAPTER pAdapter;
163 IDirect3DDevice9 *pDevice9If;
164 RTLISTNODE SwapchainList;
165 UINT u32IfVersion;
166 UINT uRtVersion;
167 D3DDDI_DEVICECALLBACKS RtCallbacks;
168 VOID *pvCmdBuffer;
169 UINT cbCmdBuffer;
170 D3DDDI_CREATEDEVICEFLAGS fFlags;
171 /* number of StreamSources set */
172 UINT cStreamSources;
173 VBOXWDDMDISP_STREAMSOURCEUM aStreamSourceUm[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
174 struct VBOXWDDMDISP_ALLOCATION *aStreamSource[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
175 VBOXWDDMDISP_STREAM_SOURCE_INFO StreamSourceInfo[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
176 VBOXWDDMDISP_INDICIESUM IndiciesUm;
177 struct VBOXWDDMDISP_ALLOCATION *pIndicesAlloc;
178 VBOXWDDMDISP_INDICES_INFO IndiciesInfo;
179 /* need to cache the ViewPort data because IDirect3DDevice9::SetViewport
180 * is split into two calls : SetViewport & SetZRange */
181 D3DVIEWPORT9 ViewPort;
182 VBOXWDDMDISP_CONTEXT DefaultContext;
183#ifdef VBOX_WITH_CRHGSMI
184 VBOXUHGSMI_PRIVATE_D3D Uhgsmi;
185#endif
186
187 CRITICAL_SECTION DirtyAllocListLock;
188 RTLISTNODE DirtyAllocList;
189 UINT cRTs;
190 struct VBOXWDDMDISP_ALLOCATION * apRTs[1];
191} VBOXWDDMDISP_DEVICE, *PVBOXWDDMDISP_DEVICE;
192
193typedef struct VBOXWDDMDISP_LOCKINFO
194{
195 uint32_t cLocks;
196 union {
197 D3DDDIRANGE Range;
198 RECT Area;
199 D3DDDIBOX Box;
200 };
201 D3DDDI_LOCKFLAGS fFlags;
202 D3DLOCKED_RECT LockedRect;
203} VBOXWDDMDISP_LOCKINFO;
204
205typedef enum
206{
207 VBOXDISP_D3DIFTYPE_UNDEFINED = 0,
208 VBOXDISP_D3DIFTYPE_SURFACE,
209 VBOXDISP_D3DIFTYPE_TEXTURE,
210 VBOXDISP_D3DIFTYPE_CUBE_TEXTURE,
211 VBOXDISP_D3DIFTYPE_VERTEXBUFFER,
212 VBOXDISP_D3DIFTYPE_INDEXBUFFER
213} VBOXDISP_D3DIFTYPE;
214
215typedef struct VBOXWDDMDISP_ALLOCATION
216{
217 D3DKMT_HANDLE hAllocation;
218 VBOXWDDM_ALLOC_TYPE enmType;
219 UINT iAlloc;
220 struct VBOXWDDMDISP_RESOURCE *pRc;
221 void* pvMem;
222 UINT D3DWidth;
223 /* object type is defined by enmD3DIfType enum */
224 IUnknown *pD3DIf;
225 IUnknown *pSecondaryOpenedD3DIf;
226 VBOXDISP_D3DIFTYPE enmD3DIfType;
227 RTLISTNODE DirtyAllocListEntry;
228 HANDLE hSharedHandle;
229 VBOXWDDMDISP_LOCKINFO LockInfo;
230 VBOXWDDM_DIRTYREGION DirtyRegion; /* <- dirty region to notify host about */
231 VBOXWDDM_SURFACE_DESC SurfDesc;
232 PVBOXWDDMDISP_SWAPCHAIN pSwapchain;
233} VBOXWDDMDISP_ALLOCATION, *PVBOXWDDMDISP_ALLOCATION;
234
235typedef struct VBOXWDDMDISP_RESOURCE
236{
237 HANDLE hResource;
238 D3DKMT_HANDLE hKMResource;
239 PVBOXWDDMDISP_DEVICE pDevice;
240 uint32_t fFlags;
241 VBOXWDDM_RC_DESC RcDesc;
242 UINT cAllocations;
243 VBOXWDDMDISP_ALLOCATION aAllocations[1];
244} VBOXWDDMDISP_RESOURCE, *PVBOXWDDMDISP_RESOURCE;
245
246typedef struct VBOXWDDMDISP_QUERY
247{
248 D3DDDIQUERYTYPE enmType;
249 D3DDDI_ISSUEQUERYFLAGS fQueryState;
250 union
251 {
252 BOOL bData;
253 UINT u32Data;
254 } data ;
255} VBOXWDDMDISP_QUERY, *PVBOXWDDMDISP_QUERY;
256
257typedef struct VBOXWDDMDISP_TSS_LOOKUP
258{
259 BOOL bSamplerState;
260 DWORD dType;
261} VBOXWDDMDISP_TSS_LOOKUP;
262
263typedef struct VBOXWDDMDISP_OVERLAY
264{
265 D3DKMT_HANDLE hOverlay;
266 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
267 PVBOXWDDMDISP_RESOURCE *pResource;
268} VBOXWDDMDISP_OVERLAY, *PVBOXWDDMDISP_OVERLAY;
269
270#ifdef VBOX_WITH_CRHGSMI
271HRESULT vboxUhgsmiGlobalSetCurrent();
272HRESULT vboxUhgsmiGlobalClearCurrent();
273#endif
274
275#define VBOXDISPMODE_IS_3D(_p) (!!((_p)->pD3D9If))
276#ifdef VBOXDISP_EARLYCREATEDEVICE
277#define VBOXDISP_D3DEV(_p) (_p)->pDevice9If
278#else
279#define VBOXDISP_D3DEV(_p) vboxWddmD3DDeviceGet(_p)
280#endif
281
282#endif /* #ifndef ___VBoxDispD3D_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