Sign in to follow this  
ScottH87

DirectX Issue - Runtime crash when drawing begins

Recommended Posts

ScottH87    112
Hi, I've been trying to put together a DX 9 framework over the last week or so in an attempt to re-fresh my memory with using it. Unfortunatly I've seem to have forgotten more than I still remember [oh]. The code compiles with no errors, but during runtime I get a crash at the start of the draw loop:-
	m_cDraw->m_FX->Begin(numPasses, 0);      //Crashes here
	m_cDraw->updateFX(m_matActor, *matWorld, *matView, *matProj);
	m_cDraw->m_FX->BeginPass(0);
	m_cActorPrim->DrawTri(gd3dDevice);
	m_cDraw->m_FX->EndPass();

m_cDraw is an instance of the effect class. At the time of crash the handles to the technique and the WVP matrix in the shader are bad pointers. So I back tracked to where they initially get set and found that they never actually get set.
	//Obtaining handle to an effect
	mhTech = m_FX ->GetTechniqueByName("TransformTech");
	mhWVP = m_FX->GetParameterByName(0, "gWVP");

The method is called, the code is exectued, but they remain bad pointers and I'm not sure why this is. Can anyone help? I'll post more code if its needed.

Share this post


Link to post
Share on other sites
ScottH87    112
The debug runtime crash says:- "Unhandled exception at 0x009f3331 in DXFlockingSteering.exe: 0xC0000005: Access violation reading location 0xfeeefef2."

When I look at the values at the time of crash they just say bad pointer. All the other return values seem to be correct, at least there not bad pointers.

Share this post


Link to post
Share on other sites
Aardvajk    13207
Quote:
Original post by ScottH87
I know its rude to bump your own threads, but I'm still stuck and would really appreciate any suggestions at all


Look at the link Steve posted - he is not referring to the message box that appears when your application crashes, but to the debug spew that VS captures when you have the debug runtime enabled.

This is separate from compiling your application in release or debug mode and needs to be set from the DX control panel, as per the information in Steve's link.

Hopefully this may give a clue as to what is causing the problem. There certainly isn't enough information in your original post for us to be able to tell.

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by Endurion
The Address near 0xfeeefeee indicates you're accessing a deleted object pointer.
Indeed. To expand on that a little - you're using an interface you've Release()d already. Either m_cDraw or m_FX has been released.
You should be setting all your interfaces to null after releasing them, which will make problems like that more easily detectable.

The output from the debug runtimes will tell you if something is failing, which you can use to follow your code and see what's going wrong. It's worth noting that you should be prepared for any single D3D call failing, but especially those which create interfaces or supply other data you rely on (Such as GetDeviceCaps()).

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