Commit 76d3f043 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent 79cf8dfc
......@@ -410,10 +410,7 @@ static void test_create_shader_resource_view(void)
ok(SUCCEEDED(hr), "Failed to create a buffer, hr %#x\n", hr);
hr = ID3D10Device1_CreateShaderResourceView1(device, (ID3D10Resource *)buffer, &srv_desc, &srview);
todo_wine
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
if (SUCCEEDED(hr))
ID3D10ShaderResourceView1_Release(srview);
ID3D10Buffer_Release(buffer);
......
......@@ -3582,10 +3582,7 @@ static void test_create_shader_resource_view(void)
buffer = create_buffer(device, 0, 1024, NULL);
hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)buffer, &srv_desc, &srview);
todo_wine
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
if (SUCCEEDED(hr))
ID3D10ShaderResourceView_Release(srview);
ID3D10Buffer_Release(buffer);
......
......@@ -4260,10 +4260,7 @@ static void test_create_shader_resource_view(void)
buffer = create_buffer(device, 0, 1024, NULL);
hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)buffer, &srv_desc, &srview);
todo_wine
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
if (SUCCEEDED(hr))
ID3D11ShaderResourceView_Release(srview);
ID3D11Buffer_Release(buffer);
......@@ -767,6 +767,8 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
view->parent = parent;
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)))
return E_INVALIDARG;
view->desc = *desc;
......
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