We need to use a single IDirect3DDevice9 for all LayerManagerD3D9's. I've created a test application and verified that the approach I'm planning on taking works on all platforms. The single D3D9 device will make it a lot easier to move image layers between managers. And it will also allow ANGLE to more easily work within several windows. The approach will look as follows: - Every IDirect3DDevice9 has an implicit swap chain and is bound to a focus window. This implicit swap chain will be 1x1 and be bound to an invisible window. - Every LayerManagerD3D9 will use IDirect3DDevice9::CreateAdditionalSwapChain to create its own swap chain. - On device resets the device will be reset and all swap chains will need to be released and re-created. - On a window resize the swap chain will need to be released and recreated for that window. Two new classes are planned: DeviceManagerD3D9 - This class will manage the one D3D9 device. The main relevant method here will be: SwapChainD3D9 *CreateSwapChain(HWND hWnd); SwapChainD3D9 - This will be a per LayerManager class and it will expose a Resize method. For device resets the DeviceManagerD3D9 will keep track of all swap chains and recreate them upon device reset, trying to minimize involvement of layer managers.
Sounds great! > - On a window resize the swap chain will need to be released and recreated for > that window. Do we get the resizing behaviour for free for the default swap chain? Or is this no different than what we have now? I'm wondering what the impact of this recreation will be on live resize.
(In reply to comment #1) > Sounds great! > > > - On a window resize the swap chain will need to be released and recreated for > > that window. > > Do we get the resizing behaviour for free for the default swap chain? Or is > this no different than what we have now? I'm wondering what the impact of this > recreation will be on live resize. We need to do it manually now as well, we just use the Reset function. (Or ResetEx for D3D9Ex)
Created attachment 463828 [details] [diff] [review] Make all layer managers use a single device v1 This should do the trick! It depends on Bug 578384 which hasn't landed yet, since this fixes Windows Aero drawing.
This is important for ANGLE to work right, and will make a bunch of other things easier.
blocking2.0: --- → ?
Created attachment 463995 [details] [diff] [review] Make all layer managers use a single device v2 Updated to use dont_AddRef() on D3D9Create, since the returned interface will be addrefed already.
Comment on attachment 463995 [details] [diff] [review] Make all layer managers use a single device v2 Looks fine I think, the only comment I have is: >- mD3DManager->SetShaderMode(LayerManagerD3D9::RGBLAYER); >+ mD3DManager->deviceManager()->SetShaderMode(DeviceManagerD3D9::RGBLAYER); It would probably be better/cleaner for this to remain mD3DManager->SetShaderMode(), and have that be an inline function that forwards to deviceManager(). This looks like the main use of mD3DManager->deviceManager(), so would make code look a bit cleaner.
Attachment #463995 - Flags: review?(vladimir) → review+
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.