17ec681f3Smrg/* 27ec681f3Smrg * Copyright 2011 Joakim Sindholt <opensource@zhasha.com> 37ec681f3Smrg * 47ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 57ec681f3Smrg * copy of this software and associated documentation files (the "Software"), 67ec681f3Smrg * to deal in the Software without restriction, including without limitation 77ec681f3Smrg * on the rights to use, copy, modify, merge, publish, distribute, sub 87ec681f3Smrg * license, and/or sell copies of the Software, and to permit persons to whom 97ec681f3Smrg * the Software is furnished to do so, subject to the following conditions: 107ec681f3Smrg * 117ec681f3Smrg * The above copyright notice and this permission notice (including the next 127ec681f3Smrg * paragraph) shall be included in all copies or substantial portions of the 137ec681f3Smrg * Software. 147ec681f3Smrg * 157ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 167ec681f3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 177ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 187ec681f3Smrg * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 197ec681f3Smrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 207ec681f3Smrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 217ec681f3Smrg * USE OR OTHER DEALINGS IN THE SOFTWARE. */ 227ec681f3Smrg 237ec681f3Smrg#include "device9.h" 247ec681f3Smrg#include "device9ex.h" 257ec681f3Smrg#include "nine_pipe.h" 267ec681f3Smrg#include "swapchain9ex.h" 277ec681f3Smrg 287ec681f3Smrg#include "nine_helpers.h" 297ec681f3Smrg 307ec681f3Smrg#include "util/macros.h" 317ec681f3Smrg 327ec681f3Smrg#define DBG_CHANNEL DBG_DEVICE 337ec681f3Smrg 347ec681f3Smrgstatic HRESULT 357ec681f3SmrgNineDevice9Ex_ctor( struct NineDevice9Ex *This, 367ec681f3Smrg struct NineUnknownParams *pParams, 377ec681f3Smrg struct pipe_screen *pScreen, 387ec681f3Smrg D3DDEVICE_CREATION_PARAMETERS *pCreationParameters, 397ec681f3Smrg D3DCAPS9 *pCaps, 407ec681f3Smrg D3DPRESENT_PARAMETERS *pPresentationParameters, 417ec681f3Smrg D3DDISPLAYMODEEX *pFullscreenDisplayMode, 427ec681f3Smrg IDirect3D9Ex *pD3D9Ex, 437ec681f3Smrg ID3DPresentGroup *pPresentationGroup, 447ec681f3Smrg struct d3dadapter9_context *pCTX, 457ec681f3Smrg int minorVersionNum ) 467ec681f3Smrg{ 477ec681f3Smrg DBG("This=%p pParams=%p pScreen=%p pCreationParameters=%p pCaps=%p " 487ec681f3Smrg "pPresentationParameters=%p pFullscreenDisplayMode=%p " 497ec681f3Smrg "pD3D9Ex=%p pPresentationGroup=%p pCTX=%p\n", 507ec681f3Smrg This, pParams, pScreen, pCreationParameters, pCaps, 517ec681f3Smrg pPresentationParameters, pFullscreenDisplayMode, 527ec681f3Smrg pD3D9Ex, pPresentationGroup, pCTX); 537ec681f3Smrg 547ec681f3Smrg return NineDevice9_ctor(&This->base, pParams, 557ec681f3Smrg pScreen, pCreationParameters, pCaps, 567ec681f3Smrg pPresentationParameters, 577ec681f3Smrg (IDirect3D9 *)pD3D9Ex, pPresentationGroup, pCTX, 587ec681f3Smrg TRUE, pFullscreenDisplayMode, minorVersionNum); 597ec681f3Smrg} 607ec681f3Smrg 617ec681f3Smrgstatic void 627ec681f3SmrgNineDevice9Ex_dtor( struct NineDevice9Ex *This ) 637ec681f3Smrg{ 647ec681f3Smrg NineDevice9_dtor(&This->base); 657ec681f3Smrg} 667ec681f3Smrg 677ec681f3SmrgHRESULT NINE_WINAPI 687ec681f3SmrgNineDevice9Ex_SetConvolutionMonoKernel( UNUSED struct NineDevice9Ex *This, 697ec681f3Smrg UNUSED UINT width, 707ec681f3Smrg UNUSED UINT height, 717ec681f3Smrg UNUSED float *rows, 727ec681f3Smrg UNUSED float *columns ) 737ec681f3Smrg{ 747ec681f3Smrg DBG("This\n"); 757ec681f3Smrg STUB(D3D_OK); 767ec681f3Smrg} 777ec681f3Smrg 787ec681f3SmrgHRESULT NINE_WINAPI 797ec681f3SmrgNineDevice9Ex_ComposeRects( UNUSED struct NineDevice9Ex *This, 807ec681f3Smrg UNUSED IDirect3DSurface9 *pSrc, 817ec681f3Smrg UNUSED IDirect3DSurface9 *pDst, 827ec681f3Smrg UNUSED IDirect3DVertexBuffer9 *pSrcRectDescs, 837ec681f3Smrg UNUSED UINT NumRects, 847ec681f3Smrg UNUSED IDirect3DVertexBuffer9 *pDstRectDescs, 857ec681f3Smrg UNUSED D3DCOMPOSERECTSOP Operation, 867ec681f3Smrg UNUSED int Xoffset, 877ec681f3Smrg UNUSED int Yoffset ) 887ec681f3Smrg{ 897ec681f3Smrg DBG("This\n"); 907ec681f3Smrg STUB(D3D_OK); 917ec681f3Smrg} 927ec681f3Smrg 937ec681f3SmrgHRESULT NINE_WINAPI 947ec681f3SmrgNineDevice9Ex_PresentEx( struct NineDevice9Ex *This, 957ec681f3Smrg const RECT *pSourceRect, 967ec681f3Smrg const RECT *pDestRect, 977ec681f3Smrg HWND hDestWindowOverride, 987ec681f3Smrg const RGNDATA *pDirtyRegion, 997ec681f3Smrg DWORD dwFlags ) 1007ec681f3Smrg{ 1017ec681f3Smrg unsigned i; 1027ec681f3Smrg HRESULT hr; 1037ec681f3Smrg 1047ec681f3Smrg DBG("This=%p pSourceRect=%p pDestRect=%p hDestWindowOverride=%p " 1057ec681f3Smrg "pDirtyRegion=%p dwFlags=%d\n", 1067ec681f3Smrg This, pSourceRect, pDestRect, hDestWindowOverride, 1077ec681f3Smrg pDirtyRegion, dwFlags); 1087ec681f3Smrg 1097ec681f3Smrg for (i = 0; i < This->base.nswapchains; i++) { 1107ec681f3Smrg hr = NineSwapChain9_Present(This->base.swapchains[i], pSourceRect, pDestRect, 1117ec681f3Smrg hDestWindowOverride, pDirtyRegion, dwFlags); 1127ec681f3Smrg if (FAILED(hr)) { return hr; } 1137ec681f3Smrg } 1147ec681f3Smrg 1157ec681f3Smrg return D3D_OK; 1167ec681f3Smrg} 1177ec681f3Smrg 1187ec681f3SmrgHRESULT NINE_WINAPI 1197ec681f3SmrgNineDevice9Ex_GetGPUThreadPriority( struct NineDevice9Ex *This, 1207ec681f3Smrg INT *pPriority ) 1217ec681f3Smrg{ 1227ec681f3Smrg DBG("This\n"); 1237ec681f3Smrg user_assert(pPriority != NULL, D3DERR_INVALIDCALL); 1247ec681f3Smrg *pPriority = This->base.gpu_priority; 1257ec681f3Smrg return D3D_OK; 1267ec681f3Smrg} 1277ec681f3Smrg 1287ec681f3SmrgHRESULT NINE_WINAPI 1297ec681f3SmrgNineDevice9Ex_SetGPUThreadPriority( struct NineDevice9Ex *This, 1307ec681f3Smrg INT Priority ) 1317ec681f3Smrg{ 1327ec681f3Smrg DBG("This\n"); 1337ec681f3Smrg user_assert(Priority >= -7 && Priority <= 7, D3DERR_INVALIDCALL); 1347ec681f3Smrg This->base.gpu_priority = Priority; 1357ec681f3Smrg return D3D_OK; 1367ec681f3Smrg} 1377ec681f3Smrg 1387ec681f3SmrgHRESULT NINE_WINAPI 1397ec681f3SmrgNineDevice9Ex_WaitForVBlank( UNUSED struct NineDevice9Ex *This, 1407ec681f3Smrg UNUSED UINT iSwapChain ) 1417ec681f3Smrg{ 1427ec681f3Smrg DBG("This\n"); 1437ec681f3Smrg STUB(D3D_OK); 1447ec681f3Smrg} 1457ec681f3Smrg 1467ec681f3SmrgHRESULT NINE_WINAPI 1477ec681f3SmrgNineDevice9Ex_CheckResourceResidency( UNUSED struct NineDevice9Ex *This, 1487ec681f3Smrg UNUSED IDirect3DResource9 **pResourceArray, 1497ec681f3Smrg UNUSED UINT32 NumResources ) 1507ec681f3Smrg{ 1517ec681f3Smrg DBG("This\n"); 1527ec681f3Smrg STUB(D3D_OK); 1537ec681f3Smrg} 1547ec681f3Smrg 1557ec681f3SmrgHRESULT NINE_WINAPI 1567ec681f3SmrgNineDevice9Ex_SetMaximumFrameLatency( struct NineDevice9Ex *This, 1577ec681f3Smrg UINT MaxLatency ) 1587ec681f3Smrg{ 1597ec681f3Smrg DBG("This\n"); 1607ec681f3Smrg This->base.max_frame_latency = MaxLatency; 1617ec681f3Smrg return D3D_OK; 1627ec681f3Smrg} 1637ec681f3Smrg 1647ec681f3SmrgHRESULT NINE_WINAPI 1657ec681f3SmrgNineDevice9Ex_GetMaximumFrameLatency( struct NineDevice9Ex *This, 1667ec681f3Smrg UINT *pMaxLatency ) 1677ec681f3Smrg{ 1687ec681f3Smrg DBG("This\n"); 1697ec681f3Smrg user_assert(pMaxLatency != NULL, D3DERR_INVALIDCALL); 1707ec681f3Smrg *pMaxLatency = This->base.max_frame_latency; 1717ec681f3Smrg return D3D_OK; 1727ec681f3Smrg} 1737ec681f3Smrg 1747ec681f3SmrgHRESULT NINE_WINAPI 1757ec681f3SmrgNineDevice9Ex_CheckDeviceState( struct NineDevice9Ex *This, 1767ec681f3Smrg HWND hDestinationWindow ) 1777ec681f3Smrg{ 1787ec681f3Smrg DBG("This=%p hDestinationWindow=%p\n", 1797ec681f3Smrg This, hDestinationWindow); 1807ec681f3Smrg 1817ec681f3Smrg user_assert(!This->base.swapchains[0]->params.Windowed, D3D_OK); 1827ec681f3Smrg 1837ec681f3Smrg if (This->base.params.hFocusWindow == hDestinationWindow) { 1847ec681f3Smrg if (NineSwapChain9_GetOccluded(This->base.swapchains[0])) 1857ec681f3Smrg return S_PRESENT_OCCLUDED; 1867ec681f3Smrg } else if(!NineSwapChain9_GetOccluded(This->base.swapchains[0])) { 1877ec681f3Smrg return S_PRESENT_OCCLUDED; 1887ec681f3Smrg } 1897ec681f3Smrg /* TODO: handle the other return values */ 1907ec681f3Smrg return D3D_OK; 1917ec681f3Smrg} 1927ec681f3Smrg 1937ec681f3SmrgHRESULT NINE_WINAPI 1947ec681f3SmrgNineDevice9Ex_CreateRenderTargetEx( struct NineDevice9Ex *This, 1957ec681f3Smrg UINT Width, 1967ec681f3Smrg UINT Height, 1977ec681f3Smrg D3DFORMAT Format, 1987ec681f3Smrg D3DMULTISAMPLE_TYPE MultiSample, 1997ec681f3Smrg DWORD MultisampleQuality, 2007ec681f3Smrg BOOL Lockable, 2017ec681f3Smrg IDirect3DSurface9 **ppSurface, 2027ec681f3Smrg HANDLE *pSharedHandle, 2037ec681f3Smrg UNUSED DWORD Usage ) 2047ec681f3Smrg{ 2057ec681f3Smrg DBG("This\n"); 2067ec681f3Smrg /* The Create*Ex functions only purpose seem to introduce the 2077ec681f3Smrg * Usage field, to pass the new d3d9ex flags on secure/restricted 2087ec681f3Smrg * content. 2097ec681f3Smrg * TODO: Return error on invalid Usage. 2107ec681f3Smrg * TODO: Store Usage in the surface descriptor, in case the 2117ec681f3Smrg * app checks */ 2127ec681f3Smrg return NineDevice9_CreateRenderTarget(&This->base, 2137ec681f3Smrg Width, 2147ec681f3Smrg Height, 2157ec681f3Smrg Format, 2167ec681f3Smrg MultiSample, 2177ec681f3Smrg MultisampleQuality, 2187ec681f3Smrg Lockable, 2197ec681f3Smrg ppSurface, 2207ec681f3Smrg pSharedHandle); 2217ec681f3Smrg} 2227ec681f3Smrg 2237ec681f3SmrgHRESULT NINE_WINAPI 2247ec681f3SmrgNineDevice9Ex_CreateOffscreenPlainSurfaceEx( struct NineDevice9Ex *This, 2257ec681f3Smrg UINT Width, 2267ec681f3Smrg UINT Height, 2277ec681f3Smrg D3DFORMAT Format, 2287ec681f3Smrg D3DPOOL Pool, 2297ec681f3Smrg IDirect3DSurface9 **ppSurface, 2307ec681f3Smrg HANDLE *pSharedHandle, 2317ec681f3Smrg UNUSED DWORD Usage ) 2327ec681f3Smrg{ 2337ec681f3Smrg DBG("This\n"); 2347ec681f3Smrg /* The Create*Ex functions only purpose seem to introduce the 2357ec681f3Smrg * Usage field, to pass the new d3d9ex flags on secure/restricted 2367ec681f3Smrg * content. 2377ec681f3Smrg * TODO: Return error on invalid Usage. 2387ec681f3Smrg * TODO: Store Usage in the surface descriptor, in case the 2397ec681f3Smrg * app checks */ 2407ec681f3Smrg return NineDevice9_CreateOffscreenPlainSurface(&This->base, 2417ec681f3Smrg Width, 2427ec681f3Smrg Height, 2437ec681f3Smrg Format, 2447ec681f3Smrg Pool, 2457ec681f3Smrg ppSurface, 2467ec681f3Smrg pSharedHandle); 2477ec681f3Smrg} 2487ec681f3Smrg 2497ec681f3SmrgHRESULT NINE_WINAPI 2507ec681f3SmrgNineDevice9Ex_CreateDepthStencilSurfaceEx( struct NineDevice9Ex *This, 2517ec681f3Smrg UINT Width, 2527ec681f3Smrg UINT Height, 2537ec681f3Smrg D3DFORMAT Format, 2547ec681f3Smrg D3DMULTISAMPLE_TYPE MultiSample, 2557ec681f3Smrg DWORD MultisampleQuality, 2567ec681f3Smrg BOOL Discard, 2577ec681f3Smrg IDirect3DSurface9 **ppSurface, 2587ec681f3Smrg HANDLE *pSharedHandle, 2597ec681f3Smrg UNUSED DWORD Usage ) 2607ec681f3Smrg{ 2617ec681f3Smrg DBG("This\n"); 2627ec681f3Smrg /* The Create*Ex functions only purpose seem to introduce the 2637ec681f3Smrg * Usage field, to pass the new d3d9ex flags on secure/restricted 2647ec681f3Smrg * content. 2657ec681f3Smrg * TODO: Return error on invalid Usage. 2667ec681f3Smrg * TODO: Store Usage in the surface descriptor, in case the 2677ec681f3Smrg * app checks */ 2687ec681f3Smrg return NineDevice9_CreateDepthStencilSurface(&This->base, 2697ec681f3Smrg Width, 2707ec681f3Smrg Height, 2717ec681f3Smrg Format, 2727ec681f3Smrg MultiSample, 2737ec681f3Smrg MultisampleQuality, 2747ec681f3Smrg Discard, 2757ec681f3Smrg ppSurface, 2767ec681f3Smrg pSharedHandle); 2777ec681f3Smrg} 2787ec681f3Smrg 2797ec681f3SmrgHRESULT NINE_WINAPI 2807ec681f3SmrgNineDevice9Ex_ResetEx( struct NineDevice9Ex *This, 2817ec681f3Smrg D3DPRESENT_PARAMETERS *pPresentationParameters, 2827ec681f3Smrg D3DDISPLAYMODEEX *pFullscreenDisplayMode ) 2837ec681f3Smrg{ 2847ec681f3Smrg HRESULT hr = D3D_OK; 2857ec681f3Smrg float MinZ, MaxZ; 2867ec681f3Smrg unsigned i; 2877ec681f3Smrg 2887ec681f3Smrg DBG("This=%p pPresentationParameters=%p pFullscreenDisplayMode=%p\n", This, pPresentationParameters, pFullscreenDisplayMode); 2897ec681f3Smrg 2907ec681f3Smrg for (i = 0; i < This->base.nswapchains; ++i) { 2917ec681f3Smrg D3DDISPLAYMODEEX *mode = NULL; 2927ec681f3Smrg D3DPRESENT_PARAMETERS *params = &pPresentationParameters[i]; 2937ec681f3Smrg if (pFullscreenDisplayMode) mode = &(pFullscreenDisplayMode[i]); 2947ec681f3Smrg hr = NineSwapChain9_Resize(This->base.swapchains[i], params, mode); 2957ec681f3Smrg if (FAILED(hr)) 2967ec681f3Smrg break; 2977ec681f3Smrg } 2987ec681f3Smrg 2997ec681f3Smrg MinZ = This->base.state.viewport.MinZ; /* These are preserved */ 3007ec681f3Smrg MaxZ = This->base.state.viewport.MaxZ; 3017ec681f3Smrg NineDevice9_SetRenderTarget( 3027ec681f3Smrg (struct NineDevice9 *)This, 0, (IDirect3DSurface9 *)This->base.swapchains[0]->buffers[0]); 3037ec681f3Smrg This->base.state.viewport.MinZ = MinZ; 3047ec681f3Smrg This->base.state.viewport.MaxZ = MaxZ; 3057ec681f3Smrg nine_context_set_viewport(&This->base, &This->base.state.viewport); 3067ec681f3Smrg 3077ec681f3Smrg if (This->base.nswapchains && This->base.swapchains[0]->params.EnableAutoDepthStencil) 3087ec681f3Smrg NineDevice9_SetDepthStencilSurface( 3097ec681f3Smrg &This->base, (IDirect3DSurface9 *)This->base.swapchains[0]->zsbuf); 3107ec681f3Smrg 3117ec681f3Smrg return hr; 3127ec681f3Smrg} 3137ec681f3Smrg 3147ec681f3SmrgHRESULT NINE_WINAPI 3157ec681f3SmrgNineDevice9Ex_Reset( struct NineDevice9Ex *This, 3167ec681f3Smrg D3DPRESENT_PARAMETERS *pPresentationParameters ) 3177ec681f3Smrg{ 3187ec681f3Smrg HRESULT hr = D3D_OK; 3197ec681f3Smrg float MinZ, MaxZ; 3207ec681f3Smrg unsigned i; 3217ec681f3Smrg 3227ec681f3Smrg DBG("This=%p pPresentationParameters=%p\n", This, pPresentationParameters); 3237ec681f3Smrg 3247ec681f3Smrg for (i = 0; i < This->base.nswapchains; ++i) { 3257ec681f3Smrg D3DPRESENT_PARAMETERS *params = &pPresentationParameters[i]; 3267ec681f3Smrg hr = NineSwapChain9_Resize(This->base.swapchains[i], params, NULL); 3277ec681f3Smrg if (FAILED(hr)) 3287ec681f3Smrg break; 3297ec681f3Smrg } 3307ec681f3Smrg 3317ec681f3Smrg MinZ = This->base.state.viewport.MinZ; /* These are preserved */ 3327ec681f3Smrg MaxZ = This->base.state.viewport.MaxZ; 3337ec681f3Smrg NineDevice9_SetRenderTarget( 3347ec681f3Smrg (struct NineDevice9 *)This, 0, (IDirect3DSurface9 *)This->base.swapchains[0]->buffers[0]); 3357ec681f3Smrg This->base.state.viewport.MinZ = MinZ; 3367ec681f3Smrg This->base.state.viewport.MaxZ = MaxZ; 3377ec681f3Smrg nine_context_set_viewport(&This->base, &This->base.state.viewport); 3387ec681f3Smrg 3397ec681f3Smrg if (This->base.nswapchains && This->base.swapchains[0]->params.EnableAutoDepthStencil) 3407ec681f3Smrg NineDevice9_SetDepthStencilSurface( 3417ec681f3Smrg &This->base, (IDirect3DSurface9 *)This->base.swapchains[0]->zsbuf); 3427ec681f3Smrg 3437ec681f3Smrg return hr; 3447ec681f3Smrg} 3457ec681f3Smrg 3467ec681f3SmrgHRESULT NINE_WINAPI 3477ec681f3SmrgNineDevice9Ex_GetDisplayModeEx( struct NineDevice9Ex *This, 3487ec681f3Smrg UINT iSwapChain, 3497ec681f3Smrg D3DDISPLAYMODEEX *pMode, 3507ec681f3Smrg D3DDISPLAYROTATION *pRotation ) 3517ec681f3Smrg{ 3527ec681f3Smrg struct NineSwapChain9Ex *swapchain; 3537ec681f3Smrg 3547ec681f3Smrg DBG("This=%p iSwapChain=%u pMode=%p pRotation=%p\n", 3557ec681f3Smrg This, iSwapChain, pMode, pRotation); 3567ec681f3Smrg 3577ec681f3Smrg user_assert(iSwapChain < This->base.nswapchains, D3DERR_INVALIDCALL); 3587ec681f3Smrg 3597ec681f3Smrg swapchain = NineSwapChain9Ex(This->base.swapchains[iSwapChain]); 3607ec681f3Smrg return NineSwapChain9Ex_GetDisplayModeEx(swapchain, pMode, pRotation); 3617ec681f3Smrg} 3627ec681f3Smrg 3637ec681f3SmrgHRESULT NINE_WINAPI 3647ec681f3SmrgNineDevice9Ex_TestCooperativeLevel( UNUSED struct NineDevice9Ex *This ) 3657ec681f3Smrg{ 3667ec681f3Smrg DBG("This\n"); 3677ec681f3Smrg return D3D_OK; 3687ec681f3Smrg} 3697ec681f3Smrg 3707ec681f3Smrg 3717ec681f3SmrgIDirect3DDevice9ExVtbl NineDevice9Ex_vtable = { 3727ec681f3Smrg (void *)NineUnknown_QueryInterface, 3737ec681f3Smrg (void *)NineUnknown_AddRef, 3747ec681f3Smrg (void *)NineUnknown_Release, 3757ec681f3Smrg (void *)NineDevice9Ex_TestCooperativeLevel, 3767ec681f3Smrg (void *)NineDevice9_GetAvailableTextureMem, 3777ec681f3Smrg (void *)NineDevice9_EvictManagedResources, 3787ec681f3Smrg (void *)NineDevice9_GetDirect3D, 3797ec681f3Smrg (void *)NineDevice9_GetDeviceCaps, 3807ec681f3Smrg (void *)NineDevice9_GetDisplayMode, 3817ec681f3Smrg (void *)NineDevice9_GetCreationParameters, 3827ec681f3Smrg (void *)NineDevice9_SetCursorProperties, 3837ec681f3Smrg (void *)NineDevice9_SetCursorPosition, 3847ec681f3Smrg (void *)NineDevice9_ShowCursor, 3857ec681f3Smrg (void *)NineDevice9_CreateAdditionalSwapChain, 3867ec681f3Smrg (void *)NineDevice9_GetSwapChain, 3877ec681f3Smrg (void *)NineDevice9_GetNumberOfSwapChains, 3887ec681f3Smrg (void *)NineDevice9Ex_Reset, 3897ec681f3Smrg (void *)NineDevice9_Present, 3907ec681f3Smrg (void *)NineDevice9_GetBackBuffer, 3917ec681f3Smrg (void *)NineDevice9_GetRasterStatus, 3927ec681f3Smrg (void *)NineDevice9_SetDialogBoxMode, 3937ec681f3Smrg (void *)NineDevice9_SetGammaRamp, 3947ec681f3Smrg (void *)NineDevice9_GetGammaRamp, 3957ec681f3Smrg (void *)NineDevice9_CreateTexture, 3967ec681f3Smrg (void *)NineDevice9_CreateVolumeTexture, 3977ec681f3Smrg (void *)NineDevice9_CreateCubeTexture, 3987ec681f3Smrg (void *)NineDevice9_CreateVertexBuffer, 3997ec681f3Smrg (void *)NineDevice9_CreateIndexBuffer, 4007ec681f3Smrg (void *)NineDevice9_CreateRenderTarget, 4017ec681f3Smrg (void *)NineDevice9_CreateDepthStencilSurface, 4027ec681f3Smrg (void *)NineDevice9_UpdateSurface, 4037ec681f3Smrg (void *)NineDevice9_UpdateTexture, 4047ec681f3Smrg (void *)NineDevice9_GetRenderTargetData, 4057ec681f3Smrg (void *)NineDevice9_GetFrontBufferData, 4067ec681f3Smrg (void *)NineDevice9_StretchRect, 4077ec681f3Smrg (void *)NineDevice9_ColorFill, 4087ec681f3Smrg (void *)NineDevice9_CreateOffscreenPlainSurface, 4097ec681f3Smrg (void *)NineDevice9_SetRenderTarget, 4107ec681f3Smrg (void *)NineDevice9_GetRenderTarget, 4117ec681f3Smrg (void *)NineDevice9_SetDepthStencilSurface, 4127ec681f3Smrg (void *)NineDevice9_GetDepthStencilSurface, 4137ec681f3Smrg (void *)NineDevice9_BeginScene, 4147ec681f3Smrg (void *)NineDevice9_EndScene, 4157ec681f3Smrg (void *)NineDevice9_Clear, 4167ec681f3Smrg (void *)NineDevice9_SetTransform, 4177ec681f3Smrg (void *)NineDevice9_GetTransform, 4187ec681f3Smrg (void *)NineDevice9_MultiplyTransform, 4197ec681f3Smrg (void *)NineDevice9_SetViewport, 4207ec681f3Smrg (void *)NineDevice9_GetViewport, 4217ec681f3Smrg (void *)NineDevice9_SetMaterial, 4227ec681f3Smrg (void *)NineDevice9_GetMaterial, 4237ec681f3Smrg (void *)NineDevice9_SetLight, 4247ec681f3Smrg (void *)NineDevice9_GetLight, 4257ec681f3Smrg (void *)NineDevice9_LightEnable, 4267ec681f3Smrg (void *)NineDevice9_GetLightEnable, 4277ec681f3Smrg (void *)NineDevice9_SetClipPlane, 4287ec681f3Smrg (void *)NineDevice9_GetClipPlane, 4297ec681f3Smrg (void *)NineDevice9_SetRenderState, 4307ec681f3Smrg (void *)NineDevice9_GetRenderState, 4317ec681f3Smrg (void *)NineDevice9_CreateStateBlock, 4327ec681f3Smrg (void *)NineDevice9_BeginStateBlock, 4337ec681f3Smrg (void *)NineDevice9_EndStateBlock, 4347ec681f3Smrg (void *)NineDevice9_SetClipStatus, 4357ec681f3Smrg (void *)NineDevice9_GetClipStatus, 4367ec681f3Smrg (void *)NineDevice9_GetTexture, 4377ec681f3Smrg (void *)NineDevice9_SetTexture, 4387ec681f3Smrg (void *)NineDevice9_GetTextureStageState, 4397ec681f3Smrg (void *)NineDevice9_SetTextureStageState, 4407ec681f3Smrg (void *)NineDevice9_GetSamplerState, 4417ec681f3Smrg (void *)NineDevice9_SetSamplerState, 4427ec681f3Smrg (void *)NineDevice9_ValidateDevice, 4437ec681f3Smrg (void *)NineDevice9_SetPaletteEntries, 4447ec681f3Smrg (void *)NineDevice9_GetPaletteEntries, 4457ec681f3Smrg (void *)NineDevice9_SetCurrentTexturePalette, 4467ec681f3Smrg (void *)NineDevice9_GetCurrentTexturePalette, 4477ec681f3Smrg (void *)NineDevice9_SetScissorRect, 4487ec681f3Smrg (void *)NineDevice9_GetScissorRect, 4497ec681f3Smrg (void *)NineDevice9_SetSoftwareVertexProcessing, 4507ec681f3Smrg (void *)NineDevice9_GetSoftwareVertexProcessing, 4517ec681f3Smrg (void *)NineDevice9_SetNPatchMode, 4527ec681f3Smrg (void *)NineDevice9_GetNPatchMode, 4537ec681f3Smrg (void *)NineDevice9_DrawPrimitive, 4547ec681f3Smrg (void *)NineDevice9_DrawIndexedPrimitive, 4557ec681f3Smrg (void *)NineDevice9_DrawPrimitiveUP, 4567ec681f3Smrg (void *)NineDevice9_DrawIndexedPrimitiveUP, 4577ec681f3Smrg (void *)NineDevice9_ProcessVertices, 4587ec681f3Smrg (void *)NineDevice9_CreateVertexDeclaration, 4597ec681f3Smrg (void *)NineDevice9_SetVertexDeclaration, 4607ec681f3Smrg (void *)NineDevice9_GetVertexDeclaration, 4617ec681f3Smrg (void *)NineDevice9_SetFVF, 4627ec681f3Smrg (void *)NineDevice9_GetFVF, 4637ec681f3Smrg (void *)NineDevice9_CreateVertexShader, 4647ec681f3Smrg (void *)NineDevice9_SetVertexShader, 4657ec681f3Smrg (void *)NineDevice9_GetVertexShader, 4667ec681f3Smrg (void *)NineDevice9_SetVertexShaderConstantF, 4677ec681f3Smrg (void *)NineDevice9_GetVertexShaderConstantF, 4687ec681f3Smrg (void *)NineDevice9_SetVertexShaderConstantI, 4697ec681f3Smrg (void *)NineDevice9_GetVertexShaderConstantI, 4707ec681f3Smrg (void *)NineDevice9_SetVertexShaderConstantB, 4717ec681f3Smrg (void *)NineDevice9_GetVertexShaderConstantB, 4727ec681f3Smrg (void *)NineDevice9_SetStreamSource, 4737ec681f3Smrg (void *)NineDevice9_GetStreamSource, 4747ec681f3Smrg (void *)NineDevice9_SetStreamSourceFreq, 4757ec681f3Smrg (void *)NineDevice9_GetStreamSourceFreq, 4767ec681f3Smrg (void *)NineDevice9_SetIndices, 4777ec681f3Smrg (void *)NineDevice9_GetIndices, 4787ec681f3Smrg (void *)NineDevice9_CreatePixelShader, 4797ec681f3Smrg (void *)NineDevice9_SetPixelShader, 4807ec681f3Smrg (void *)NineDevice9_GetPixelShader, 4817ec681f3Smrg (void *)NineDevice9_SetPixelShaderConstantF, 4827ec681f3Smrg (void *)NineDevice9_GetPixelShaderConstantF, 4837ec681f3Smrg (void *)NineDevice9_SetPixelShaderConstantI, 4847ec681f3Smrg (void *)NineDevice9_GetPixelShaderConstantI, 4857ec681f3Smrg (void *)NineDevice9_SetPixelShaderConstantB, 4867ec681f3Smrg (void *)NineDevice9_GetPixelShaderConstantB, 4877ec681f3Smrg (void *)NineDevice9_DrawRectPatch, 4887ec681f3Smrg (void *)NineDevice9_DrawTriPatch, 4897ec681f3Smrg (void *)NineDevice9_DeletePatch, 4907ec681f3Smrg (void *)NineDevice9_CreateQuery, 4917ec681f3Smrg (void *)NineDevice9Ex_SetConvolutionMonoKernel, 4927ec681f3Smrg (void *)NineDevice9Ex_ComposeRects, 4937ec681f3Smrg (void *)NineDevice9Ex_PresentEx, 4947ec681f3Smrg (void *)NineDevice9Ex_GetGPUThreadPriority, 4957ec681f3Smrg (void *)NineDevice9Ex_SetGPUThreadPriority, 4967ec681f3Smrg (void *)NineDevice9Ex_WaitForVBlank, 4977ec681f3Smrg (void *)NineDevice9Ex_CheckResourceResidency, 4987ec681f3Smrg (void *)NineDevice9Ex_SetMaximumFrameLatency, 4997ec681f3Smrg (void *)NineDevice9Ex_GetMaximumFrameLatency, 5007ec681f3Smrg (void *)NineDevice9Ex_CheckDeviceState, 5017ec681f3Smrg (void *)NineDevice9Ex_CreateRenderTargetEx, 5027ec681f3Smrg (void *)NineDevice9Ex_CreateOffscreenPlainSurfaceEx, 5037ec681f3Smrg (void *)NineDevice9Ex_CreateDepthStencilSurfaceEx, 5047ec681f3Smrg (void *)NineDevice9Ex_ResetEx, 5057ec681f3Smrg (void *)NineDevice9Ex_GetDisplayModeEx 5067ec681f3Smrg}; 5077ec681f3Smrg 5087ec681f3Smrgstatic const GUID *NineDevice9Ex_IIDs[] = { 5097ec681f3Smrg &IID_IDirect3DDevice9Ex, 5107ec681f3Smrg &IID_IDirect3DDevice9, 5117ec681f3Smrg &IID_IUnknown, 5127ec681f3Smrg NULL 5137ec681f3Smrg}; 5147ec681f3Smrg 5157ec681f3SmrgHRESULT 5167ec681f3SmrgNineDevice9Ex_new( struct pipe_screen *pScreen, 5177ec681f3Smrg D3DDEVICE_CREATION_PARAMETERS *pCreationParameters, 5187ec681f3Smrg D3DCAPS9 *pCaps, 5197ec681f3Smrg D3DPRESENT_PARAMETERS *pPresentationParameters, 5207ec681f3Smrg D3DDISPLAYMODEEX *pFullscreenDisplayMode, 5217ec681f3Smrg IDirect3D9Ex *pD3D9Ex, 5227ec681f3Smrg ID3DPresentGroup *pPresentationGroup, 5237ec681f3Smrg struct d3dadapter9_context *pCTX, 5247ec681f3Smrg struct NineDevice9Ex **ppOut, 5257ec681f3Smrg int minorVersionNum ) 5267ec681f3Smrg{ 5277ec681f3Smrg BOOL lock; 5287ec681f3Smrg lock = !!(pCreationParameters->BehaviorFlags & D3DCREATE_MULTITHREADED); 5297ec681f3Smrg 5307ec681f3Smrg NINE_NEW(Device9Ex, ppOut, lock, 5317ec681f3Smrg pScreen, pCreationParameters, pCaps, pPresentationParameters, 5327ec681f3Smrg pFullscreenDisplayMode, pD3D9Ex, pPresentationGroup, pCTX, minorVersionNum ); 5337ec681f3Smrg} 5347ec681f3Smrg 535