Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d11/tests/d3d11.c | 24 +++++++++++++++++++++++- dlls/wined3d/view.c | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index d58319df58..e0b9ffe568 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -17236,7 +17236,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); @@ -17251,6 +17251,28 @@ static void test_create_unordered_access_view(void) ID3D11UnorderedAccessView_Release(uav); ID3D11Buffer_Release(buffer);
+ /* Without D3D11_BIND_UNORDERED_ACCESS. */ + buffer_desc.ByteWidth = 1024; + buffer_desc.Usage = D3D11_USAGE_DEFAULT; + buffer_desc.BindFlags = 0; + buffer_desc.CPUAccessFlags = 0; + buffer_desc.MiscFlags = 0; + buffer_desc.StructureByteStride = 0; + + hr = ID3D11Device_CreateBuffer(device, &buffer_desc, NULL, &buffer); + ok(SUCCEEDED(hr), "Failed to create a buffer, hr %#x.\n", hr); + + 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; diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index f1c99a3b6a..6710abb270 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -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;