开发者

How do I get a Compile error from NVIDIA CG?

开发者 https://www.devze.com 2023-03-13 17:59 出处:网络
How do I get detailed errors from a cg compile? At the moment my code is something like: prog = cgCreateProgramFromFile(

How do I get detailed errors from a cg compile?

At the moment my code is something like:

prog = cgCreateProgramFromFile(
  开发者_运维技巧  context,
    CG_SOURCE,
    filename,
    proifile,
    null,null);
std::cout << cgGetErrorString(cgGetError());

But all I get is "The compile returned an error."

Is there any way to get a more involved error message, like glGetShaderiv with GL_COMPILE_STATUS for opengl shaders?

Can't find anything in the reference but is seems like a fairly basic requirement.

I am running cgc on the shaders first with no code generation to check for errors but that doesn't catch everything.

Thanks.


In the case of a compile error, you must use cgGetLastListing(CGcontext) instead of cgGetError(void).

From the Cg documentation for cgGetLastListing(CGcontext):

Each Cg context maintains a NULL-terminated string containing warning and error messages generated by the Cg compiler, state managers and the like. cgGetLastListing allows applications and custom state managers to query the listing text.

cgGetLastListing returns the currrent listing string for the given CGcontext. When a Cg runtime error occurs, applications can use the listing text from the appropriate context to provide the user with detailed information about the error.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号