opengl renderer: added option to dump GL stream to file.
This is a debugging tool which enables to dump the guest command stream to a file which can be later be examined and "played" using a seperate tool. Change-Id: I3fec19c1a651f0ed4394c33a0c0cd9ba54384355
This commit is contained in:
@@ -56,6 +56,22 @@ int RenderThread::Main()
|
|||||||
int stats_totalBytes = 0;
|
int stats_totalBytes = 0;
|
||||||
long long stats_t0 = GetCurrentTimeMS();
|
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) {
|
while (1) {
|
||||||
|
|
||||||
int stat = readBuf.getData();
|
int stat = readBuf.getData();
|
||||||
@@ -76,6 +92,15 @@ int RenderThread::Main()
|
|||||||
stats_t0 = GetCurrentTimeMS();
|
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;
|
bool progress;
|
||||||
do {
|
do {
|
||||||
progress = false;
|
progress = false;
|
||||||
@@ -112,5 +137,9 @@ int RenderThread::Main()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dumpFP) {
|
||||||
|
fclose(dumpFP);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user