Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


DDS Loading Into Texture2D


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 drjaydenm   Members   -  Reputation: 111

Like
0Likes
Like

Posted 30 January 2013 - 07:34 PM

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.



Sponsor:

#2 L. Spiro   Crossbones+   -  Reputation: 20789

Like
1Likes
Like

Posted 30 January 2013 - 07:37 PM

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

#3 drjaydenm   Members   -  Reputation: 111

Like
0Likes
Like

Posted 30 January 2013 - 07:44 PM

Thanks for the info, I think I should be able to get it done now. Also, just double checking, is BC3_UNORM the correct format to be using with DXT5?



#4 L. Spiro   Crossbones+   -  Reputation: 20789

Like
0Likes
Like

Posted 30 January 2013 - 07:51 PM

Yes, or D3DFMT_DXT5.

 

 

L. Spiro






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS