Fix error in cg-glsl-version

This commit is contained in:
rdb 2015-07-05 20:39:34 +02:00
parent 7026854cc2
commit f67ee228bf

View File

@ -1485,15 +1485,14 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps,
ultimate = CG_PROFILE_UNKNOWN;
};
cgGetError();
if (type == ST_fragment && caps._bug_list.count(SBUG_ati_draw_buffers)) {
compiler_args[nargs++] = "-po";
compiler_args[nargs++] = "ATI_draw_buffers";
}
char version_arg[16];
if (!cg_glsl_version.empty() && cgGetProfileProperty((CGprofile) active, CG_IS_GLSL_PROFILE)) {
if (!cg_glsl_version.empty() && active != CG_PROFILE_UNKNOWN &&
cgGetProfileProperty((CGprofile) active, CG_IS_GLSL_PROFILE)) {
snprintf(version_arg, 16, "version=%s", cg_glsl_version.c_str());
compiler_args[nargs++] = "-po";
compiler_args[nargs++] = version_arg;
@ -1501,6 +1500,8 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps,
compiler_args[nargs] = 0;
cgGetError();
if ((active != (int)CG_PROFILE_UNKNOWN) && (active != ultimate)) {
// Print out some debug information about what we're doing.
if (shader_cat.is_debug()) {
@ -1566,6 +1567,11 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps,
return prog;
}
if (shader_cat.is_debug()) {
shader_cat.debug()
<< "Compilation with ultimate profile failed: " << cgGetErrorString(err) << "\n";
}
if (prog != 0) {
cgDestroyProgram(prog);
}