Commit 57fac9b0 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d11: Do not keep reference to resources.

parent 0ce7d71c
...@@ -2755,7 +2755,7 @@ static void test_create_depthstencil_view(void) ...@@ -2755,7 +2755,7 @@ static void test_create_depthstencil_view(void)
hr = ID3D11Device_CreateDepthStencilView(device, (ID3D11Resource *)texture, current_desc, &dsview); 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); ok(SUCCEEDED(hr), "Test %u: Failed to create depth stencil view, hr %#x.\n", i, hr);
refcount = get_refcount((IUnknown *)texture); 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); hr = ID3D11DepthStencilView_QueryInterface(dsview, &IID_ID3D10DepthStencilView, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
...@@ -3119,7 +3119,7 @@ static void test_create_rendertarget_view(void) ...@@ -3119,7 +3119,7 @@ static void test_create_rendertarget_view(void)
hr = ID3D11Device_CreateRenderTargetView(device, texture, current_desc, &rtview); hr = ID3D11Device_CreateRenderTargetView(device, texture, current_desc, &rtview);
ok(SUCCEEDED(hr), "Test %u: Failed to create render target view, hr %#x.\n", i, hr); ok(SUCCEEDED(hr), "Test %u: Failed to create render target view, hr %#x.\n", i, hr);
refcount = get_refcount((IUnknown *)texture); 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); hr = ID3D11RenderTargetView_QueryInterface(rtview, &IID_ID3D10RenderTargetView, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, 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) ...@@ -3478,7 +3478,7 @@ static void test_create_shader_resource_view(void)
hr = ID3D11Device_CreateShaderResourceView(device, texture, current_desc, &srview); 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); ok(SUCCEEDED(hr), "Test %u: Failed to create a shader resource view, hr %#x.\n", i, hr);
refcount = get_refcount((IUnknown *)texture); 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); hr = ID3D11ShaderResourceView_QueryInterface(srview, &IID_ID3D10ShaderResourceView, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
...@@ -8164,7 +8164,7 @@ static void test_swapchain_views(void) ...@@ -8164,7 +8164,7 @@ static void test_swapchain_views(void)
context = test_context.immediate_context; context = test_context.immediate_context;
refcount = get_refcount((IUnknown *)test_context.backbuffer); 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); draw_color_quad(&test_context, &color);
check_texture_color(test_context.backbuffer, 0xff7f4c33, 1); check_texture_color(test_context.backbuffer, 0xff7f4c33, 1);
...@@ -8177,7 +8177,7 @@ static void test_swapchain_views(void) ...@@ -8177,7 +8177,7 @@ static void test_swapchain_views(void)
ID3D11DeviceContext_OMSetRenderTargets(context, 1, &rtv, NULL); ID3D11DeviceContext_OMSetRenderTargets(context, 1, &rtv, NULL);
refcount = get_refcount((IUnknown *)test_context.backbuffer); 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); draw_color_quad(&test_context, &color);
todo_wine check_texture_color(test_context.backbuffer, 0xffbc957c, 1); todo_wine check_texture_color(test_context.backbuffer, 0xffbc957c, 1);
...@@ -10396,7 +10396,7 @@ static void test_create_unordered_access_view(void) ...@@ -10396,7 +10396,7 @@ static void test_create_unordered_access_view(void)
hr = ID3D11Device_CreateUnorderedAccessView(device, texture, current_desc, &uav); hr = ID3D11Device_CreateUnorderedAccessView(device, texture, current_desc, &uav);
ok(SUCCEEDED(hr), "Test %u: Failed to create unordered access view, hr %#x.\n", i, hr); ok(SUCCEEDED(hr), "Test %u: Failed to create unordered access view, hr %#x.\n", i, hr);
refcount = get_refcount((IUnknown *)texture); 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)); memset(&uav_desc, 0, sizeof(uav_desc));
ID3D11UnorderedAccessView_GetDesc(uav, &uav_desc); ID3D11UnorderedAccessView_GetDesc(uav, &uav_desc);
......
...@@ -996,7 +996,6 @@ static ULONG STDMETHODCALLTYPE d3d11_depthstencil_view_Release(ID3D11DepthStenci ...@@ -996,7 +996,6 @@ static ULONG STDMETHODCALLTYPE d3d11_depthstencil_view_Release(ID3D11DepthStenci
{ {
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_rendertarget_view_decref(view->wined3d_view); wined3d_rendertarget_view_decref(view->wined3d_view);
ID3D11Resource_Release(view->resource);
ID3D11Device_Release(view->device); ID3D11Device_Release(view->device);
wined3d_private_store_cleanup(&view->private_store); wined3d_private_store_cleanup(&view->private_store);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -1312,7 +1311,6 @@ static HRESULT d3d_depthstencil_view_init(struct d3d_depthstencil_view *view, st ...@@ -1312,7 +1311,6 @@ static HRESULT d3d_depthstencil_view_init(struct d3d_depthstencil_view *view, st
wined3d_private_store_init(&view->private_store); wined3d_private_store_init(&view->private_store);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
view->resource = resource; view->resource = resource;
ID3D11Resource_AddRef(resource);
view->device = &device->ID3D11Device_iface; view->device = &device->ID3D11Device_iface;
ID3D11Device_AddRef(view->device); ID3D11Device_AddRef(view->device);
...@@ -1419,7 +1417,6 @@ static ULONG STDMETHODCALLTYPE d3d11_rendertarget_view_Release(ID3D11RenderTarge ...@@ -1419,7 +1417,6 @@ static ULONG STDMETHODCALLTYPE d3d11_rendertarget_view_Release(ID3D11RenderTarge
{ {
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_rendertarget_view_decref(view->wined3d_view); wined3d_rendertarget_view_decref(view->wined3d_view);
ID3D11Resource_Release(view->resource);
ID3D11Device_Release(view->device); ID3D11Device_Release(view->device);
wined3d_private_store_cleanup(&view->private_store); wined3d_private_store_cleanup(&view->private_store);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -1740,7 +1737,6 @@ static HRESULT d3d_rendertarget_view_init(struct d3d_rendertarget_view *view, st ...@@ -1740,7 +1737,6 @@ static HRESULT d3d_rendertarget_view_init(struct d3d_rendertarget_view *view, st
wined3d_private_store_init(&view->private_store); wined3d_private_store_init(&view->private_store);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
view->resource = resource; view->resource = resource;
ID3D11Resource_AddRef(resource);
view->device = &device->ID3D11Device_iface; view->device = &device->ID3D11Device_iface;
ID3D11Device_AddRef(view->device); ID3D11Device_AddRef(view->device);
...@@ -1848,7 +1844,6 @@ static ULONG STDMETHODCALLTYPE d3d11_shader_resource_view_Release(ID3D11ShaderRe ...@@ -1848,7 +1844,6 @@ static ULONG STDMETHODCALLTYPE d3d11_shader_resource_view_Release(ID3D11ShaderRe
{ {
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_shader_resource_view_decref(view->wined3d_view); wined3d_shader_resource_view_decref(view->wined3d_view);
ID3D11Resource_Release(view->resource);
ID3D11Device_Release(view->device); ID3D11Device_Release(view->device);
wined3d_private_store_cleanup(&view->private_store); wined3d_private_store_cleanup(&view->private_store);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -2221,7 +2216,6 @@ static HRESULT d3d_shader_resource_view_init(struct d3d_shader_resource_view *vi ...@@ -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_private_store_init(&view->private_store);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
view->resource = resource; view->resource = resource;
ID3D11Resource_AddRef(resource);
view->device = &device->ID3D11Device_iface; view->device = &device->ID3D11Device_iface;
ID3D11Device_AddRef(view->device); ID3D11Device_AddRef(view->device);
...@@ -2314,7 +2308,6 @@ static ULONG STDMETHODCALLTYPE d3d11_unordered_access_view_Release(ID3D11Unorder ...@@ -2314,7 +2308,6 @@ static ULONG STDMETHODCALLTYPE d3d11_unordered_access_view_Release(ID3D11Unorder
{ {
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_unordered_access_view_decref(view->wined3d_view); wined3d_unordered_access_view_decref(view->wined3d_view);
ID3D11Resource_Release(view->resource);
ID3D11Device_Release(view->device); ID3D11Device_Release(view->device);
wined3d_private_store_cleanup(&view->private_store); wined3d_private_store_cleanup(&view->private_store);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -2510,7 +2503,7 @@ static HRESULT d3d11_unordered_access_view_init(struct d3d11_unordered_access_vi ...@@ -2510,7 +2503,7 @@ static HRESULT d3d11_unordered_access_view_init(struct d3d11_unordered_access_vi
wined3d_private_store_init(&view->private_store); wined3d_private_store_init(&view->private_store);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
ID3D11Resource_AddRef(view->resource = resource); view->resource = resource;
ID3D11Device_AddRef(view->device = &device->ID3D11Device_iface); ID3D11Device_AddRef(view->device = &device->ID3D11Device_iface);
return S_OK; return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment