From 57fac9b02e1c113c28c5c07a3f41676153120bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Thu, 2 Feb 2017 12:43:36 +0100 Subject: [PATCH] d3d11: Do not keep reference to resources. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d11/tests/d3d11.c | 12 ++++++------ dlls/d3d11/view.c | 9 +-------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index f83e76436f3..b4f4eef3b15 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -2755,7 +2755,7 @@ static void test_create_depthstencil_view(void) hr = ID3D11Device_CreateDepthStencilView(device, (ID3D11Resource *)texture, current_desc, &dsview); ok(SUCCEEDED(hr), "Test %u: Failed to create depth stencil view, hr %#x.\n", i, hr); refcount = get_refcount((IUnknown *)texture); - todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount); + ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount); hr = ID3D11DepthStencilView_QueryInterface(dsview, &IID_ID3D10DepthStencilView, (void **)&iface); ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, @@ -3119,7 +3119,7 @@ static void test_create_rendertarget_view(void) hr = ID3D11Device_CreateRenderTargetView(device, texture, current_desc, &rtview); ok(SUCCEEDED(hr), "Test %u: Failed to create render target view, hr %#x.\n", i, hr); refcount = get_refcount((IUnknown *)texture); - todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount); + ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount); hr = ID3D11RenderTargetView_QueryInterface(rtview, &IID_ID3D10RenderTargetView, (void **)&iface); ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, @@ -3478,7 +3478,7 @@ static void test_create_shader_resource_view(void) hr = ID3D11Device_CreateShaderResourceView(device, texture, current_desc, &srview); ok(SUCCEEDED(hr), "Test %u: Failed to create a shader resource view, hr %#x.\n", i, hr); refcount = get_refcount((IUnknown *)texture); - todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount); + ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount); hr = ID3D11ShaderResourceView_QueryInterface(srview, &IID_ID3D10ShaderResourceView, (void **)&iface); ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, @@ -8164,7 +8164,7 @@ static void test_swapchain_views(void) context = test_context.immediate_context; refcount = get_refcount((IUnknown *)test_context.backbuffer); - todo_wine ok(refcount == 1, "Got unexpected refcount %u.\n", refcount); + ok(refcount == 1, "Got unexpected refcount %u.\n", refcount); draw_color_quad(&test_context, &color); check_texture_color(test_context.backbuffer, 0xff7f4c33, 1); @@ -8177,7 +8177,7 @@ static void test_swapchain_views(void) ID3D11DeviceContext_OMSetRenderTargets(context, 1, &rtv, NULL); refcount = get_refcount((IUnknown *)test_context.backbuffer); - todo_wine ok(refcount == 1, "Got unexpected refcount %u.\n", refcount); + ok(refcount == 1, "Got unexpected refcount %u.\n", refcount); draw_color_quad(&test_context, &color); todo_wine check_texture_color(test_context.backbuffer, 0xffbc957c, 1); @@ -10396,7 +10396,7 @@ static void test_create_unordered_access_view(void) hr = ID3D11Device_CreateUnorderedAccessView(device, texture, current_desc, &uav); ok(SUCCEEDED(hr), "Test %u: Failed to create unordered access view, hr %#x.\n", i, hr); refcount = get_refcount((IUnknown *)texture); - todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount); + ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount); memset(&uav_desc, 0, sizeof(uav_desc)); ID3D11UnorderedAccessView_GetDesc(uav, &uav_desc); diff --git a/dlls/d3d11/view.c b/dlls/d3d11/view.c index 06f40117a2d..92fc37c659b 100644 --- a/dlls/d3d11/view.c +++ b/dlls/d3d11/view.c @@ -996,7 +996,6 @@ static ULONG STDMETHODCALLTYPE d3d11_depthstencil_view_Release(ID3D11DepthStenci { wined3d_mutex_lock(); wined3d_rendertarget_view_decref(view->wined3d_view); - ID3D11Resource_Release(view->resource); ID3D11Device_Release(view->device); wined3d_private_store_cleanup(&view->private_store); wined3d_mutex_unlock(); @@ -1312,7 +1311,6 @@ static HRESULT d3d_depthstencil_view_init(struct d3d_depthstencil_view *view, st wined3d_private_store_init(&view->private_store); wined3d_mutex_unlock(); view->resource = resource; - ID3D11Resource_AddRef(resource); view->device = &device->ID3D11Device_iface; ID3D11Device_AddRef(view->device); @@ -1419,7 +1417,6 @@ static ULONG STDMETHODCALLTYPE d3d11_rendertarget_view_Release(ID3D11RenderTarge { wined3d_mutex_lock(); wined3d_rendertarget_view_decref(view->wined3d_view); - ID3D11Resource_Release(view->resource); ID3D11Device_Release(view->device); wined3d_private_store_cleanup(&view->private_store); wined3d_mutex_unlock(); @@ -1740,7 +1737,6 @@ static HRESULT d3d_rendertarget_view_init(struct d3d_rendertarget_view *view, st wined3d_private_store_init(&view->private_store); wined3d_mutex_unlock(); view->resource = resource; - ID3D11Resource_AddRef(resource); view->device = &device->ID3D11Device_iface; ID3D11Device_AddRef(view->device); @@ -1848,7 +1844,6 @@ static ULONG STDMETHODCALLTYPE d3d11_shader_resource_view_Release(ID3D11ShaderRe { wined3d_mutex_lock(); wined3d_shader_resource_view_decref(view->wined3d_view); - ID3D11Resource_Release(view->resource); ID3D11Device_Release(view->device); wined3d_private_store_cleanup(&view->private_store); wined3d_mutex_unlock(); @@ -2221,7 +2216,6 @@ static HRESULT d3d_shader_resource_view_init(struct d3d_shader_resource_view *vi wined3d_private_store_init(&view->private_store); wined3d_mutex_unlock(); view->resource = resource; - ID3D11Resource_AddRef(resource); view->device = &device->ID3D11Device_iface; ID3D11Device_AddRef(view->device); @@ -2314,7 +2308,6 @@ static ULONG STDMETHODCALLTYPE d3d11_unordered_access_view_Release(ID3D11Unorder { wined3d_mutex_lock(); wined3d_unordered_access_view_decref(view->wined3d_view); - ID3D11Resource_Release(view->resource); ID3D11Device_Release(view->device); wined3d_private_store_cleanup(&view->private_store); wined3d_mutex_unlock(); @@ -2510,7 +2503,7 @@ static HRESULT d3d11_unordered_access_view_init(struct d3d11_unordered_access_vi wined3d_private_store_init(&view->private_store); wined3d_mutex_unlock(); - ID3D11Resource_AddRef(view->resource = resource); + view->resource = resource; ID3D11Device_AddRef(view->device = &device->ID3D11Device_iface); return S_OK;