Quote:Original post by JB2009
Remaining D2D1/D311 interop issues:
1) My biggest concern is the time that D2D1 is adding to the frame time. I'm seeing 1.5 to 2.7 ms additional time (depending on window size) over the equivalent D3D9 approaches. I haven't yet established whether this is "per window" for multiple window applications. The additional time is incurred as soon as the ID2D1 BeginDraw/EndDraw are added (i.e. without actually drawing anything). The amount of drawing only has a very small effect on the amount of time.
For my application this is time I can not afford to lose. Caching the 2D content is not an option for me because at least some of the text changes every frame (and even a single item of text incurs the full time overhead).
The only way to avoid this is to run the D2D content in an Async manner - which would result in the composite happening a few frames late. This shouldn't actually be noticeable by a user.
Quote:An important question for me is: Will this problem continue to exist when (if?) D2D1 becomes compatible with D3D11? (And also, was this a problem with D2D1 and D3D10.1?).
You shouldn't have this issue with D3D10 since all rendering will be against the same device (meaning you don't need mutex sharing).
Quote:2) If I add both GDI content (i.e. using IDXGISurface1.GetDC) AND D2D1 (using the DieterVW method), I either get an exception when drawing the D2D1 Quad to the D3D11 back buffer, or the GDI content appears but not the D2D1. Can they work together? Is it to do with the key values used with the mutexes? I'm updating a D3D9 library to D3D11, and cannot prevent GDI and text (via D2D1) being used together.
You can control the order of rendering to a shared surface using the mutex. If the order is appearing incorrect, then the algorithm you're using probably isn't working. Example: The initial draw locks the mutex with zero, and then releases it with 1. The next device you want to win the lock needs to be requesting the lock with a 1. Proceed in this manner, incrementing the release/lock for each transition in drawing.
Everything should be fine, provided the resource was flagged at creation time as GDI compatible. Also, you can't get a swap chain to create a back buffer that uses a mutex. You'd need new rendertarget created by D3D11. (perhaps you already did this, though I can't tell.)
The resource types that can be shared are a really thin slice, and get thinner everytime you add a functionality flag. I don't know enough about GDI to advise you on the best path to take to make this all work.