Add debug code to print out shader asm code in debug mode.

Check for errors when the Cg generated shader code is loaded.
This commit is contained in:
aignacio_sf 2006-06-16 22:58:35 +00:00
parent facb0ed528
commit e32b6c08c4

View File

@ -276,6 +276,18 @@ try_cg_compile(ShaderExpansion *s, GSG *gsg)
return false;
}
// DEBUG: output the generated program
if (GLCAT.is_debug()) {
const char *vertex_program;
const char *pixel_program;
vertex_program = cgGetProgramString (_cg_program[0], CG_COMPILED_PROGRAM);
pixel_program = cgGetProgramString (_cg_program[1], CG_COMPILED_PROGRAM);
GLCAT.debug() << vertex_program << "\n";
GLCAT.debug() << pixel_program << "\n";
}
// The following code is present to work around a bug in the Cg compiler.
// It does not generate correct code for shadow map lookups when using arbfp1.
// This is a particularly onerous limitation, given that arbfp1 is the only
@ -350,7 +362,9 @@ try_cg_compile(ShaderExpansion *s, GSG *gsg)
}
cgGLLoadProgram(_cg_program[SHADER_type_vert]);
report_cg_compile_errors(s->get_name(), _cg_context);
cgGLLoadProgram(_cg_program[SHADER_type_frag]);
report_cg_compile_errors(s->get_name(), _cg_context);
_state = true;