extern void DebugEventCallback(char const * module, int count, ...) { SYSTEMTIME st; va_list ap; int i,value; char * name; char function[MAX_LINE_LEN]; if (!(d2gsconf.debugeventcallback)) return; GetLocalTime(&st); D2GSEventLog("DebugEventCallback","Event Called From Module \"%s\"",module); fprintf(hexstrm,"%d: Checking Module \"%s\" (%d)\tTime:%d.%d.%d.%d\n",\ gdwTotalCount++,module,count,st.wHour,st.wMinute,\ st.wSecond,st.wMilliseconds); sprintf (function,"%s(",module); va_start(ap,count); for (i=0; i<count; i++) { name=va_arg(ap, char *); value=va_arg(ap, int); strcat(function,name); if (i != count-1) strcat(function,", "); DebugDumpParam(name,value); } va_end(ap); strcat(function,")"); fprintf(hexstrm,"Function: %s\n",function); fprintf(hexstrm,"\n\n"); fflush(hexstrm); return; }
void csShaderGLCGCommon::DoDebugDump () { csString output; DumpProgramInfo (output); output << "CG program type: " << programType << "\n"; output << "CG profile: " << cgGetProgramString (program, CG_PROGRAM_PROFILE) << "\n"; output << "CG entry point: " << (entrypoint ? entrypoint : "main") << "\n"; output << "CG program valid: " << IsValid() << "\n"; output << "\n"; output << "Variable mappings:\n"; for (size_t v = 0; v < variablemap.GetSize (); v++) { const VariableMapEntry& vme = variablemap[v]; ShaderParameter* sparam = reinterpret_cast<ShaderParameter*> (vme.userVal); output << stringsSvName->Request (vme.name); output << '(' << vme.name << ") -> "; output << vme.destination << ' '; if (sparam == 0) { output << "(null)"; } else { if (sparam->paramType != 0) output << cgGetTypeString (sparam->paramType) << ' '; if (sparam->param != 0) output << cgGetParameterName (sparam->param) << " "; output << "baseslot " << sparam->baseSlot; if (sparam->assumeConstant) output << " assumed constant"; } output << '\n'; } output << "\n"; output << "Program leaf parameters:\n"; CGparameter param = cgGetFirstLeafParameter (program, CG_PROGRAM); while (param) { DebugDumpParam (output, param); param = cgGetNextLeafParameter (param); } output << "\n"; output << "Program global parameters:\n"; param = cgGetFirstLeafParameter (program, CG_GLOBAL); while (param) { DebugDumpParam (output, param); param = cgGetNextLeafParameter (param); } output << "\n"; output << "Program source:\n"; output << cgGetProgramString (program, CG_PROGRAM_SOURCE); output << "\n"; output << "Compiled program:\n"; output << cgGetProgramString (program, CG_COMPILED_PROGRAM); output << "\n"; csRef<iVFS> vfs = csQueryRegistry<iVFS> (objectReg); EnsureDumpFile(); csRef<iFile> debugFile = vfs->Open (debugFN, VFS_FILE_APPEND); if (!debugFile) { csReport (objectReg, CS_REPORTER_SEVERITY_WARNING, "crystalspace.graphics3d.shader.glcg", "Could not write %s", CS::Quote::Single (debugFN.GetData())); } else { debugFile->Write (output.GetData(), output.Length ()); csReport (objectReg, CS_REPORTER_SEVERITY_NOTIFY, "crystalspace.graphics3d.shader.glcg", "Dumped Cg program info to %s", CS::Quote::Single (debugFN.GetData())); } }