]> git.cworth.org Git - apitrace/blobdiff - common/trace_model.hpp
Introduce call flags.
[apitrace] / common / trace_model.hpp
index 61ff4a6be49acabf99be57ca0a7550d3dfa5b140..f208032d371eeb1e38d4704c07dc342203b88931 100644 (file)
@@ -339,6 +339,83 @@ inline std::ostream & operator <<(std::ostream &os, Value *value) {
 }
 
 
+typedef unsigned CallFlags;
+
+/**
+ * Call flags.
+ *
+ * TODO: It might be better to to record some of these (but not all) into the
+ * trace file.
+ */
+enum {
+
+    /**
+     * Whether a call was really done by the application or not.
+     *
+     * This flag is set for fake calls -- calls not truly done by the application
+     * but emitted and recorded for completeness, to provide contextual information
+     * necessary for retracing, that would not be available through other ways.
+     *
+     * XXX: This one definetely needs to go into the trace file.
+     */
+    CALL_FLAG_FAKE                      = (1 << 0),
+
+    /**
+     * Whether this call should be retraced or ignored.
+     *
+     * This flag is set for calls which can't be safely replayed (due to incomplete
+     * information) or that have no sideffects.
+     *
+     * Some incomplete calls are unreproduceable, but not all.
+     */
+    CALL_FLAG_NON_REPRODUCIBLE         = (1 << 1),
+    
+    /**
+     * Whether this call has no side-effects, therefore don't need to be
+     * retraced.
+     *
+     * This flag is set for calls that merely query information which is not
+     * needed for posterior calls.
+     */
+    CALL_FLAG_NO_SIDE_EFFECTS            = (1 << 2),
+
+    /**
+     * Whether this call renders into the bound rendertargets.
+     */
+    CALL_FLAG_RENDER                    = (1 << 3),
+
+    /**
+     * Whether this call causes render target to be swapped.
+     *
+     * This does not mark frame termination by itself -- that's solely the
+     * responsibility of `endOfFrame` bit. 
+     *
+     * This mean that snapshots should be take prior to the call, and not
+     * after.
+     */
+    CALL_FLAG_SWAP_RENDERTARGET         = (1 << 4),
+        
+    /**
+     * Whether this call terminates a frame.
+     *
+     * XXX: This can't always be determined by the function name, so it should also
+     * go into the trace file eventually.
+     */
+    CALL_FLAG_END_FRAME                 = (1 << 5),
+
+    /**
+     * Whether this call is incomplete, i.e., it never returned.
+     */
+    CALL_FLAG_INCOMPLETE                = (1 << 6),
+
+    /**
+     * Whether this call is verbose (i.e., not usually interesting).
+     */
+    CALL_FLAG_VERBOSE                  = (1 << 7),
+};
+
+
+
 class Call
 {
 public:
@@ -347,7 +424,15 @@ public:
     std::vector<Value *> args;
     Value *ret;
 
-    Call(FunctionSig *_sig) : sig(_sig), args(_sig->num_args), ret(0) { }
+    CallFlags flags;
+
+    Call(FunctionSig *_sig, const CallFlags &_flags) :
+        sig(_sig), 
+        args(_sig->num_args), 
+        ret(0),
+        flags(_flags) {
+    }
+
     ~Call();
 
     inline const char * name(void) const {