xref: /aosp_15_r20/external/mesa3d/src/gallium/frontends/nine/device9ex.c (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2011 Joakim Sindholt <[email protected]>
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #include "device9.h"
7 #include "device9ex.h"
8 #include "nine_pipe.h"
9 #include "swapchain9ex.h"
10 
11 #include "nine_helpers.h"
12 
13 #include "util/macros.h"
14 
15 #define DBG_CHANNEL DBG_DEVICE
16 
17 static HRESULT
NineDevice9Ex_ctor(struct NineDevice9Ex * This,struct NineUnknownParams * pParams,struct pipe_screen * pScreen,D3DDEVICE_CREATION_PARAMETERS * pCreationParameters,D3DCAPS9 * pCaps,D3DPRESENT_PARAMETERS * pPresentationParameters,D3DDISPLAYMODEEX * pFullscreenDisplayMode,IDirect3D9Ex * pD3D9Ex,ID3DPresentGroup * pPresentationGroup,struct d3dadapter9_context * pCTX,int minorVersionNum)18 NineDevice9Ex_ctor( struct NineDevice9Ex *This,
19                     struct NineUnknownParams *pParams,
20                     struct pipe_screen *pScreen,
21                     D3DDEVICE_CREATION_PARAMETERS *pCreationParameters,
22                     D3DCAPS9 *pCaps,
23                     D3DPRESENT_PARAMETERS *pPresentationParameters,
24                     D3DDISPLAYMODEEX *pFullscreenDisplayMode,
25                     IDirect3D9Ex *pD3D9Ex,
26                     ID3DPresentGroup *pPresentationGroup,
27                     struct d3dadapter9_context *pCTX,
28                     int minorVersionNum )
29 {
30     DBG("This=%p pParams=%p pScreen=%p pCreationParameters=%p pCaps=%p "
31         "pPresentationParameters=%p pFullscreenDisplayMode=%p "
32         "pD3D9Ex=%p pPresentationGroup=%p pCTX=%p\n",
33         This, pParams, pScreen, pCreationParameters, pCaps,
34         pPresentationParameters, pFullscreenDisplayMode,
35         pD3D9Ex, pPresentationGroup, pCTX);
36 
37     return NineDevice9_ctor(&This->base, pParams,
38                             pScreen, pCreationParameters, pCaps,
39                             pPresentationParameters,
40                             (IDirect3D9 *)pD3D9Ex, pPresentationGroup, pCTX,
41                             true, pFullscreenDisplayMode, minorVersionNum);
42 }
43 
44 static void
NineDevice9Ex_dtor(struct NineDevice9Ex * This)45 NineDevice9Ex_dtor( struct NineDevice9Ex *This )
46 {
47     NineDevice9_dtor(&This->base);
48 }
49 
50 HRESULT NINE_WINAPI
NineDevice9Ex_SetConvolutionMonoKernel(UNUSED struct NineDevice9Ex * This,UNUSED UINT width,UNUSED UINT height,UNUSED float * rows,UNUSED float * columns)51 NineDevice9Ex_SetConvolutionMonoKernel( UNUSED struct NineDevice9Ex *This,
52                                         UNUSED UINT width,
53                                         UNUSED UINT height,
54                                         UNUSED float *rows,
55                                         UNUSED float *columns )
56 {
57     DBG("This\n");
58     STUB(D3D_OK);
59 }
60 
61 HRESULT NINE_WINAPI
NineDevice9Ex_ComposeRects(UNUSED struct NineDevice9Ex * This,UNUSED IDirect3DSurface9 * pSrc,UNUSED IDirect3DSurface9 * pDst,UNUSED IDirect3DVertexBuffer9 * pSrcRectDescs,UNUSED UINT NumRects,UNUSED IDirect3DVertexBuffer9 * pDstRectDescs,UNUSED D3DCOMPOSERECTSOP Operation,UNUSED int Xoffset,UNUSED int Yoffset)62 NineDevice9Ex_ComposeRects( UNUSED struct NineDevice9Ex *This,
63                             UNUSED IDirect3DSurface9 *pSrc,
64                             UNUSED IDirect3DSurface9 *pDst,
65                             UNUSED IDirect3DVertexBuffer9 *pSrcRectDescs,
66                             UNUSED UINT NumRects,
67                             UNUSED IDirect3DVertexBuffer9 *pDstRectDescs,
68                             UNUSED D3DCOMPOSERECTSOP Operation,
69                             UNUSED int Xoffset,
70                             UNUSED int Yoffset )
71 {
72     DBG("This\n");
73     STUB(D3D_OK);
74 }
75 
76 HRESULT NINE_WINAPI
NineDevice9Ex_PresentEx(struct NineDevice9Ex * This,const RECT * pSourceRect,const RECT * pDestRect,HWND hDestWindowOverride,const RGNDATA * pDirtyRegion,DWORD dwFlags)77 NineDevice9Ex_PresentEx( struct NineDevice9Ex *This,
78                          const RECT *pSourceRect,
79                          const RECT *pDestRect,
80                          HWND hDestWindowOverride,
81                          const RGNDATA *pDirtyRegion,
82                          DWORD dwFlags )
83 {
84     unsigned i;
85     HRESULT hr;
86 
87     DBG("This=%p pSourceRect=%p pDestRect=%p hDestWindowOverride=%p "
88         "pDirtyRegion=%p dwFlags=%d\n",
89         This, pSourceRect, pDestRect, hDestWindowOverride,
90         pDirtyRegion, dwFlags);
91 
92     for (i = 0; i < This->base.nswapchains; i++) {
93         hr = NineSwapChain9_Present(This->base.swapchains[i], pSourceRect, pDestRect,
94                                     hDestWindowOverride, pDirtyRegion, dwFlags);
95         if (FAILED(hr)) { return hr; }
96     }
97 
98     return D3D_OK;
99 }
100 
101 HRESULT NINE_WINAPI
NineDevice9Ex_GetGPUThreadPriority(struct NineDevice9Ex * This,INT * pPriority)102 NineDevice9Ex_GetGPUThreadPriority( struct NineDevice9Ex *This,
103                                     INT *pPriority )
104 {
105     DBG("This\n");
106     user_assert(pPriority != NULL, D3DERR_INVALIDCALL);
107     *pPriority = This->base.gpu_priority;
108     return D3D_OK;
109 }
110 
111 HRESULT NINE_WINAPI
NineDevice9Ex_SetGPUThreadPriority(struct NineDevice9Ex * This,INT Priority)112 NineDevice9Ex_SetGPUThreadPriority( struct NineDevice9Ex *This,
113                                     INT Priority )
114 {
115     DBG("This\n");
116     user_assert(Priority >= -7 && Priority <= 7, D3DERR_INVALIDCALL);
117     This->base.gpu_priority = Priority;
118     return D3D_OK;
119 }
120 
121 HRESULT NINE_WINAPI
NineDevice9Ex_WaitForVBlank(UNUSED struct NineDevice9Ex * This,UNUSED UINT iSwapChain)122 NineDevice9Ex_WaitForVBlank( UNUSED struct NineDevice9Ex *This,
123                              UNUSED UINT iSwapChain )
124 {
125     DBG("This\n");
126     STUB(D3D_OK);
127 }
128 
129 HRESULT NINE_WINAPI
NineDevice9Ex_CheckResourceResidency(UNUSED struct NineDevice9Ex * This,UNUSED IDirect3DResource9 ** pResourceArray,UNUSED UINT32 NumResources)130 NineDevice9Ex_CheckResourceResidency( UNUSED struct NineDevice9Ex *This,
131                                       UNUSED IDirect3DResource9 **pResourceArray,
132                                       UNUSED UINT32 NumResources )
133 {
134     DBG("This\n");
135     STUB(D3D_OK);
136 }
137 
138 HRESULT NINE_WINAPI
NineDevice9Ex_SetMaximumFrameLatency(struct NineDevice9Ex * This,UINT MaxLatency)139 NineDevice9Ex_SetMaximumFrameLatency( struct NineDevice9Ex *This,
140                                       UINT MaxLatency )
141 {
142     DBG("This\n");
143     This->base.max_frame_latency = MaxLatency;
144     return D3D_OK;
145 }
146 
147 HRESULT NINE_WINAPI
NineDevice9Ex_GetMaximumFrameLatency(struct NineDevice9Ex * This,UINT * pMaxLatency)148 NineDevice9Ex_GetMaximumFrameLatency( struct NineDevice9Ex *This,
149                                       UINT *pMaxLatency )
150 {
151     DBG("This\n");
152     user_assert(pMaxLatency != NULL, D3DERR_INVALIDCALL);
153     *pMaxLatency = This->base.max_frame_latency;
154     return D3D_OK;
155 }
156 
157 HRESULT NINE_WINAPI
NineDevice9Ex_CheckDeviceState(struct NineDevice9Ex * This,HWND hDestinationWindow)158 NineDevice9Ex_CheckDeviceState( struct NineDevice9Ex *This,
159                                 HWND hDestinationWindow )
160 {
161     DBG("This=%p hDestinationWindow=%p\n",
162         This, hDestinationWindow);
163 
164     user_assert(!This->base.swapchains[0]->params.Windowed, D3D_OK);
165 
166     if (This->base.params.hFocusWindow == hDestinationWindow) {
167         if (NineSwapChain9_GetOccluded(This->base.swapchains[0]))
168             return S_PRESENT_OCCLUDED;
169     } else if(!NineSwapChain9_GetOccluded(This->base.swapchains[0])) {
170         return S_PRESENT_OCCLUDED;
171     }
172     /* TODO: handle the other return values */
173     return D3D_OK;
174 }
175 
176 HRESULT NINE_WINAPI
NineDevice9Ex_CreateRenderTargetEx(struct NineDevice9Ex * This,UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9 ** ppSurface,HANDLE * pSharedHandle,UNUSED DWORD Usage)177 NineDevice9Ex_CreateRenderTargetEx( struct NineDevice9Ex *This,
178                                     UINT Width,
179                                     UINT Height,
180                                     D3DFORMAT Format,
181                                     D3DMULTISAMPLE_TYPE MultiSample,
182                                     DWORD MultisampleQuality,
183                                     BOOL Lockable,
184                                     IDirect3DSurface9 **ppSurface,
185                                     HANDLE *pSharedHandle,
186                                     UNUSED DWORD Usage )
187 {
188     DBG("This\n");
189     /* The Create*Ex functions only purpose seem to introduce the
190      * Usage field, to pass the new d3d9ex flags on secure/restricted
191      * content.
192      * TODO: Return error on invalid Usage.
193      * TODO: Store Usage in the surface descriptor, in case the
194      * app checks */
195     return NineDevice9_CreateRenderTarget(&This->base,
196                                           Width,
197                                           Height,
198                                           Format,
199                                           MultiSample,
200                                           MultisampleQuality,
201                                           Lockable,
202                                           ppSurface,
203                                           pSharedHandle);
204 }
205 
206 HRESULT NINE_WINAPI
NineDevice9Ex_CreateOffscreenPlainSurfaceEx(struct NineDevice9Ex * This,UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9 ** ppSurface,HANDLE * pSharedHandle,UNUSED DWORD Usage)207 NineDevice9Ex_CreateOffscreenPlainSurfaceEx( struct NineDevice9Ex *This,
208                                              UINT Width,
209                                              UINT Height,
210                                              D3DFORMAT Format,
211                                              D3DPOOL Pool,
212                                              IDirect3DSurface9 **ppSurface,
213                                              HANDLE *pSharedHandle,
214                                              UNUSED DWORD Usage )
215 {
216     DBG("This\n");
217     /* The Create*Ex functions only purpose seem to introduce the
218      * Usage field, to pass the new d3d9ex flags on secure/restricted
219      * content.
220      * TODO: Return error on invalid Usage.
221      * TODO: Store Usage in the surface descriptor, in case the
222      * app checks */
223     return NineDevice9_CreateOffscreenPlainSurface(&This->base,
224                                                    Width,
225                                                    Height,
226                                                    Format,
227                                                    Pool,
228                                                    ppSurface,
229                                                    pSharedHandle);
230 }
231 
232 HRESULT NINE_WINAPI
NineDevice9Ex_CreateDepthStencilSurfaceEx(struct NineDevice9Ex * This,UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9 ** ppSurface,HANDLE * pSharedHandle,UNUSED DWORD Usage)233 NineDevice9Ex_CreateDepthStencilSurfaceEx( struct NineDevice9Ex *This,
234                                            UINT Width,
235                                            UINT Height,
236                                            D3DFORMAT Format,
237                                            D3DMULTISAMPLE_TYPE MultiSample,
238                                            DWORD MultisampleQuality,
239                                            BOOL Discard,
240                                            IDirect3DSurface9 **ppSurface,
241                                            HANDLE *pSharedHandle,
242                                            UNUSED DWORD Usage )
243 {
244     DBG("This\n");
245     /* The Create*Ex functions only purpose seem to introduce the
246      * Usage field, to pass the new d3d9ex flags on secure/restricted
247      * content.
248      * TODO: Return error on invalid Usage.
249      * TODO: Store Usage in the surface descriptor, in case the
250      * app checks */
251     return NineDevice9_CreateDepthStencilSurface(&This->base,
252                                                  Width,
253                                                  Height,
254                                                  Format,
255                                                  MultiSample,
256                                                  MultisampleQuality,
257                                                  Discard,
258                                                  ppSurface,
259                                                  pSharedHandle);
260 }
261 
262 HRESULT NINE_WINAPI
NineDevice9Ex_ResetEx(struct NineDevice9Ex * This,D3DPRESENT_PARAMETERS * pPresentationParameters,D3DDISPLAYMODEEX * pFullscreenDisplayMode)263 NineDevice9Ex_ResetEx( struct NineDevice9Ex *This,
264                        D3DPRESENT_PARAMETERS *pPresentationParameters,
265                        D3DDISPLAYMODEEX *pFullscreenDisplayMode )
266 {
267     HRESULT hr = D3D_OK;
268     float MinZ, MaxZ;
269     unsigned i;
270 
271     DBG("This=%p pPresentationParameters=%p pFullscreenDisplayMode=%p\n", This, pPresentationParameters, pFullscreenDisplayMode);
272 
273     for (i = 0; i < This->base.nswapchains; ++i) {
274         D3DDISPLAYMODEEX *mode = NULL;
275         D3DPRESENT_PARAMETERS *params = &pPresentationParameters[i];
276         if (pFullscreenDisplayMode) mode = &(pFullscreenDisplayMode[i]);
277         hr = NineSwapChain9_Resize(This->base.swapchains[i], params, mode);
278         if (FAILED(hr))
279             break;
280     }
281 
282     MinZ = This->base.state.viewport.MinZ; /* These are preserved */
283     MaxZ = This->base.state.viewport.MaxZ;
284     NineDevice9_SetRenderTarget(
285         (struct NineDevice9 *)This, 0, (IDirect3DSurface9 *)This->base.swapchains[0]->buffers[0]);
286     This->base.state.viewport.MinZ = MinZ;
287     This->base.state.viewport.MaxZ = MaxZ;
288     nine_context_set_viewport(&This->base, &This->base.state.viewport);
289 
290     if (This->base.nswapchains && This->base.swapchains[0]->params.EnableAutoDepthStencil)
291         NineDevice9_SetDepthStencilSurface(
292             &This->base, (IDirect3DSurface9 *)This->base.swapchains[0]->zsbuf);
293 
294     return hr;
295 }
296 
297 HRESULT NINE_WINAPI
NineDevice9Ex_Reset(struct NineDevice9Ex * This,D3DPRESENT_PARAMETERS * pPresentationParameters)298 NineDevice9Ex_Reset( struct NineDevice9Ex *This,
299                      D3DPRESENT_PARAMETERS *pPresentationParameters )
300 {
301     HRESULT hr = D3D_OK;
302     float MinZ, MaxZ;
303     unsigned i;
304 
305     DBG("This=%p pPresentationParameters=%p\n", This, pPresentationParameters);
306 
307     for (i = 0; i < This->base.nswapchains; ++i) {
308         D3DPRESENT_PARAMETERS *params = &pPresentationParameters[i];
309         hr = NineSwapChain9_Resize(This->base.swapchains[i], params, NULL);
310         if (FAILED(hr))
311             break;
312     }
313 
314     MinZ = This->base.state.viewport.MinZ; /* These are preserved */
315     MaxZ = This->base.state.viewport.MaxZ;
316     NineDevice9_SetRenderTarget(
317         (struct NineDevice9 *)This, 0, (IDirect3DSurface9 *)This->base.swapchains[0]->buffers[0]);
318     This->base.state.viewport.MinZ = MinZ;
319     This->base.state.viewport.MaxZ = MaxZ;
320     nine_context_set_viewport(&This->base, &This->base.state.viewport);
321 
322     if (This->base.nswapchains && This->base.swapchains[0]->params.EnableAutoDepthStencil)
323         NineDevice9_SetDepthStencilSurface(
324             &This->base, (IDirect3DSurface9 *)This->base.swapchains[0]->zsbuf);
325 
326     return hr;
327 }
328 
329 HRESULT NINE_WINAPI
NineDevice9Ex_GetDisplayModeEx(struct NineDevice9Ex * This,UINT iSwapChain,D3DDISPLAYMODEEX * pMode,D3DDISPLAYROTATION * pRotation)330 NineDevice9Ex_GetDisplayModeEx( struct NineDevice9Ex *This,
331                                 UINT iSwapChain,
332                                 D3DDISPLAYMODEEX *pMode,
333                                 D3DDISPLAYROTATION *pRotation )
334 {
335     struct NineSwapChain9Ex *swapchain;
336 
337     DBG("This=%p iSwapChain=%u pMode=%p pRotation=%p\n",
338         This, iSwapChain, pMode, pRotation);
339 
340     user_assert(iSwapChain < This->base.nswapchains, D3DERR_INVALIDCALL);
341 
342     swapchain = NineSwapChain9Ex(This->base.swapchains[iSwapChain]);
343     return NineSwapChain9Ex_GetDisplayModeEx(swapchain, pMode, pRotation);
344 }
345 
346 HRESULT NINE_WINAPI
NineDevice9Ex_TestCooperativeLevel(UNUSED struct NineDevice9Ex * This)347 NineDevice9Ex_TestCooperativeLevel( UNUSED struct NineDevice9Ex *This )
348 {
349     DBG("This\n");
350     return D3D_OK;
351 }
352 
353 
354 IDirect3DDevice9ExVtbl NineDevice9Ex_vtable = {
355     (void *)NineUnknown_QueryInterface,
356     (void *)NineUnknown_AddRef,
357     (void *)NineUnknown_Release,
358     (void *)NineDevice9Ex_TestCooperativeLevel,
359     (void *)NineDevice9_GetAvailableTextureMem,
360     (void *)NineDevice9_EvictManagedResources,
361     (void *)NineDevice9_GetDirect3D,
362     (void *)NineDevice9_GetDeviceCaps,
363     (void *)NineDevice9_GetDisplayMode,
364     (void *)NineDevice9_GetCreationParameters,
365     (void *)NineDevice9_SetCursorProperties,
366     (void *)NineDevice9_SetCursorPosition,
367     (void *)NineDevice9_ShowCursor,
368     (void *)NineDevice9_CreateAdditionalSwapChain,
369     (void *)NineDevice9_GetSwapChain,
370     (void *)NineDevice9_GetNumberOfSwapChains,
371     (void *)NineDevice9Ex_Reset,
372     (void *)NineDevice9_Present,
373     (void *)NineDevice9_GetBackBuffer,
374     (void *)NineDevice9_GetRasterStatus,
375     (void *)NineDevice9_SetDialogBoxMode,
376     (void *)NineDevice9_SetGammaRamp,
377     (void *)NineDevice9_GetGammaRamp,
378     (void *)NineDevice9_CreateTexture,
379     (void *)NineDevice9_CreateVolumeTexture,
380     (void *)NineDevice9_CreateCubeTexture,
381     (void *)NineDevice9_CreateVertexBuffer,
382     (void *)NineDevice9_CreateIndexBuffer,
383     (void *)NineDevice9_CreateRenderTarget,
384     (void *)NineDevice9_CreateDepthStencilSurface,
385     (void *)NineDevice9_UpdateSurface,
386     (void *)NineDevice9_UpdateTexture,
387     (void *)NineDevice9_GetRenderTargetData,
388     (void *)NineDevice9_GetFrontBufferData,
389     (void *)NineDevice9_StretchRect,
390     (void *)NineDevice9_ColorFill,
391     (void *)NineDevice9_CreateOffscreenPlainSurface,
392     (void *)NineDevice9_SetRenderTarget,
393     (void *)NineDevice9_GetRenderTarget,
394     (void *)NineDevice9_SetDepthStencilSurface,
395     (void *)NineDevice9_GetDepthStencilSurface,
396     (void *)NineDevice9_BeginScene,
397     (void *)NineDevice9_EndScene,
398     (void *)NineDevice9_Clear,
399     (void *)NineDevice9_SetTransform,
400     (void *)NineDevice9_GetTransform,
401     (void *)NineDevice9_MultiplyTransform,
402     (void *)NineDevice9_SetViewport,
403     (void *)NineDevice9_GetViewport,
404     (void *)NineDevice9_SetMaterial,
405     (void *)NineDevice9_GetMaterial,
406     (void *)NineDevice9_SetLight,
407     (void *)NineDevice9_GetLight,
408     (void *)NineDevice9_LightEnable,
409     (void *)NineDevice9_GetLightEnable,
410     (void *)NineDevice9_SetClipPlane,
411     (void *)NineDevice9_GetClipPlane,
412     (void *)NineDevice9_SetRenderState,
413     (void *)NineDevice9_GetRenderState,
414     (void *)NineDevice9_CreateStateBlock,
415     (void *)NineDevice9_BeginStateBlock,
416     (void *)NineDevice9_EndStateBlock,
417     (void *)NineDevice9_SetClipStatus,
418     (void *)NineDevice9_GetClipStatus,
419     (void *)NineDevice9_GetTexture,
420     (void *)NineDevice9_SetTexture,
421     (void *)NineDevice9_GetTextureStageState,
422     (void *)NineDevice9_SetTextureStageState,
423     (void *)NineDevice9_GetSamplerState,
424     (void *)NineDevice9_SetSamplerState,
425     (void *)NineDevice9_ValidateDevice,
426     (void *)NineDevice9_SetPaletteEntries,
427     (void *)NineDevice9_GetPaletteEntries,
428     (void *)NineDevice9_SetCurrentTexturePalette,
429     (void *)NineDevice9_GetCurrentTexturePalette,
430     (void *)NineDevice9_SetScissorRect,
431     (void *)NineDevice9_GetScissorRect,
432     (void *)NineDevice9_SetSoftwareVertexProcessing,
433     (void *)NineDevice9_GetSoftwareVertexProcessing,
434     (void *)NineDevice9_SetNPatchMode,
435     (void *)NineDevice9_GetNPatchMode,
436     (void *)NineDevice9_DrawPrimitive,
437     (void *)NineDevice9_DrawIndexedPrimitive,
438     (void *)NineDevice9_DrawPrimitiveUP,
439     (void *)NineDevice9_DrawIndexedPrimitiveUP,
440     (void *)NineDevice9_ProcessVertices,
441     (void *)NineDevice9_CreateVertexDeclaration,
442     (void *)NineDevice9_SetVertexDeclaration,
443     (void *)NineDevice9_GetVertexDeclaration,
444     (void *)NineDevice9_SetFVF,
445     (void *)NineDevice9_GetFVF,
446     (void *)NineDevice9_CreateVertexShader,
447     (void *)NineDevice9_SetVertexShader,
448     (void *)NineDevice9_GetVertexShader,
449     (void *)NineDevice9_SetVertexShaderConstantF,
450     (void *)NineDevice9_GetVertexShaderConstantF,
451     (void *)NineDevice9_SetVertexShaderConstantI,
452     (void *)NineDevice9_GetVertexShaderConstantI,
453     (void *)NineDevice9_SetVertexShaderConstantB,
454     (void *)NineDevice9_GetVertexShaderConstantB,
455     (void *)NineDevice9_SetStreamSource,
456     (void *)NineDevice9_GetStreamSource,
457     (void *)NineDevice9_SetStreamSourceFreq,
458     (void *)NineDevice9_GetStreamSourceFreq,
459     (void *)NineDevice9_SetIndices,
460     (void *)NineDevice9_GetIndices,
461     (void *)NineDevice9_CreatePixelShader,
462     (void *)NineDevice9_SetPixelShader,
463     (void *)NineDevice9_GetPixelShader,
464     (void *)NineDevice9_SetPixelShaderConstantF,
465     (void *)NineDevice9_GetPixelShaderConstantF,
466     (void *)NineDevice9_SetPixelShaderConstantI,
467     (void *)NineDevice9_GetPixelShaderConstantI,
468     (void *)NineDevice9_SetPixelShaderConstantB,
469     (void *)NineDevice9_GetPixelShaderConstantB,
470     (void *)NineDevice9_DrawRectPatch,
471     (void *)NineDevice9_DrawTriPatch,
472     (void *)NineDevice9_DeletePatch,
473     (void *)NineDevice9_CreateQuery,
474     (void *)NineDevice9Ex_SetConvolutionMonoKernel,
475     (void *)NineDevice9Ex_ComposeRects,
476     (void *)NineDevice9Ex_PresentEx,
477     (void *)NineDevice9Ex_GetGPUThreadPriority,
478     (void *)NineDevice9Ex_SetGPUThreadPriority,
479     (void *)NineDevice9Ex_WaitForVBlank,
480     (void *)NineDevice9Ex_CheckResourceResidency,
481     (void *)NineDevice9Ex_SetMaximumFrameLatency,
482     (void *)NineDevice9Ex_GetMaximumFrameLatency,
483     (void *)NineDevice9Ex_CheckDeviceState,
484     (void *)NineDevice9Ex_CreateRenderTargetEx,
485     (void *)NineDevice9Ex_CreateOffscreenPlainSurfaceEx,
486     (void *)NineDevice9Ex_CreateDepthStencilSurfaceEx,
487     (void *)NineDevice9Ex_ResetEx,
488     (void *)NineDevice9Ex_GetDisplayModeEx
489 };
490 
491 static const GUID *NineDevice9Ex_IIDs[] = {
492     &IID_IDirect3DDevice9Ex,
493     &IID_IDirect3DDevice9,
494     &IID_IUnknown,
495     NULL
496 };
497 
498 HRESULT
NineDevice9Ex_new(struct pipe_screen * pScreen,D3DDEVICE_CREATION_PARAMETERS * pCreationParameters,D3DCAPS9 * pCaps,D3DPRESENT_PARAMETERS * pPresentationParameters,D3DDISPLAYMODEEX * pFullscreenDisplayMode,IDirect3D9Ex * pD3D9Ex,ID3DPresentGroup * pPresentationGroup,struct d3dadapter9_context * pCTX,struct NineDevice9Ex ** ppOut,int minorVersionNum)499 NineDevice9Ex_new( struct pipe_screen *pScreen,
500                    D3DDEVICE_CREATION_PARAMETERS *pCreationParameters,
501                    D3DCAPS9 *pCaps,
502                    D3DPRESENT_PARAMETERS *pPresentationParameters,
503                    D3DDISPLAYMODEEX *pFullscreenDisplayMode,
504                    IDirect3D9Ex *pD3D9Ex,
505                    ID3DPresentGroup *pPresentationGroup,
506                    struct d3dadapter9_context *pCTX,
507                    struct NineDevice9Ex **ppOut,
508                    int minorVersionNum )
509 {
510     BOOL lock;
511     lock = !!(pCreationParameters->BehaviorFlags & D3DCREATE_MULTITHREADED);
512 
513     NINE_NEW(Device9Ex, ppOut, lock,
514              pScreen, pCreationParameters, pCaps, pPresentationParameters,
515              pFullscreenDisplayMode, pD3D9Ex, pPresentationGroup, pCTX, minorVersionNum );
516 }
517 
518