sharpdx / SharpDX-Samples

Official repository for all SharpDX Samples
346 stars 222 forks source link

[Question] BCn Textures - Detect If Existing .DDS File Has Alpha Channel? #44

Open FiftyTifty opened 7 years ago

FiftyTifty commented 7 years ago

Got me a wee problem. Bear with me 'ere, as I've only been doing C# for a couple days.

I've created a program that essentially runs texconv.exe through a folder and it's subdirectories, allowing the user to resize images of a specific resolution to another. It's intended for Fallout 4, so it operates on D3D 11 textures.

The problem, is that I've no way to check if a .dds file has an alpha channel or not. The header doesn't contain information about that (unlike the x & y res, as well as the mipmap level count), so I can't just retrieve a byte at a specific offset.

How would I use SharpDX to return whether or not a .dds has an alpha channel? It shouldn't be too intricate, seeing as how I just need to return a true/false boolean if the image has one or not.

Me source code for the program can be gotten 'ere. https://github.com/MajinCry/Fallout-4-Texture-Resizer