D1121: Wrong Resource Domain

An operation failed because a device-dependent resource is associated with the wrong ID2D1Device (resource domain).

 

Possible Causes

This message occurs when an application has attempted a drawing operation that mixes resources from different resource domains. Device contexts, brushes, and bitmaps, for example, are device-specific. While performing an operation such as ID2D1DeviceContext::DrawBitmap, the argument bitmap should belong to the same resource domain as the device context. In this example, a way to ensure this is to create the bitmap using that device context’s CreateBitmap member function, rather than that of some other device context.

Possible Fixes

When groups of resources should be used together, ensure they are created from the same ID2D1Device. Non-target resources created directly from an ID2D1Factory, such as state blocks and geometries, and are considered device-independent and do not have this restriction.