425{
428 D3D11_TEXTURE2D_DESC texture_desc;
431
433 {
434 WARN(
"Tried to create bitmap with unsupported format {%#x / %#x}.\n",
435 desc->pixelFormat.format,
desc->pixelFormat.alphaMode);
437 }
438
439 if (
desc->dpiX == 0.0f &&
desc->dpiY == 0.0f)
440 {
445 }
446 else if (
desc->dpiX <= 0.0f ||
desc->dpiY <= 0.0f)
447 {
449 }
450
453
454 texture_desc.Width =
size.width;
455 texture_desc.Height =
size.height;
456 if (!texture_desc.Width || !texture_desc.Height)
457 texture_desc.Width = texture_desc.Height = 1;
458 texture_desc.MipLevels = 1;
459 texture_desc.ArraySize = 1;
460 texture_desc.Format =
desc->pixelFormat.format;
461 texture_desc.SampleDesc.Count = 1;
462 texture_desc.SampleDesc.Quality = 0;
463 texture_desc.Usage = D3D11_USAGE_DEFAULT;
465 texture_desc.Usage = D3D11_USAGE_STAGING;
466 texture_desc.BindFlags = 0;
468 texture_desc.BindFlags |= D3D11_BIND_RENDER_TARGET;
470 texture_desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE;
471 texture_desc.CPUAccessFlags = 0;
473 texture_desc.CPUAccessFlags |= D3D11_CPU_ACCESS_READ;
474 texture_desc.MiscFlags = 0;
477
480
481 if (
FAILED(
hr = ID3D11Device1_CreateTexture2D(
context->d3d_device, &texture_desc,
483 {
484 ERR(
"Failed to create texture, hr %#lx.\n",
hr);
486 }
487
489 {
492 }
493 ID3D11Texture2D_Release(
texture);
494
496}
#define D2DERR_UNSUPPORTED_PIXEL_FORMAT
@ D3D11_RESOURCE_MISC_GDI_COMPATIBLE
static BOOL format_supported(const D2D1_PIXEL_FORMAT *format)
static BOOL check_bitmap_options(unsigned int options)
static void d2d_bitmap_init(struct d2d_bitmap *bitmap, struct d2d_device_context *context, ID3D11Resource *resource, D2D1_SIZE_U size, const D2D1_BITMAP_PROPERTIES1 *desc)
D3D11_SHADER_VARIABLE_DESC desc