From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d2d1/bitmap.c | 4 ++++ dlls/d2d1/tests/d2d1.c | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c index 971e3c7ff6b..8386f703b46 100644 --- a/dlls/d2d1/bitmap.c +++ b/dlls/d2d1/bitmap.c @@ -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; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index e8f07976d54..0069cf746bb 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -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);