Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 20 Dec 2012
Offline Last Active Feb 09 2013 04:01 PM

Posts I've Made

In Topic: Errors When Reading CG Source Files

22 December 2012 - 11:34 AM

Yes, the flags used for creating the device include D3D11_CREATE_DEVICE_DEBUG. Also, I did call cgD3D11SetDevice with a valid device polnter before I loaded the shader, so I have no idea what's going on.

In Topic: Errors When Reading CG Source Files

21 December 2012 - 03:49 PM

What is the HRESULT returned by cgD3D11LoadProgram()?

According to the debugger, the value is 0x8876086c, but again, cgGetLastErrorString returns CG_NO_ERROR after cgD3D11LoadProgram. To me, that HRESULT is pretty meaningless, but I don't think cgD3D11LoadProgram() is the issue because according to the debugger the memory address of vs (CGprogram is a pointer type) after returned from cgCreateProgramFromFile is 0x0000000e, which I suspect would not be a valid pointer location.

Edit: sorry for the multiple edits; for some reason my full response wouldn't show up.

In Topic: Errors When Reading CG Source Files

21 December 2012 - 10:29 AM

Yes, 'out' is a reserved keyword, so I changed that in both my vertex shader and fragment shader.  Thanks for that, I feel stupid now.


Now the shader compiles correctly, however:



cgD3D11LoadProgram(vs, flags);
setVertexLayout(vs);  // vs is still null even after being set by cgCreateProgramFromFile, so setVertexLayout causes an Access Violation Exception



What would be causing this?  My log shows that both cgCreateProgramFromFile and cgD3D11LoadProgram were successful (that is, calling cgGetLastErrorString returns CG_NO_ERROR).

In Topic: Errors When Reading CG Source Files

20 December 2012 - 06:59 PM

is it possible that you are confusing the entry point? Just had a look at the wikipedia article, and it looks like CG requires an entry point named main

I tried changing the entry point to main, and I still got the same errors. I was doubtful about such a fix anyway, because if CG required an entry point named 'main' it would be pointless to specify an entry point when loading the shader.