Load DDS file to CPU

Started by
3 comments, last by gfxCahd 9 years, 6 months ago

I want to load a DDS file (mipmaps included) to the CPU. That means loading its values to a D3D11_SUBRESOURCE_DATA in d3d11 (in the case of sharpdx, that would be loaded in a dataRectangle).

I can't use the graphics device & its context (multithreading issues), plus it's silly to load a texture to the graphics card just for the cpu to read it back.

It seems though that WIC doesn't support DDS? I've found suggestions to use DirectX TK, but I am using sharpDX. So is there some easy solution to this, or do i have to write a managed version of whatever Directx TK does to read DDS?

-thanks

Advertisement

If you need to decompress the file, try Squish. Just call the squish::Decompress function (converting to c# shouldn't be an issue).

what about the dx11 equivalent of D3DXCreateTextureFromFileExA with mempool = scratch ?

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Is there any reason why you can't use the SharpDX toolkit? It comes with a DDS loader, and you can load the data directly into the Image object so you won't need a context/device. The DDS loader (and other image format loading) in SharpDX is based on the native DirectXTex library which appears to be a subset of the DirectXTk library.

In the worst case, if you don't want the toolkit, you could always cannibalize the source (be sure to give credit of course) and rig up your own loader.

Eh.... It's like including a reference to XNA when all you want is just to import a DDS file. So... I think i'll start cannibalizing.

It just seemed strange that a MS framework (WIC) wouldn't support a MS filetype (DDS), out of the box.

This topic is closed to new replies.

Advertisement