Sign in to follow this  
drjaydenm

DDS Loading Into Texture2D

Recommended Posts

Hi,

 

I am creating an engine using C# and SharpDX. To load DDS files, I was originally decoding the file to a R8G8B8A8 format which defeats the purpose of using DDS as it removes all compression. I am now trying to load DXT5 textures into my engine whilst keeping the compression but I am stuck when trying to copy the texture into the Texture2D DX resource. I have the texture format set as BC3_UNORM.

 

I'm not quite sure what part of the DDS file I am meant to be copying to the resource and whether or not I am meant to be reordering some channels of the file before doing so. I have tried to find documentation online but it seems to be scarce as everyone wants to use helper functions whereas I am trying to avoid using them solely for the task of loading a DDS file.

 

Any help or insight into what part of the file I am meant to be copying to the Texture2D resource and any modifications I need to perform would be helpful.

 

Thanks.

Share this post


Link to post
Share on other sites
Skip the header and give each texture body as-is to the texture class/Direct3D.
When you have mip-maps you will have multiple texture bodies in the file. You have to calculate the sizes of each body anyway to know how much to give to Direct3D. Each texture body follows the previous with no padding between them.
Bodies are never smaller than 4×4 chunks, even when the dimensions of the mip-map (or texture) are smaller, such as 1×1.


L. Spiro

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this