trace: add missing set_shader_images()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 5 Apr 2016 17:37:16 +0000 (19:37 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 7 Apr 2016 16:52:27 +0000 (18:52 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_dump_state.c
src/gallium/drivers/trace/tr_dump_state.h

index 57f851833e554609919cec5976dc3c0646556344..08b1d32afb044d92a179bf55f13f54ec0c40bd7a 100644 (file)
@@ -1686,6 +1686,44 @@ static void trace_context_set_shader_buffers(struct pipe_context *_context,
       FREE(_buffers);
 }
 
+static void trace_context_set_shader_images(struct pipe_context *_context,
+                                            unsigned shader,
+                                            unsigned start, unsigned nr,
+                                            struct pipe_image_view *images)
+{
+   struct trace_context *tr_context = trace_context(_context);
+   struct pipe_context *context = tr_context->pipe;
+   struct pipe_image_view *_images = NULL;
+
+   trace_dump_call_begin("pipe_context", "set_shader_images");
+   trace_dump_arg(ptr, context);
+   trace_dump_arg(uint, shader);
+   trace_dump_arg(uint, start);
+   trace_dump_arg_begin("images");
+   trace_dump_struct_array(image_view, images, nr);
+   trace_dump_arg_end();
+   trace_dump_call_end();
+
+   if (images) {
+      int i;
+
+      _images = MALLOC(nr * sizeof(struct pipe_image_view));
+      if (!_images)
+         return;
+
+      for (i = 0; i < nr; i++) {
+         _images[i] = images[i];
+         _images[i].resource = trace_resource_unwrap(tr_context,
+                                                     _images[i].resource);
+      }
+   }
+
+   context->set_shader_images(context, shader, start, nr, _images);
+
+   if (_images)
+      FREE(_images);
+}
+
 static void trace_context_launch_grid(struct pipe_context *_pipe,
                                       const struct pipe_grid_info *info)
 {
@@ -1809,6 +1847,7 @@ trace_context_create(struct trace_screen *tr_scr,
    TR_CTX_INIT(set_tess_state);
    TR_CTX_INIT(set_shader_buffers);
    TR_CTX_INIT(launch_grid);
+   TR_CTX_INIT(set_shader_images);
 
    TR_CTX_INIT(transfer_map);
    TR_CTX_INIT(transfer_unmap);
index e805706f19d4aa113e8a02cb96d58c9c9a64bb71..591ca79a2fa1354f21085347da6c170cd28f8c46 100644 (file)
@@ -740,6 +740,46 @@ void trace_dump_shader_buffer(const struct pipe_shader_buffer *state)
 }
 
 
+void trace_dump_image_view(const struct pipe_image_view *state)
+{
+   if (!trace_dumping_enabled_locked())
+      return;
+
+   if(!state) {
+      trace_dump_null();
+      return;
+   }
+
+   trace_dump_struct_begin("pipe_image_view");
+   trace_dump_member(resource_ptr, state, resource);
+   trace_dump_member(uint, state, format);
+   trace_dump_member(uint, state, access);
+
+   trace_dump_member_begin("u");
+   trace_dump_struct_begin(""); /* anonymous */
+   if (state->resource->target == PIPE_BUFFER) {
+      trace_dump_member_begin("buf");
+      trace_dump_struct_begin(""); /* anonymous */
+      trace_dump_member(uint, &state->u.buf, first_element);
+      trace_dump_member(uint, &state->u.buf, last_element);
+      trace_dump_struct_end(); /* anonymous */
+      trace_dump_member_end(); /* buf */
+   } else {
+      trace_dump_member_begin("tex");
+      trace_dump_struct_begin(""); /* anonymous */
+      trace_dump_member(uint, &state->u.tex, first_layer);
+      trace_dump_member(uint, &state->u.tex, last_layer);
+      trace_dump_member(uint, &state->u.tex, level);
+      trace_dump_struct_end(); /* anonymous */
+      trace_dump_member_end(); /* tex */
+   }
+   trace_dump_struct_end(); /* anonymous */
+   trace_dump_member_end(); /* u */
+
+   trace_dump_struct_end();
+}
+
+
 void trace_dump_draw_info(const struct pipe_draw_info *state)
 {
    if (!trace_dumping_enabled_locked())
index ee0720d8ac898cca0f623e197d7e5c2e5b71e5d3..fd2bc503052b717128e73456a37582d75d1665e4 100644 (file)
@@ -91,4 +91,6 @@ void trace_dump_query_result(unsigned query_type,
 
 void trace_dump_grid_info(const struct pipe_grid_info *state);
 
+void trace_dump_image_view(const struct pipe_image_view *view);
+
 #endif /* TR_STATE_H */