d2d1: Create staging texture with read access for bitmaps with D2D1_BITMAP_OPTIONS_CPU_READ.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2022-05-29 13:17:22 +03:00 committed by Alexandre Julliard
parent 9cdf2a6e90
commit a95ed15447
2 changed files with 5 additions and 3 deletions

View file

@ -374,12 +374,16 @@ HRESULT d2d_bitmap_create(struct d2d_device_context *context, D2D1_SIZE_U size,
texture_desc.SampleDesc.Count = 1;
texture_desc.SampleDesc.Quality = 0;
texture_desc.Usage = D3D11_USAGE_DEFAULT;
if (desc->bitmapOptions & D2D1_BITMAP_OPTIONS_CPU_READ)
texture_desc.Usage = D3D11_USAGE_STAGING;
texture_desc.BindFlags = 0;
if (desc->bitmapOptions & D2D1_BITMAP_OPTIONS_TARGET)
texture_desc.BindFlags |= D3D11_BIND_RENDER_TARGET;
if (!(desc->bitmapOptions & D2D1_BITMAP_OPTIONS_CANNOT_DRAW))
texture_desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE;
texture_desc.CPUAccessFlags = 0;
if (desc->bitmapOptions & D2D1_BITMAP_OPTIONS_CPU_READ)
texture_desc.CPUAccessFlags |= D3D11_CPU_ACCESS_READ;
texture_desc.MiscFlags = 0;
if (desc->bitmapOptions & D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE)
texture_desc.MiscFlags |= D3D11_RESOURCE_MISC_GDI_COMPATIBLE;

View file

@ -11709,10 +11709,8 @@ static void test_bitmap_map(BOOL d3d11)
hr = IDXGISurface_QueryInterface(surface, &IID_ID3D11Texture2D, (void **)&texture);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
ID3D11Texture2D_GetDesc(texture, &texture_desc);
todo_wine
ok(texture_desc.Usage == D3D11_USAGE_STAGING, "Unexpected usage %u.\n", texture_desc.Usage);
ok(!texture_desc.BindFlags, "Unexpected bind flags %#x.\n", texture_desc.BindFlags);
todo_wine
ok(texture_desc.CPUAccessFlags == D3D11_CPU_ACCESS_READ, "Unexpected CPU access flags %#x.\n",
texture_desc.CPUAccessFlags);
ok(!texture_desc.MiscFlags, "Unexpected misc flags %#x.\n", texture_desc.MiscFlags);
@ -11822,7 +11820,7 @@ static void test_bitmap_create(BOOL d3d11)
bitmap_desc.bitmapOptions = invalid_options[i].options;
bitmap_desc.colorContext = NULL;
hr = ID2D1DeviceContext_CreateBitmap(ctx.context, size, NULL, 0, &bitmap_desc, &bitmap);
todo_wine
todo_wine_if(i != 1)
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
if (SUCCEEDED(hr))
ID2D1Bitmap1_Release(bitmap);