Jump to content

  • Log In with Google      Sign In   
  • Create Account


D3DXCreateEffectFromFile error?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Vio Lence   Members   -  Reputation: 100

Like
0Likes
Like

Posted 16 January 2012 - 06:09 PM

For some reason I keep getting an error when I try to load an fx file in my Effect class,here is the loader function


HRESULT CFXFileEntity::Load(std::string path)
{
HRESULT hr;

if (FAILED(hr=D3DXCreateEffectFromFile(m_d3dDevice,path.c_str(),NULL,NULL,0,NULL,&anEffect,NULL)))
    return hr;

if (FAILED(hr=anEffect->FindNextValidTechnique(NULL,&hTech)))
    return hr;
}

it doesn't return any hr value(???) and it crashes at this line:

if (FAILED(hr=D3DXCreateEffectFromFile(m_d3dDevice,path.c_str(),NULL,NULL,0,NULL,&anEffect,NULL)))
I've tried different simple fx files,both from RenderMonkey and from FX Composer and it always crashes,debug says the error code is

Unhandled exception at 0x546d1ea8 in GAME.exe: 0xC0000005: Access violation reading location 0xcccccccc.


what could be causing this?

Sponsor:

#2 Adam_42   Crossbones+   -  Reputation: 2467

Like
0Likes
Like

Posted 16 January 2012 - 07:21 PM

I'm guessing m_d3dDevice is equal to 0xcccccccc because CreateDevice() failed.

Enabling the debug runtimes in the control panel that came with the SDK should tell you exactly what's wrong.

#3 Evil Steve   Members   -  Reputation: 1959

Like
0Likes
Like

Posted 17 January 2012 - 04:19 AM

This is why you always initialise your variables. As Adam_42 said, your m_d3dDevice pointer is invalid (Never intitialised). I don't think even the debug runtimes would catch that particular error since it's a hard crash.

The other possibility is that anEffect is the first member of the class and your CFXFileEntity class instance isn't initialised, such as in:
CFXFileEntity* foo;
foo->Load("Thingmy");

Steve Macpherson
Senior programmer, Firebrand Games





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS