Open walbourn opened 9 years ago
What is the status of this enhancement?
I need to port a call from the good old D3DX9-Library (D3DXLoadSurfaceFromMemory) to DirectXTex. Could you describe how I would implement this the most efficient way using the DirectXTex library?
This item is really a sample/documentation issue. These legacy D3DX11 functions do a lot of processing, so I wanted to capture just how heavy-weight they really are.
For other D3DX functions, see Living without D3DX which covers it in detail. The most common use case for D3DXLoadSurfaceFromMemory
is best handled by the DDSTextureLoader or WICTextureLoader in the DirectX Tool Kit which are much lighter weight.
If you need more complex processing, I'd first recommend doing it offline and storing the result in a DDS
for quick & efficient loading with DDSTextureLoader. If you need more complex support (such as in a tool) where you need to do format conversions, mipmap generation, resizing at runtime more complex than what is supported by WICTextureLoader, then you'd look at using the full DirectXTex library. See this blog post.
There's no directly equivalent DirectXTex function to the legacy D3DX11 functions D3DX11CreateTextureFromFile, D3DX11CreateShaderResourceViewFromFile, D3DX11CreateTextureFromMemory, and D3DX11CreateShaderResourceViewFromMemory. The same operations can be performed by DirectXTex, and generally these old functions are total overkill for most users.
However, a utility that demonstrates how to implement all the old 'full-fat' functionality' could be useful for porting as well as be a good sample of how to use DirectXTex in complex ways (rather than just texconv/texassemble).
Note that I won't be implementing the "ThreadPump" async loader behavior that is tied into some D3DX11 only tech