Skip to main content
GameDev.net gamedev.net
🔒 Locked

SetSampmlerState mipmapping error

Started by GambitSnax Jun 5, 2006 at 12:19 AM 1 replies 1.3k views
Original Post
GambitSnax
GambitSnax
I've been playing around with mipmapping in Directx9 and get some strange errors. When I call to turn mipmapping off

		g_pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_NONE);
		g_pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_NONE);

... I get these Direct3D errors - Direct3D9: (ERROR) :Unsupported mag filter. Direct3D9: (ERROR) :Invalid texture sampler state value. SetSamplerState failed. First-chance exception at 0x7c81eb33 in mipmapping.exe: Microsoft C++ exception: long @ 0x0012fa70. Direct3D9: (ERROR) :SetSamplerState failed. I get the same error messages when I call to turn anisotropic mipmapping on

g_pD3DDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_ANISOTROPIC);

I have lots of other similar SetSamplerState calls in my program but these are the only ones that produce errors. Could someone explain what these errors mean and how I might fix them? Cheers
Cypher19
Cypher19
Iirc, I think that the API just doesn't like those texture filtering combinations. For Mag/min filters, you get point (nearest point filtering), linear, and anisotropic filtering. For mip filters, you get none (only the highest mipmap is used; looks like crap due to aliasing), point (no filtering across mipmap's) and linear (filtering across mipmaps). If you ignore those errors, the API just retranslates them to point filtering on the first pair, and linear filtering on the mip filter.
GambitSnax
GambitSnax
Thanks for the reply.

If I am changing readily between different types of mipmapping, should I then set the D3DSAMP_MIPFILTER when I am turning mipmapping off to D3DTEXF_POINT to avoid the error, or will directx do this for me automatically (and thus should I leave the call out all together?)

Same with ANISTROPIC mipmapping, do I just need to set D3DSAMP_MAGFILTER and D3DSAMP_MINFILTER to D3DTEXF_ANISOTROPIC and leave D3DSAMP_MIPFILTER, or should I set it to D3DTEXF_LINEAR?

Thanks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.