开发者

Do I need to recreate Direct2D sharable resources?

According to the documentation, even device-dependent resources are sharable among render targets when those render targets meet some conditions.

Assume I have two RenderTargets(RT1 & RT2) which meet these conditions. I use RT1 to create a new device-dependent resource(ResourceA), and both RT1 & RT2 use this resource to开发者_如何转开发 do some drawing.

Now when I'm done with RT1, I get D2DERR_RECREATE_TARGET which means I have to recreate RT1 and draw again.

My question is, should I recreate the ResourceA created by RT1?


Short answer: Yes, any resource that was created using RT1 will need to be recreated when, D2DERR_RECREATE_TARGET is encountered.

Long answer: D2D resources can be shared between all RenderTargets that came from the same factory as the d2d factory maintains the internal connections to the underlying D3D device and it's resources. ID2D1RenderTargets are really just ID3DTexture2Ds. As such when the d3d texture has been invalidated all the resources created using the underlying d3d device must be recreated as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜