I'm trying to read back a texture to CPU, so I created a staging texture. The problem is that this texture may have an arbitrary size, so I create it with something like:
stagingTextureDesc.Width = 643;
stagingTextureDesc.Height = 427;
stagingTextureDesc.CpuAccessFlags = SharpDX.Direct3D11.CpuAccessFlags.Read;
stagingTextureDesc.BindFlags = SharpDX.Direct3D11.BindFlags.None;
stagingTextureDesc.OptionFlags = SharpDX.Direct3D11.ResourceOptionFlags.None;
stagingTextureDesc.Usage = SharpDX.Direct3D11.ResourceUsage.Staging;
_texIntfData.m_IntermediateStagingTexture = new SharpDX.Direct3D11.Texture2D(_texIntfData.m_IntermediateDevice, stagingTextureDesc);
_texIntfData.m_IntermediateStagingShaderResourceView = new SharpDX.Direct3D11.ShaderResourceView(_texIntfData.m_IntermediateDevice, _texIntfData.m_IntermediateMipMapTexture);
Now when I read it back later, it reports me this size, however, internally it is definitely has a width of 1024, because the data I read back (Marshal.Copy(...) is aligned to 1024 and not 643.
It does not matter if the texture is multiple of 2, 4 or 8 or an uneven number - it seems to be always the larger power of 2 in the end. The problem is, there is no way to really query the size of the texture, or am I wrong?