wined3d: Fail UAV 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:
parent
41f0096d5e
commit
97ef647837
|
@ -17239,7 +17239,7 @@ static void test_create_unordered_access_view(void)
|
|||
ok(SUCCEEDED(hr), "Failed to create a buffer, hr %#x.\n", hr);
|
||||
|
||||
hr = ID3D11Device_CreateUnorderedAccessView(device, (ID3D11Resource *)buffer, NULL, &uav);
|
||||
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
|
||||
ok(SUCCEEDED(hr), "Failed to create unordered access view, hr %#x.\n", hr);
|
||||
|
||||
memset(&uav_desc, 0, sizeof(uav_desc));
|
||||
ID3D11UnorderedAccessView_GetDesc(uav, &uav_desc);
|
||||
|
@ -17254,6 +17254,20 @@ static void test_create_unordered_access_view(void)
|
|||
ID3D11UnorderedAccessView_Release(uav);
|
||||
ID3D11Buffer_Release(buffer);
|
||||
|
||||
/* Without D3D11_BIND_UNORDERED_ACCESS. */
|
||||
buffer = create_buffer(device, 0, 1024, NULL);
|
||||
|
||||
uav_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
uav_desc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
|
||||
U(uav_desc).Buffer.FirstElement = 0;
|
||||
U(uav_desc).Buffer.NumElements = 64;
|
||||
U(uav_desc).Buffer.Flags = 0;
|
||||
|
||||
hr = ID3D11Device_CreateUnorderedAccessView(device, (ID3D11Resource *)buffer, &uav_desc, &uav);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
ID3D11Buffer_Release(buffer);
|
||||
|
||||
texture2d_desc.Width = 512;
|
||||
texture2d_desc.Height = 512;
|
||||
texture2d_desc.SampleDesc.Count = 1;
|
||||
|
|
|
@ -1134,6 +1134,8 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
|
|||
view->parent = parent;
|
||||
view->parent_ops = parent_ops;
|
||||
|
||||
if (!(resource->bind_flags & WINED3D_BIND_UNORDERED_ACCESS))
|
||||
return E_INVALIDARG;
|
||||
if (!(view->format = validate_resource_view(desc, resource, TRUE, FALSE)))
|
||||
return E_INVALIDARG;
|
||||
view->desc = *desc;
|
||||
|
|
Loading…
Reference in New Issue