am b798156b: Merge "opengl renderer: added option to dump GL stream to file."
* commit 'b798156bcba72b23eed3c81cf917edff880f23f4': opengl renderer: added option to dump GL stream to file.
This commit is contained in:
@@ -56,6 +56,22 @@ int RenderThread::Main()
|
||||
int stats_totalBytes = 0;
|
||||
long long stats_t0 = GetCurrentTimeMS();
|
||||
|
||||
//
|
||||
// open dump file if RENDER_DUMP_DIR is defined
|
||||
//
|
||||
const char *dump_dir = getenv("RENDERER_DUMP_DIR");
|
||||
FILE *dumpFP = NULL;
|
||||
if (dump_dir) {
|
||||
size_t bsize = strlen(dump_dir) + 32;
|
||||
char *fname = new char[bsize];
|
||||
snprintf(fname,bsize,"%s/stream_%p", dump_dir, this);
|
||||
dumpFP = fopen(fname, "wb");
|
||||
if (!dumpFP) {
|
||||
fprintf(stderr,"Warning: stream dump failed to open file %s\n",fname);
|
||||
}
|
||||
delete [] fname;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
||||
int stat = readBuf.getData();
|
||||
@@ -76,6 +92,15 @@ int RenderThread::Main()
|
||||
stats_t0 = GetCurrentTimeMS();
|
||||
}
|
||||
|
||||
//
|
||||
// dump stream to file if needed
|
||||
//
|
||||
if (dumpFP) {
|
||||
int skip = readBuf.validData() - stat;
|
||||
fwrite(readBuf.buf()+skip, 1, readBuf.validData()-skip, dumpFP);
|
||||
fflush(dumpFP);
|
||||
}
|
||||
|
||||
bool progress;
|
||||
do {
|
||||
progress = false;
|
||||
@@ -112,5 +137,9 @@ int RenderThread::Main()
|
||||
|
||||
}
|
||||
|
||||
if (dumpFP) {
|
||||
fclose(dumpFP);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user