Jump to content

  • Log In with Google      Sign In   
  • Create Account


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: 12215

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
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#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: 12215

Like
0Likes
Like

Posted 30 January 2013 - 07:51 PM

Yes, or D3DFMT_DXT5.

 

 

L. Spiro


It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums




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