Question

I'm working on an app that integrates WPF and DirectX. My goal is to have one shared surface that I use to:

  1. Load inital image data.
  2. Run DirectX 11 Compute Shaders to do some image processing.
  3. Draw on top with Direct2D.
  4. Display the result in my WPF app.

I think that I have 1, 3, and 4 figured out, but 2 is giving me headaches. My basic problem boils down to this: I think that the shared surface format must be B8G8R8A8_UNorm for WPF and Direct2D interop, but I can't make an Unordered Access View for my Compute Shader on a texture of that type.

What can I do to get Compute Shaders working in this scenario? Did I miss some tricky way to create a UAV? Do I need to restructure my app to use multiple textures somehow?

Était-ce utile?

La solution

This is not possible given the limited format support of these DirectX features and WPF interop (using D3D9Image).

One way to achieve interop between all these features is to do almost everything in R8G8B8A8_UNorm, then at the very end use Direct2D to write the result to a B8G8R8A8_UNorm render target that is used for interop with WPF. Direct2D can write the RGB result to a BGR target so it's quite simple.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top