Jump to content
  • Advertisement
Sign in to follow this  

How to create a Texture3D from the memory?

This topic is 1162 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts



I have a DDS CubeMap texture in the memory: 64x64, depht: 1, mipmaps: 7, format: BC3_UNorm_SRgb.



It's stored as 6 * 7 data blocks.



I trying to create a texture:

using (SafeUnmanagedArray array = new SafeUnmanagedArray(gtex.MipMapData.Sum(d => d.Length)))
    DataBox[] rects = new DataBox[gtex.MipMapData.Length];
    using (UnmanagedMemoryStream io = array.OpenStream(FileAccess.Write))
        byte[] buff = new byte[32 * 1024];
        for (int index = 0; index < gtex.MipMapData.Length; index++)
            GtexMipMapLocation mimMap = gtex.MipMapData[index];
            Int32 rowPitch, depthPitch;
            GetPitch(descriptor, index % descriptor.MipLevels, out rowPitch, out depthPitch);

            rects[index] = CreateDataBox(array, io, rowPitch, depthPitch);
            input.CopyToStream(io, mimMap.Length, buff);

    Texture3D texture = new Texture3D(_device, descriptor, rects);
    return new DxTexture(texture, descriptor);

But get an invalid MiscFlags exception (0x6). I think the problem in the wrong formation of DataCubes.

Or invalid depthPitch.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!