From 104b5a81933b7a2f4fa24302a1d972ad3dd0dec6 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Tue, 25 Nov 2014 00:38:01 +0100 Subject: [PATCH] st/nine: clean device9ex. Pass ex specific parameters as arguments to device9 ctor instead of passing them by filling the structure. Cc: "10.4" Reviewed-by: David Heidelberg Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/adapter9.c | 2 +- src/gallium/state_trackers/nine/device9.c | 19 +++++++++++-------- src/gallium/state_trackers/nine/device9.h | 7 +++++-- src/gallium/state_trackers/nine/device9ex.c | 6 ++---- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c index 8d574deeca3..e409d5f3473 100644 --- a/src/gallium/state_trackers/nine/adapter9.c +++ b/src/gallium/state_trackers/nine/adapter9.c @@ -990,7 +990,7 @@ NineAdapter9_CreateDevice( struct NineAdapter9 *This, params.BehaviorFlags = BehaviorFlags; hr = NineDevice9_new(screen, ¶ms, &caps, pPresentationParameters, - pD3D9, pPresentationGroup, This->ctx, + pD3D9, pPresentationGroup, This->ctx, FALSE, NULL, (struct NineDevice9 **)ppReturnedDeviceInterface); if (FAILED(hr)) { DBG("Failed to create device.\n"); diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 7d2142d03f1..5f95b42aa00 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -139,7 +139,9 @@ NineDevice9_ctor( struct NineDevice9 *This, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3D9 *pD3D9, ID3DPresentGroup *pPresentationGroup, - struct d3dadapter9_context *pCTX ) + struct d3dadapter9_context *pCTX, + boolean ex, + D3DDISPLAYMODEEX *pFullscreenDisplayMode ) { unsigned i; HRESULT hr = NineUnknown_ctor(&This->base, pParams); @@ -151,6 +153,7 @@ NineDevice9_ctor( struct NineDevice9 *This, This->caps = *pCaps; This->d3d9 = pD3D9; This->params = *pCreationParameters; + This->ex = ex; This->present = pPresentationGroup; IDirect3D9_AddRef(This->d3d9); ID3DPresentGroup_AddRef(This->present); @@ -177,12 +180,12 @@ NineDevice9_ctor( struct NineDevice9 *This, if (FAILED(hr)) return hr; - if (This->ex) { + if (ex) { D3DDISPLAYMODEEX *mode = NULL; struct NineSwapChain9Ex **ret = (struct NineSwapChain9Ex **)&This->swapchains[i]; - if (This->pFullscreenDisplayMode) mode = &(This->pFullscreenDisplayMode[i]); + if (pFullscreenDisplayMode) mode = &(pFullscreenDisplayMode[i]); /* when this is a Device9Ex, it should create SwapChain9Exs */ hr = NineSwapChain9Ex_new(This, TRUE, present, &pPresentationParameters[i], pCTX, @@ -310,9 +313,6 @@ NineDevice9_ctor( struct NineDevice9 *This, This->update = &This->state; nine_update_state(This, ~0); - /* Is just used to pass the parameter from NineDevice9Ex_ctor */ - This->pFullscreenDisplayMode = NULL; - ID3DPresentGroup_Release(This->present); return D3D_OK; @@ -974,7 +974,7 @@ create_zs_or_rt_surface(struct NineDevice9 *This, } else { resource = NULL; } - hr = NineSurface9_new(This, NULL, resource, 0, 0, 0, &desc, &surface); + hr = NineSurface9_new(This, NULL, resource, NULL, 0, 0, 0, &desc, &surface); pipe_resource_reference(&resource, NULL); if (SUCCEEDED(hr)) @@ -3447,6 +3447,8 @@ NineDevice9_new( struct pipe_screen *pScreen, IDirect3D9 *pD3D9, ID3DPresentGroup *pPresentationGroup, struct d3dadapter9_context *pCTX, + boolean ex, + D3DDISPLAYMODEEX *pFullscreenDisplayMode, struct NineDevice9 **ppOut ) { BOOL lock; @@ -3454,5 +3456,6 @@ NineDevice9_new( struct pipe_screen *pScreen, NINE_NEW(Device9, ppOut, lock, /* args */ pScreen, pCreationParameters, pCaps, - pPresentationParameters, pD3D9, pPresentationGroup, pCTX); + pPresentationParameters, pD3D9, pPresentationGroup, pCTX, + ex, pFullscreenDisplayMode); } diff --git a/src/gallium/state_trackers/nine/device9.h b/src/gallium/state_trackers/nine/device9.h index 9dc248e64fb..3649e1b479e 100644 --- a/src/gallium/state_trackers/nine/device9.h +++ b/src/gallium/state_trackers/nine/device9.h @@ -48,7 +48,6 @@ struct NineDevice9 { struct NineUnknown base; boolean ex; - D3DDISPLAYMODEEX *pFullscreenDisplayMode; /* G3D context */ struct pipe_screen *screen; @@ -134,6 +133,8 @@ NineDevice9_new( struct pipe_screen *pScreen, IDirect3D9 *pD3D9, ID3DPresentGroup *pPresentationGroup, struct d3dadapter9_context *pCTX, + boolean ex, + D3DDISPLAYMODEEX *pFullscreenDisplayMode, struct NineDevice9 **ppOut ); HRESULT @@ -145,7 +146,9 @@ NineDevice9_ctor( struct NineDevice9 *This, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3D9 *pD3D9, ID3DPresentGroup *pPresentationGroup, - struct d3dadapter9_context *pCTX ); + struct d3dadapter9_context *pCTX, + boolean ex, + D3DDISPLAYMODEEX *pFullscreenDisplayMode ); void NineDevice9_dtor( struct NineDevice9 *This ); diff --git a/src/gallium/state_trackers/nine/device9ex.c b/src/gallium/state_trackers/nine/device9ex.c index 00d460bdee4..d36189d4571 100644 --- a/src/gallium/state_trackers/nine/device9ex.c +++ b/src/gallium/state_trackers/nine/device9ex.c @@ -39,13 +39,11 @@ NineDevice9Ex_ctor( struct NineDevice9Ex *This, ID3DPresentGroup *pPresentationGroup, struct d3dadapter9_context *pCTX ) { - This->base.ex = TRUE; - This->base.pFullscreenDisplayMode = pFullscreenDisplayMode; - return NineDevice9_ctor(&This->base, pParams, pScreen, pCreationParameters, pCaps, pPresentationParameters, - (IDirect3D9 *)pD3D9Ex, pPresentationGroup, pCTX); + (IDirect3D9 *)pD3D9Ex, pPresentationGroup, pCTX, + TRUE, pFullscreenDisplayMode); } static void -- 2.30.2