Using mipmaps with RT's in DirectX9

Started by
13 comments, last by そら 11 years, 11 months ago
Hi,

I've been trying to create a texture as a RenderTarget, and I want to use mipmapping with that texture, so I create it with D3DUSAGE_RENDERTARGET | D3DUSAGE_AUTOGENERATEMIPMAP.

However, doesn't matter if I explicitly tell it to use X number of mipmaps or not, or if I use GenerateMipSubLevels() at some point, it will always have only 1 level.

I haven't found in the Doc's any information that DirectX9 does not support using mipmaps on a RT, however, I have google for any successfull case, and many have the same problem.

The only diference is when people are using XNA, in which case it is possible, but XNA docs state that mipmapping on RT does not work on XB360.. which makes me believe that natively XNA does something to support mipmapping with RT's that it is not supported by default on DX9.

Can anyone confirm this?... why does MSDN docs don't state that this is not possible?..

Thanks!
"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"
Advertisement

However, doesn't matter if I explicitly tell it to use X number of mipmaps or not, or if I use GenerateMipSubLevels() at some point, it will always have only 1 level.
IIRC, you're supposed to explicitly specify 0 mip-maps when using auto-generation. Also, you will have a full-mip chain if you inspect the texture in PIX, but if you query via the API, the object will report that it only has 1 mip-level.
Thanks Hodgman,

Yes, I have specified 0 mip-maps also, with same result.

using tex2dlod() in the pixel shader always returns the same level, and as you mentioned the API always report it has only 1 mip-level.

so, apparently there is no support for mipmaping on RT's using DX9.

but I can't confirm my assumption.

Thanks!
"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"
using tex2dlod() in the pixel shader always returns the same level ... so, apparently there is no support for mipmaping on RT's using DX9
Hmm, that is strange... I have used them before, so it is possible.

Try using PIX to investigate the state of the RT, by capturing a frame from your game.
Also, what kind of GPU are you using? Older ones may not support this feature:
D3DUSAGE_AUTOGENMIPMAP is only a hint ... To check for support for automatic generation of mipmaps, check to see that D3DCAPS2_CANAUTOGENMIPMAP is set. If it is, call CheckDeviceFormat with D3DUSAGE_AUTOGENMIPMAP. If the return value is D3D_OK, the mipmaps are guaranteed to be autogenerated. If the return value is D3DOK_NOAUTOGEN, this means that the create call will succeed, but there won't be any mipmaps generated.[/quote]
Thanks Hodgman,

I have an ATI Radeon HD 5800 GPU (which supports Dx11), so at least the video card is not the problem.

Also, I have checked the return value I get from CheckDeviceFormat(), as the quote you sent... but it returns D3D_OK. :S
"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"
Hi!

Please, read the forum's thread here:
http://forums.create...s/t/102169.aspx
I hope it would be helpful.
Maybe you should use both VS & PS in SM 3.0 for the correct textures interpretation with the LOD.
(but I am not sure, that this is the reason)
Thanks kubera,

I have read the thread you sent, but I'm actually using plain DirectX9 in my application (not DX11 with a lower Feature Level), so in this case both Vertex and Pixel shaders are 3.0... but thanks anyways ;)

Has anyone else had any successful story trying to create a Render Target with Mipmaps?... and if so do you remember what else did you did to achieve that?
"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"
You would ask this question on Microsoft's DirectX forum.
http://forums.create....aspx?GroupID=7

P. S.
It possible to register there without a payment.
One other thing you could check is your sampler state when using [font=courier new,courier,monospace]tex2dlod[/font] - maybe the problem is with [font=courier new,courier,monospace]D3DSAMP_MIPMAPLODBIAS[/font]/etc instead of with the creation of the texture?
Thanks kubera,

Yes, I had already tryied to post a message on MS's forums to get ant response, unfortunateley the page is buggy and when you try to write the post (or send it when you have had luck to write it) errors keep appearing in the page and in the end no message is sent to the forums :(

Good observation Hodgman, I have just checked if the problem was there... however it doesn't seem to be the problem sad.png

looks like right now the only option is to get some confirmation by someone at Microsoft that this is really not possible (and if it is, what is the approriate way to do it)... the application's code is relativeley small so there should not be many weird things happening inside that could make it to miss behave the way it does.

if I get any news about it I will let you know.

Thanks!
"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"

This topic is closed to new replies.

Advertisement