Jump to content
  • Advertisement
Sign in to follow this  
Graham

Exception thrown in D3DXCreateTextureFromFileEx()

This topic is 4797 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am getting an exception thrown in D3DXCreateTextureFromFileEx how do I found out what the exact error is. hRet is not equal to any of the possible error returns for D3DXCreateTextureFromFileEx(). According to my debug file it is -858993460.
	
HRESULT hRet;
	m_width = 256;
	m_height = 256;

	try
	{
	hRet = D3DXCreateTextureFromFileEx( Graphics.m_pd3dDevice,
                                 "Terrain/ball.bmp",
                                 m_width, //D3DX_DEFAULT, // I had to set width manually. D3DPOOL_DEFAULT works for textures but causes problems for D3DXSPRITE.
                                 m_height, //D3DX_DEFAULT, // I had to set height manually. D3DPOOL_DEFAULT works for textures but causes problems for D3DXSPRITE.
                                 1,   // Don't create mip-maps when you plan on using D3DXSPRITE. It throws off the pixel math for sprite animation.
                                 D3DUSAGE_DYNAMIC, // usage
                                 D3DFMT_R8G8B8, //D3DFMT_UNKNOWN, // format
                                 D3DPOOL_DEFAULT, // pool
                                 D3DX_DEFAULT, // filter
                                 D3DX_DEFAULT, // mipfilter
                                 D3DCOLOR_COLORVALUE(0.0f,0.0f,0.0f,1.0f), //colorkey
                                 NULL, // sourceinfo
                                 NULL, // pallete
                                 &m_pTex );

	}
	catch(...)
	{
		debug << "Exception" << endl;
	}

	if(FAILED(hRet))
	{
		debug << "Create surface failed: " << hRet << endl;
		if(hRet == D3DERR_OUTOFVIDEOMEMORY)
		{
			debug << "D3DERR_OUTOFVIDEOMEMORY" << endl;
		}
		if(hRet == D3DERR_INVALIDCALL)
		{
			debug << "D3DERR_INVALIDCALL" << endl;
		}
		if(hRet == D3DERR_NOTAVAILABLE)
		{
			debug << "D3DERR_NOTAVAILABLE" << endl;
		}
		if(hRet == D3DXERR_INVALIDDATA)
		{
			debug << "D3DXERR_INVALIDDATA" << endl;
		}
		if(hRet == E_OUTOFMEMORY)
		{
			debug << "E_OUTOFMEMORY" << endl;
		}
	}

Share this post


Link to post
Share on other sites
Advertisement
There isn't anything obviously wrong with your code.

Read NeXe: Debugging, the debug runtimes'll probably tell you exactly what you're doing wrong.

9-times-out-of-10 problems with D3DXCreateTextureFromFileEx( ) are due to bad parameters. Check all of them, again. Common pitfalls are a bad location for a file or a bad texture format.

hth
Jack

Share this post


Link to post
Share on other sites
When I switched to REF device the exception was no longer thrown. It seems I need a new driver for my Nvidia Vanta but I cant find any. Thanks.

Share this post


Link to post
Share on other sites
I tried the latest detonators but the installation failed because it could not find a driver for my card. I will try downloading v66.93

Share this post


Link to post
Share on other sites
Quote:
Original post by Graham
When I switched to REF device the exception was no longer thrown. It seems I need a new driver for my Nvidia Vanta but I cant find any. Thanks.

Right, well this indicates a hardware support problem.

Thing is... for good code you should be enumerating all the features you use. We're all lazy, I'm lazy, but it might well be that one of the params you're passing in violates an obvious enumeration.

The problem you might find is that updated drivers might not actually change anything if it's actually a hardware (as opposed to software emulation) problem. It might well be that if you're intending to target the Nvidia Vanta that you'll need to build in a specific path/check so as to remain compatability.

Quote:
Original post by Dave Hunt
What version do you have? The latest released nVidia drivers with Vanta support is 66.93.

Am I mistaken in believing the Vanta was back in the TNT/TNT2 days?

If so, you're going to go through a fair bit of pain for all but the most trivial D3D8/D3D9 applications [sad]. Drivers might help, but they probably can't work magic (despite the benchmarks!)

hth
Jack

Share this post


Link to post
Share on other sites
My main developement comp has a 4600 but I like to do some stuff when I'm at work which is a Vanta. The updated driver did stop the exception but has caused severe problems with my terrain rendering. It look like every 3rd triangle strip is not rendered but when you approach the terrain they start filling in. Drawprimitive is getting no errors.
When I go to the control panel and switch the the debug runtimes for direct3D then none of the terrain is rendered and I get an error on all the drawprimitives, but other things are still drawn like my skybox.
http://www.tc.umn.edu/~hupp0016/terrain%20error.JPG
http://www.tc.umn.edu/~hupp0016/terrain%20error%20wire.JPG

Share this post


Link to post
Share on other sites
If it doesn't happen on the REF device chances are you're exceeding the caps of your card, maybe with regards to index buffer sizes or max primitives per draw call. Or, it's a driver bug and Nvidia is long past supporting your card. Or, the old driver had a bug in it which you compensated for and which they've since corrected.

What are the debug runtime's errors?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!