Search code examples
directxsharpdx

DirectX texture sharing: same data, different formats?


I'm using SharpDX but this is really a general DirectX question. I have a D3D10 Texture2D. How do I create a D3D11 Texture2D that points to the same pixel data but specifies a different pixel format?

To put it another way:

// These two textures need to share the same pixel data
D3D10.Texture2D tex10; // Description.Format = B8G8R8A8_UNorm
D3D11.Texture2D tex11; // Description.Format = R32_UInt

I know how to get a DXGI Resource interface and then call OpenSharedResource() to get textures with the same format. How can I create the textures with different formats?


Solution

  • It's not possible. The textures themselves must be of the same data type.

    You can create a typeless texture, however, and use specific views to access the data as if it had specific formats. See Strong vs Weak Typing.