wined3d: Fail SRV creation for resources without corresponding bind flag.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-09-26 10:02:35 +03:00 committed by Alexandre Julliard
parent 79cf8dfcfd
commit 76d3f0431a
4 changed files with 2 additions and 9 deletions

View File

@ -410,10 +410,7 @@ static void test_create_shader_resource_view(void)
ok(SUCCEEDED(hr), "Failed to create a buffer, hr %#x\n", hr); ok(SUCCEEDED(hr), "Failed to create a buffer, hr %#x\n", hr);
hr = ID3D10Device1_CreateShaderResourceView1(device, (ID3D10Resource *)buffer, &srv_desc, &srview); hr = ID3D10Device1_CreateShaderResourceView1(device, (ID3D10Resource *)buffer, &srv_desc, &srview);
todo_wine
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
if (SUCCEEDED(hr))
ID3D10ShaderResourceView1_Release(srview);
ID3D10Buffer_Release(buffer); ID3D10Buffer_Release(buffer);

View File

@ -3582,10 +3582,7 @@ static void test_create_shader_resource_view(void)
buffer = create_buffer(device, 0, 1024, NULL); buffer = create_buffer(device, 0, 1024, NULL);
hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)buffer, &srv_desc, &srview); hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)buffer, &srv_desc, &srview);
todo_wine
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
if (SUCCEEDED(hr))
ID3D10ShaderResourceView_Release(srview);
ID3D10Buffer_Release(buffer); ID3D10Buffer_Release(buffer);

View File

@ -4260,10 +4260,7 @@ static void test_create_shader_resource_view(void)
buffer = create_buffer(device, 0, 1024, NULL); buffer = create_buffer(device, 0, 1024, NULL);
hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)buffer, &srv_desc, &srview); hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)buffer, &srv_desc, &srview);
todo_wine
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
if (SUCCEEDED(hr))
ID3D11ShaderResourceView_Release(srview);
ID3D11Buffer_Release(buffer); ID3D11Buffer_Release(buffer);

View File

@ -767,6 +767,8 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
view->parent = parent; view->parent = parent;
view->parent_ops = parent_ops; view->parent_ops = parent_ops;
if (!(resource->bind_flags & WINED3D_BIND_SHADER_RESOURCE))
return E_INVALIDARG;
if (!(view->format = validate_resource_view(desc, resource, FALSE, FALSE))) if (!(view->format = validate_resource_view(desc, resource, FALSE, FALSE)))
return E_INVALIDARG; return E_INVALIDARG;
view->desc = *desc; view->desc = *desc;