dd_context_emit_string_marker(struct pipe_context *_pipe,
const char *string, int len)
{
- struct pipe_context *pipe = dd_context(_pipe)->pipe;
+ struct dd_context *dctx = dd_context(_pipe);
+ struct pipe_context *pipe = dctx->pipe;
pipe->emit_string_marker(pipe, string, len);
+ dd_parse_apitrace_marker(string, len, &dctx->apitrace_call_number);
}
static void
fprintf(f, "Driver vendor: %s\n", screen->get_vendor(screen));
fprintf(f, "Device vendor: %s\n", screen->get_device_vendor(screen));
fprintf(f, "Device name: %s\n\n", screen->get_name(screen));
+
+ if (dctx->apitrace_call_number)
+ fprintf(f, "Last apitrace call: %u\n\n",
+ dctx->apitrace_call_number);
return f;
}
float tess_default_levels[6];
unsigned num_draw_calls;
+ unsigned apitrace_call_number;
};
return f;
}
+static inline void
+dd_parse_apitrace_marker(const char *string, int len, unsigned *call_number)
+{
+ unsigned num;
+ char *s;
+
+ if (len <= 0)
+ return;
+
+ /* Make it zero-terminated. */
+ s = alloca(len + 1);
+ memcpy(s, string, len);
+ s[len] = 0;
+
+ /* Parse the number. */
+ errno = 0;
+ num = strtol(s, NULL, 10);
+ if (errno)
+ return;
+
+ *call_number = num;
+}
+
#endif /* DD_UTIL_H */