mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
Fix bug with not showing compiler errors when custom profile is selected
This commit is contained in:
parent
58b1d67a92
commit
10ab4cc8b9
@ -1056,11 +1056,22 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps, bool fshader)
|
|||||||
if (override != (int)CG_PROFILE_UNKNOWN) {
|
if (override != (int)CG_PROFILE_UNKNOWN) {
|
||||||
prog = cgCreateProgram(_cg_context, CG_SOURCE, _text.c_str(),
|
prog = cgCreateProgram(_cg_context, CG_SOURCE, _text.c_str(),
|
||||||
(CGprofile)override, entry, (const char **)compiler_args);
|
(CGprofile)override, entry, (const char **)compiler_args);
|
||||||
if (cgGetError() == CG_NO_ERROR) {
|
err = cgGetError();
|
||||||
|
if (err == CG_NO_ERROR) {
|
||||||
return prog;
|
return prog;
|
||||||
}
|
}
|
||||||
if (prog != 0) {
|
if (err == CG_COMPILER_ERROR) {
|
||||||
cgDestroyProgram(prog);
|
string listing = cgGetLastListing(_cg_context);
|
||||||
|
vector_string errlines;
|
||||||
|
tokenize(listing, errlines, "\n");
|
||||||
|
for (int i=0; i<(int)errlines.size(); i++) {
|
||||||
|
string line = trim(errlines[i]);
|
||||||
|
if (line != "") {
|
||||||
|
gobj_cat.error() << get_filename() << ": " << errlines[i] << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
gobj_cat.error() << get_filename() << ": " << cgGetErrorString(err) << "\n";
|
||||||
}
|
}
|
||||||
if (fshader) {
|
if (fshader) {
|
||||||
gobj_cat.error() << "Fragment shader failed to compile with profile '"
|
gobj_cat.error() << "Fragment shader failed to compile with profile '"
|
||||||
@ -1069,6 +1080,9 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps, bool fshader)
|
|||||||
gobj_cat.error() << "Vertex shader failed to compile with profile '"
|
gobj_cat.error() << "Vertex shader failed to compile with profile '"
|
||||||
<< cgGetProfileString((CGprofile)override) << "'!\n";
|
<< cgGetProfileString((CGprofile)override) << "'!\n";
|
||||||
}
|
}
|
||||||
|
if (prog != 0) {
|
||||||
|
cgDestroyProgram(prog);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user