summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_debug_describe.c9
-rw-r--r--src/gallium/auxiliary/util/u_debug_describe.h2
-rw-r--r--src/gallium/auxiliary/util/u_dump.h3
-rw-r--r--src/gallium/auxiliary/util/u_dump_state.c27
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h10
5 files changed, 51 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_debug_describe.c b/src/gallium/auxiliary/util/u_debug_describe.c
index df73ed83ef6..f428d22d205 100644
--- a/src/gallium/auxiliary/util/u_debug_describe.c
+++ b/src/gallium/auxiliary/util/u_debug_describe.c
@@ -81,6 +81,15 @@ debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr)
}
void
+debug_describe_image_view(char* buf, const struct pipe_image_view *ptr)
+{
+ char res[128];
+ debug_describe_resource(res, ptr->resource);
+ util_sprintf(buf, "pipe_image_view<%s,%s>", res,
+ util_format_short_name(ptr->format));
+}
+
+void
debug_describe_so_target(char* buf,
const struct pipe_stream_output_target *ptr)
{
diff --git a/src/gallium/auxiliary/util/u_debug_describe.h b/src/gallium/auxiliary/util/u_debug_describe.h
index 4f7882b0b37..2172ecb4395 100644
--- a/src/gallium/auxiliary/util/u_debug_describe.h
+++ b/src/gallium/auxiliary/util/u_debug_describe.h
@@ -35,12 +35,14 @@ struct pipe_reference;
struct pipe_resource;
struct pipe_surface;
struct pipe_sampler_view;
+struct pipe_image_view;
/* a 256-byte buffer is necessary and sufficient */
void debug_describe_reference(char* buf, const struct pipe_reference*ptr);
void debug_describe_resource(char* buf, const struct pipe_resource *ptr);
void debug_describe_surface(char* buf, const struct pipe_surface *ptr);
void debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr);
+void debug_describe_image_view(char* buf, const struct pipe_image_view *ptr);
void debug_describe_so_target(char* buf,
const struct pipe_stream_output_target *ptr);
diff --git a/src/gallium/auxiliary/util/u_dump.h b/src/gallium/auxiliary/util/u_dump.h
index 58e7dfd8244..3ddf518fa2b 100644
--- a/src/gallium/auxiliary/util/u_dump.h
+++ b/src/gallium/auxiliary/util/u_dump.h
@@ -154,6 +154,9 @@ util_dump_surface(FILE *stream,
const struct pipe_surface *state);
void
+util_dump_image_view(FILE *stream, const struct pipe_image_view *state);
+
+void
util_dump_transfer(FILE *stream,
const struct pipe_transfer *state);
diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index 7f620b50cf0..88027cbbc79 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -672,6 +672,33 @@ util_dump_surface(FILE *stream, const struct pipe_surface *state)
void
+util_dump_image_view(FILE *stream, const struct pipe_image_view *state)
+{
+ if (!state) {
+ util_dump_null(stream);
+ return;
+ }
+
+ util_dump_struct_begin(stream, "pipe_image_view");
+
+ util_dump_member(stream, ptr, state, resource);
+ util_dump_member(stream, format, state, format);
+
+ if (state->resource->target == PIPE_BUFFER) {
+ util_dump_member(stream, uint, state, u.buf.first_element);
+ util_dump_member(stream, uint, state, u.buf.last_element);
+ }
+ else {
+ util_dump_member(stream, uint, state, u.tex.first_layer);
+ util_dump_member(stream, uint, state, u.tex.last_layer);
+ util_dump_member(stream, uint, state, u.tex.level);
+ }
+
+ util_dump_struct_end(stream);
+}
+
+
+void
util_dump_transfer(FILE *stream, const struct pipe_transfer *state)
{
if(!state) {
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 95401621ec3..661a949a4b1 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -173,6 +173,16 @@ pipe_sampler_view_release(struct pipe_context *ctx,
*ptr = NULL;
}
+static INLINE void
+pipe_image_view_reference(struct pipe_image_view **ptr, struct pipe_image_view *view)
+{
+ struct pipe_image_view *old_view = *ptr;
+
+ if (pipe_reference_described(&(*ptr)->reference, &view->reference,
+ (debug_reference_descriptor)debug_describe_image_view))
+ old_view->context->image_view_destroy(old_view->context, old_view);
+ *ptr = view;
+}
static INLINE void
pipe_so_target_reference(struct pipe_stream_output_target **ptr,