Sign in to follow this  
jsg007

Mipmap generation not working with compressed texture?

Recommended Posts

Hi there! Is there a specific reason why mipmaps aren't generated when I upload the texture as DXT compressed data? (It works fine with uncompressed RGBA...) Maybe DirectX does not support mipmap generation for compressed textures?

Share this post


Link to post
Share on other sites
Mipmaps aren't generated at upload time, they're generated at load time. How are you loading your texture? If you're loading a .dds file using the D3DX functions, it's entirely possible that the file only has one mip level in it...

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Mipmaps aren't generated at upload time, they're generated at load time. How are you loading your texture? If you're loading a .dds file using the D3DX functions, it's entirely possible that the file only has one mip level in it...


Nope, I'm creating the texture with CreateTexture, with D3DFMT_DXT1 and D3DUSAGE_AUTOGENMIPMAP. Then move the raw data to the memory location.

It's working fine, the texture appears, but apparently it has no mipmaps.

I also tried GenerateMipSubLevels(), but no result.


And the same code works fine for uncompressed RGBA images. So i don't get what I could be doing wrong.

Generally mipmap generation is working for compressed textures?

Share this post


Link to post
Share on other sites
Quote:
Original post by Porthos
Use IDirect3D9::CheckDeviceFormat() with D3DUSAGE_AUTOGENMIPMAP to check whether automatic MIP map generation for DXT textures is supported by your driver.


Well it fails... but it also fails for RGBA, maybe I'm passing the wrong parameters?


HRESULT result=dxObj->CheckDeviceFormat(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,D3DFMT_A8R8G8B8,D3DUSAGE_AUTOGENMIPMAP,D3DRTYPE_TEXTURE,D3DFMT_DXT1/*D3DFMT_A8R8G8B8*/);




It doesn't return D3DOK_NOAUTOGEN either.

Share this post


Link to post
Share on other sites
Oops, I used D3DFMT_A8R8G8B8 for the render target, I changed it to D3DFMT_X8R8G8B8 and CheckDeviceFormat seems to be working fine.


Unfortunately for D3DFMT_DXT1 it returns D3DOK_NOAUTOGEN which means it doesn't support mipmap generation for compressed textures. (only for uncompressed)


How is this possible???




Here are my specs:

OS : Windows XP Professional x64 Edition (5.2, Build 3790) Service Pack 1
Video card : NVIDIA GeForce6600
Processor : AMD Athlon(tm) 64 Processor 3000+, ~1.8GHz
DirectX Version : DirectX 9.0c (4.09.0000.0904)

Share this post


Link to post
Share on other sites
Quote:
Original post by jsg007
Unfortunately for D3DFMT_DXT1 it returns D3DOK_NOAUTOGEN which means it doesn't support mipmap generation for compressed textures. (only for uncompressed)


How is this possible???
Because your drivers don't support it. Support for most things varies depends on driver support, which is why you need to query support for things before using them.
Do you have the latest drivers for your card?

If the driver doesn't support it, you'll have to lock the surface and do it yourself. Also, are you using the Debug Runtimes? This is exactly the sort of thing that I'd expect them to flag...

Share this post


Link to post
Share on other sites
Thanks for your replies.

I tried to run the code today on a completely different system (with a Radeon card), the same thing happens, so either i'm doing something wrong, or automatic mipmap generation for compressed textures is generally not supported.


Has anyone tried to create a texture with CreateTexture, with D3DFMT_DXT1 and D3DUSAGE_AUTOGENMIPMAP? Are mipmaps generated in this case?


Alternatively what other options do I have to generate mipmaps from DXT data?


Share this post


Link to post
Share on other sites
Not supported on my Radeon HD 3870. I figure since auto generation for a compressed texture requires realtime compression, that's unlikely to be a common feature. I wonder if there's any hardware that supports it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this