You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.
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:
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?
The text was updated successfully, but these errors were encountered:
Ok, so I'm not fully into device capabilities etc.
I'm running on a Macbook Pro Late 2018 and a Macbook Pro Late 2015 one, the behaviour seems different on the two devices and whether I use VMWare to run Windows or use Windows natively. The problem described was observed on Windows native (which is even stranger to me). The Problem does not appear on VMWare powered Windows however...
you are completely right - that was what I've missed, thanks a lot!
I got a little more into this and my guess is that probably the textures on VMWare are software emulated, rather than real hardware textures. I now used the rowpitch to get everything right, as RowPitch is on VMWare indeed the width times 4, and natively 2 to the power of ceil(log(width)/log(2)) times 4. That works so far.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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?
The text was updated successfully, but these errors were encountered: