Jump to content
  • Advertisement
Sign in to follow this  
D3DXVECTOR3

Need help with D3DXCreateEffectFromFile [SOLVED]

This topic is 4844 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

Im having a strange situation. A week ago reinstalled my PC and installed the April SDK. Befor that I used the Februari SDK. Now i, having some strange errors/problems. I did change a few things in the code but its not much.
LPD3DXBUFFER l_d3dBuffer;

file is type std::string and has a valid path to the effect. the effect is not compiled (i have always used it for quick editing) "loading.fx"

// Create the effect
if FAILED(D3DXCreateEffectFromFile(pd3dDevice, file.c_str(), NULL, NULL, 0, NULL, &m_pd3dEffect, &l_d3dBuffer))
{
	// Show Error message
	MessageBox(NULL, (const char *)l_d3dBuffer->GetBufferPointer(), "Critical Failure", MB_OK);

}


D3DXCreateEffectFromFile fails and d3dBuffer is NULL(0x00000000) so I cant even see what the error message is. The program crashes at MessageBox(); [SOLVED] I dont know how/when/why but the "Working directory" was set to default and i use an <MyProject>\OutPut\.. [Edited by - D3DXVECTOR3 on August 10, 2005 6:10:49 PM]

Share this post


Link to post
Share on other sites
Advertisement
HRESULT returns D3DXERR_INVALIDDATA.

edit: btw im using Visual Studio 2003 with Windows 2000, but I already tested it on a machine with Windows XP and it had no effect same result.

[Edited by - D3DXVECTOR3 on August 9, 2005 6:18:14 PM]

Share this post


Link to post
Share on other sites
Since it's returning INVALIDDATA I would assume that your effect file is invalid - does your effect compile without errors in EffectEdit (comes with the DX SDK)?

Though I thought usually it would return the errors in your l_d3dBuffer buffer :S

I use Managed DirectX, but I'll take a guess at maybe having to intialize your buffer before passing it in?

As for the crash at your message box, you probably need to check whether l_d3dBuffer is non-null before trying to get it's pointer.

Hope that helped...

Share this post


Link to post
Share on other sites
OOo sorry, you said it worked with the Feb SDK so your effect file is probably fine...but I remember that in Managed DirectX when I moved from the Feb SDK to April, a new parameter called skipConstants was added to the Effect constructor. So the parameters to the function you're using might have changed so you might be using the wrong overload now..maybe..

Share this post


Link to post
Share on other sites
^^ That could be it. FX Composer and EffectEdit compiles the effect file with no problems.

This is what the current SKD shows:
HRESULT WINAPI D3DXCreateEffectFromFile(
LPDIRECT3DDEVICE9 pDevice,
LPCTSTR pSrcFile,
const D3DXMACRO *pDefines,
LPD3DXINCLUDE pInclude,
DWORD Flags,
LPD3DXEFFECTPOOL pPool,
LPD3DXEFFECT *ppEffect,
LPD3DXBUFFER *ppCompilationErrors
);

Anyone have the definition from the feb SDK!?

Share this post


Link to post
Share on other sites
I think I have found the problem. I should have seen this. Yesterday I noticed that my logger didnt work anymore while I didnt change anything in it. When I was about to rip my hairs from my head I noticed that all my file IO didnt work. So looks like a folder/user security issue. There is nothing wrong with my code.

Edit:

Nope that was not it. i think im gonna have to try the old SDK

[Edited by - D3DXVECTOR3 on August 10, 2005 6:05:00 PM]

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!