[PATCH v2 1/3] d2d1: Implement ID2D1Bitmap1::Map().

Dmitry Timoshkov dmitry at baikal.ru
Fri May 27 04:17:54 CDT 2022


Nikolay Sivov <nsivov at codeweavers.com> wrote:

> > +    texture_desc.Usage = D3D11_USAGE_STAGING;
> > +    texture_desc.BindFlags = 0;
> > +    texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
> > +    ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &staging_texture);
> This should check for failures.

Sure.

> > +    if (SUCCEEDED(hr = ID3D11DeviceContext_Map(context, (ID3D11Resource *)staging_texture, 0,
> > +            D3D11_MAP_READ, 0, &mapped_subresource)))
> > +    {
> > +        mapped_rect->pitch = mapped_subresource.RowPitch;
> > +        mapped_rect->bits = mapped_subresource.pData;
> > +        bitmap->staging_resource = (ID3D11Resource *)staging_texture;
> > +    }
> > +    else
> > +    {
> > +        WARN("Failed to map resource, hr %#lx.\n", hr);
> > +        ID3D11Texture2D_Release(staging_texture);
> > +    }
> Staging texture has to be released at some point.

Thanks for spotting this.

-- 
Dmitry.



More information about the wine-devel mailing list