mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 04:29:15 +01:00
[tests] Add D3D9 swapchain refcounting tests
This commit is contained in:
parent
6d5f5580fb
commit
353c7f7671
@ -116,6 +116,44 @@ public:
|
||||
nullptr,
|
||||
&m_device);
|
||||
|
||||
// Funny Swapchain Refcounting
|
||||
// "One of the things COM does really well, is lifecycle management"
|
||||
// Implicit Swapchain
|
||||
{
|
||||
IDirect3DSurface9* pSurface1 = nullptr;
|
||||
IDirect3DSurface9* pSurface2 = nullptr;
|
||||
status = m_device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pSurface1);
|
||||
D3DPRESENT_PARAMETERS newParams = params;
|
||||
newParams.BackBufferWidth = 10;
|
||||
newParams.BackBufferHeight = 10;
|
||||
status = m_device->Reset(&newParams);
|
||||
status = m_device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pSurface2);
|
||||
|
||||
IDirect3DSwapChain9* pSwapChain2 = nullptr;
|
||||
IDirect3DSwapChain9* pSwapChain3 = nullptr;
|
||||
status = pSurface1->GetContainer(__uuidof(IDirect3DSwapChain9), reinterpret_cast<void**>(&pSwapChain2));
|
||||
status = pSurface2->GetContainer(__uuidof(IDirect3DSwapChain9), reinterpret_cast<void**>(&pSwapChain3));
|
||||
|
||||
printf("E_NOINTERFACE! for pSwapchain2");
|
||||
status = m_device->Reset(¶ms);
|
||||
}
|
||||
// Additional swapchain
|
||||
{
|
||||
IDirect3DSwapChain9* pSwapChain2 = nullptr;
|
||||
IDirect3DSwapChain9* pSwapChain3 = nullptr;
|
||||
IDirect3DSwapChain9* pSwapChain4 = nullptr;
|
||||
IDirect3DSurface9* pSurface = nullptr;
|
||||
status = m_device->CreateAdditionalSwapChain(¶ms, &pSwapChain2);
|
||||
status = pSwapChain2->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pSurface);
|
||||
status = pSurface->GetContainer(__uuidof(IDirect3DSwapChain9), reinterpret_cast<void**>(&pSwapChain3));
|
||||
pSwapChain2->Release();
|
||||
UINT count = pSwapChain2->Release();
|
||||
printf("Count: %u - Should be 0 and swapchain dead!", count);
|
||||
status = pSurface->GetContainer(__uuidof(IDirect3DSwapChain9), reinterpret_cast<void**>(&pSwapChain4));
|
||||
// E_NOINTERFACE !
|
||||
printf("E_NOINTERFACE!");
|
||||
}
|
||||
|
||||
m_device->AddRef();
|
||||
|
||||
Com<IDirect3DSurface9> backbuffer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user