Jump to content
  • Advertisement
Sign in to follow this  
jdub

Program fails with access violation while trying to compile shader

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

This is really tripping me up as I can't seem to figure out what could be wrong with this piece of code:

ID3DBlob *vShaderCode = NULL;
ID3DBlob *pShaderCode = NULL;
ID3DBlob *errorCode = NULL;

		if(FAILED(D3DCompileFromFile(GetFilePath(L"nbody_simulation\\VSPointSprite.hlsl").data(), NULL, NULL, NULL, "vs_5_0", flags1, 0, &vShaderCode, &errorCode)))
		{
			SafeRelease<ID3DBlob>(&vShaderCode);	
			if(errorCode)
			{
				OutputDebugStringA((LPCSTR)errorCode->GetBufferPointer());
				SafeRelease<ID3DBlob>(&errorCode);
			}

			return false;
		}


...
... Implementation of GetFilePath() in separate header file

const std::wstring appPath = L"C:\\Users\\Jared\\Documents\\Visual Studio 2012\\Projects\\nbody_simulation\\";

inline std::wstring GetFilePath(const std::wstring &fileName)
{
	std::wstring tmp = std::wstring(appPath.data());
	return tmp.append(fileName.data());
}
 

I get the following error on the line where I call D3DCompileFromFile():  Unhandled exception at 0x54469A72 (D3Dcompiler_46.dll) in nbody_simulation.exe: 0xC0000005: Access violation writing location 0x00000018.

 

Any ideas?

Edited by jdub

Share this post


Link to post
Share on other sites
Advertisement

Have you tried the code to compile a known good shader?  Do you suspect that your usage of the function is incorrect, or that one of your arguments isn't initialized, or possibly that your GetFilePath method isn't returning what it should be?

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!