[PATCH 2/3][RFC] Add support for display lists for single frame capture

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Mon Mar 2 04:13:27 PST 2015


Support collecting display lists on single frame capture mode.
I didn't find any way to query display lists after they're
generated thus they're written through as they're created.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 common/trace_writer_local.cpp | 11 +++++++++++
 common/trace_writer_local.hpp |  1 +
 2 files changed, 12 insertions(+)

diff --git a/common/trace_writer_local.cpp b/common/trace_writer_local.cpp
index 475ac47..54d25d3 100644
--- a/common/trace_writer_local.cpp
+++ b/common/trace_writer_local.cpp
@@ -122,6 +122,7 @@ LocalWriter::LocalWriter() :
     if (getenv("APITRACE_SINGLE_FRAME_CAPTURE_MODE") != NULL) {
         singleFrameCaptureMode = true;
         isSwapBufferCall = false;
+        displayListNumber = 0;
         char zerostring[] = "0";
         FILE *fp = fopen(capture_starter_filename, "wa");
         fwrite((void*)zerostring, 1, sizeof(*zerostring), fp);
@@ -242,6 +243,12 @@ unsigned LocalWriter::beginEnter(const FunctionSig *sig, bool fake) {
     forceWriteFlag = false;
     isSwapBufferCall = strcmp(signame, "glXSwapBuffers")==0?true:false;
 
+    if (strcmp(signame, "glGenLists")==0)
+        displayListNumber++;
+
+    if (displayListNumber > 0)
+        forceWriteFlag = true;
+
     if (strncmp(signame, "glX", 3) == 0 &&
             !(isSwapBufferCall&&framesRemainingToCapture < 0)) {
         forceWriteFlag = true;
@@ -332,6 +339,10 @@ void LocalWriter::endLeave(void) {
             framesRemainingToCapture = -1;
         }
     }
+
+    if (forceWriteFlag && strcmp(signame, "glEndList")==0) {
+        displayListNumber--;
+    }
 }
 
 void LocalWriter::flush(void) {
diff --git a/common/trace_writer_local.hpp b/common/trace_writer_local.hpp
index bb5e71d..5f73628 100644
--- a/common/trace_writer_local.hpp
+++ b/common/trace_writer_local.hpp
@@ -84,6 +84,7 @@ namespace trace {
         bool checkSingleFrameCaptureRequest(void);
 
         timespec oldFileModTime;
+        int displayListNumber;
         bool isSwapBufferCall;
         const char* signame;
 
-- 
1.8.5.1



More information about the apitrace mailing list