#include "tr_state.h"
#include "tr_screen.h"
#include "tr_texture.h"
+#include "tr_winsys.h"
#include "tr_context.h"
struct pipe_context *pipe = tr_ctx->pipe;
boolean result;
+ trace_winsys_user_buffer_update(_pipe->winsys, indexBuffer);
+
trace_dump_call_begin("pipe_context", "draw_elements");
trace_dump_arg(ptr, pipe);
struct pipe_context *pipe = tr_ctx->pipe;
boolean result;
+ trace_winsys_user_buffer_update(_pipe->winsys, indexBuffer);
+
trace_dump_call_begin("pipe_context", "draw_range_elements");
trace_dump_arg(ptr, pipe);
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
+ trace_winsys_user_buffer_update(_pipe->winsys, (struct pipe_buffer *)buffer);
+
trace_dump_call_begin("pipe_context", "set_constant_buffer");
trace_dump_arg(ptr, pipe);
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
+ unsigned i;
+
+ for(i = 0; i < num_buffers; ++i)
+ trace_winsys_user_buffer_update(_pipe->winsys, buffers[i].buffer);
trace_dump_call_begin("pipe_context", "set_vertex_buffers");
trace_dump_call_end();
+ /* XXX: Mark the user buffers. (we should wrap pipe_buffers, but is is
+ * impossible to do so while texture-less surfaces are still around */
+ if(result) {
+ assert(!(result->usage & TRACE_BUFFER_USAGE_USER));
+ result->usage |= TRACE_BUFFER_USAGE_USER;
+ }
+
return result;
}
+void
+trace_winsys_user_buffer_update(struct pipe_winsys *_winsys,
+ struct pipe_buffer *buffer)
+{
+ struct trace_winsys *tr_ws = trace_winsys(_winsys);
+ struct pipe_winsys *winsys = tr_ws->winsys;
+ const void *map;
+
+ if(buffer && buffer->usage & TRACE_BUFFER_USAGE_USER) {
+ map = winsys->buffer_map(winsys, buffer, PIPE_BUFFER_USAGE_CPU_READ);
+ if(map) {
+ trace_dump_call_begin("pipe_winsys", "buffer_write");
+
+ trace_dump_arg(ptr, winsys);
+
+ trace_dump_arg(ptr, buffer);
+
+ trace_dump_arg_begin("data");
+ trace_dump_bytes(map, buffer->size);
+ trace_dump_arg_end();
+
+ trace_dump_arg_begin("size");
+ trace_dump_uint(buffer->size);
+ trace_dump_arg_end();
+
+ trace_dump_call_end();
+
+ winsys->buffer_unmap(winsys, buffer);
+ }
+ }
+}
+
+
static void *
trace_winsys_buffer_map(struct pipe_winsys *_winsys,
struct pipe_buffer *buffer,
#include "pipe/p_winsys.h"
+/**
+ * It often happens that new data is written directly to the user buffers
+ * without mapping/unmapping. This flag marks user buffers, so that their
+ * contents can be dumpped before being used by the pipe context.
+ */
+#define TRACE_BUFFER_USAGE_USER (1 << 31)
+
+
struct hash_table;
trace_winsys_create(struct pipe_winsys *winsys);
+void
+trace_winsys_user_buffer_update(struct pipe_winsys *winsys,
+ struct pipe_buffer *buffer);
+
+
#endif /* TR_WINSYS_H_ */