ddebug: dump shader buffers and images
authorMarek Olšák <marek.olsak@amd.com>
Sat, 10 Sep 2016 08:16:54 +0000 (10:16 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 13 Sep 2016 18:38:25 +0000 (20:38 +0200)
this was unimplemented

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/auxiliary/util/u_dump.h
src/gallium/auxiliary/util/u_dump_state.c
src/gallium/drivers/ddebug/dd_draw.c

index 2598851152b476d43962480b2a47ca22c711b215..bce8517b4e6f88e8150b19e663678518dbc7250d 100644 (file)
@@ -158,6 +158,9 @@ util_dump_surface(FILE *stream,
 void
 util_dump_image_view(FILE *stream, const struct pipe_image_view *state);
 
+void
+util_dump_shader_buffer(FILE *stream, const struct pipe_shader_buffer *state);
+
 void
 util_dump_sampler_view(FILE *stream, const struct pipe_sampler_view *state);
 
index 6aecee1e622dd7b8bf890fa0aaa368c9eda62b53..06d5e788fae26d26372a7621bf032c9bd362571d 100644 (file)
@@ -735,6 +735,25 @@ util_dump_image_view(FILE *stream, const struct pipe_image_view *state)
 }
 
 
+void
+util_dump_shader_buffer(FILE *stream, const struct pipe_shader_buffer *state)
+{
+   if (!state) {
+      util_dump_null(stream);
+      return;
+   }
+
+   util_dump_struct_begin(stream, "pipe_shader_buffer");
+
+   util_dump_member(stream, ptr, state, buffer);
+   util_dump_member(stream, uint, state, buffer_offset);
+   util_dump_member(stream, uint, state, buffer_size);
+
+   util_dump_struct_end(stream);
+
+}
+
+
 void
 util_dump_sampler_view(FILE *stream, const struct pipe_sampler_view *state)
 {
index 3124d0552d0ee4490f020d62ca99134d36c1321b..511daf429d9570eedebc6b5da9677996698eb559 100644 (file)
@@ -313,8 +313,19 @@ dd_dump_draw_vbo(struct dd_draw_state *dstate, struct pipe_draw_info *info, FILE
             DUMP_M(resource, dstate->sampler_views[sh][i], texture);
          }
 
-      /* TODO: print shader images */
-      /* TODO: print shader buffers */
+      for (i = 0; i < PIPE_MAX_SHADER_IMAGES; i++)
+         if (dstate->shader_images[sh][i].resource) {
+            DUMP_I(image_view, &dstate->shader_images[sh][i], i);
+            if (dstate->shader_images[sh][i].resource)
+               DUMP_M(resource, &dstate->shader_images[sh][i], resource);
+         }
+
+      for (i = 0; i < PIPE_MAX_SHADER_BUFFERS; i++)
+         if (dstate->shader_buffers[sh][i].buffer) {
+            DUMP_I(shader_buffer, &dstate->shader_buffers[sh][i], i);
+            if (dstate->shader_buffers[sh][i].buffer)
+               DUMP_M(resource, &dstate->shader_buffers[sh][i], buffer);
+         }
 
       fprintf(f, COLOR_SHADER "end shader: %s" COLOR_RESET "\n\n", shader_str[sh]);
    }
@@ -804,7 +815,20 @@ dd_copy_draw_state(struct dd_draw_state *dst, struct dd_draw_state *src)
          else
             dst->sampler_states[i][j] = NULL;
       }
-      /* TODO: shader buffers & images */
+
+      for (j = 0; j < PIPE_MAX_SHADER_IMAGES; j++) {
+         pipe_resource_reference(&dst->shader_images[i][j].resource,
+                                 src->shader_images[i][j].resource);
+         memcpy(&dst->shader_images[i][j], &src->shader_images[i][j],
+                sizeof(src->shader_images[i][j]));
+      }
+
+      for (j = 0; j < PIPE_MAX_SHADER_BUFFERS; j++) {
+         pipe_resource_reference(&dst->shader_buffers[i][j].buffer,
+                                 src->shader_buffers[i][j].buffer);
+         memcpy(&dst->shader_buffers[i][j], &src->shader_buffers[i][j],
+                sizeof(src->shader_buffers[i][j]));
+      }
    }
 
    if (src->velems)