gallium: make image views non-persistent objects
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 9 Jan 2016 00:06:33 +0000 (19:06 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Tue, 16 Feb 2016 03:22:33 +0000 (22:22 -0500)
Make them akin to shader buffers, with no refcounting/etc. Just used to
pass data about the bound image in ->set_shader_images.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/util/u_inlines.h
src/gallium/drivers/ddebug/dd_context.c
src/gallium/drivers/ddebug/dd_pipe.h
src/gallium/drivers/ilo/ilo_state.c
src/gallium/drivers/nouveau/nvc0/nvc0_state.c
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_state.h

index 57a3b0b6082e6b0d7aa6c51ede66a521ac7e8ed8..d0812039292545f8fd7d2263a4ce27986815b98b 100644 (file)
@@ -173,17 +173,6 @@ 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,
                          struct pipe_stream_output_target *target)
index 3ae7764ff3f6bd0b893c72bd5a8aeffde25720ac..9dfaa0af2898419affe5386b9d3cb5770986152a 100644 (file)
@@ -415,30 +415,6 @@ dd_context_sampler_view_destroy(struct pipe_context *_pipe,
    pipe->sampler_view_destroy(pipe, view);
 }
 
-static struct pipe_image_view *
-dd_context_create_image_view(struct pipe_context *_pipe,
-                             struct pipe_resource *resource,
-                             const struct pipe_image_view *templ)
-{
-   struct pipe_context *pipe = dd_context(_pipe)->pipe;
-   struct pipe_image_view *view =
-      pipe->create_image_view(pipe, resource, templ);
-
-   if (!view)
-      return NULL;
-   view->context = _pipe;
-   return view;
-}
-
-static void
-dd_context_image_view_destroy(struct pipe_context *_pipe,
-                              struct pipe_image_view *view)
-{
-   struct pipe_context *pipe = dd_context(_pipe)->pipe;
-
-   pipe->image_view_destroy(pipe, view);
-}
-
 static struct pipe_stream_output_target *
 dd_context_create_stream_output_target(struct pipe_context *_pipe,
                                        struct pipe_resource *res,
@@ -486,7 +462,7 @@ dd_context_set_sampler_views(struct pipe_context *_pipe, unsigned shader,
 static void
 dd_context_set_shader_images(struct pipe_context *_pipe, unsigned shader,
                              unsigned start, unsigned num,
-                             struct pipe_image_view **views)
+                             struct pipe_image_view *views)
 {
    struct dd_context *dctx = dd_context(_pipe);
    struct pipe_context *pipe = dctx->pipe;
@@ -744,8 +720,6 @@ dd_context_create(struct dd_screen *dscreen, struct pipe_context *pipe)
    CTX_INIT(sampler_view_destroy);
    CTX_INIT(create_surface);
    CTX_INIT(surface_destroy);
-   CTX_INIT(create_image_view);
-   CTX_INIT(image_view_destroy);
    CTX_INIT(transfer_map);
    CTX_INIT(transfer_flush_region);
    CTX_INIT(transfer_unmap);
index 80098dcb6444fd0037cbed47fe5447dd586b5bae..c9bbd569abe97d78aad8ab7765ab8067d9e66dbf 100644 (file)
@@ -94,7 +94,7 @@ struct dd_context
    struct pipe_constant_buffer constant_buffers[PIPE_SHADER_TYPES][PIPE_MAX_CONSTANT_BUFFERS];
    struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
    struct dd_state *sampler_states[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
-   struct pipe_image_view *shader_images[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_IMAGES];
+   struct pipe_image_view shader_images[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_IMAGES];
    struct pipe_shader_buffer shader_buffers[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_BUFFERS];
 
    struct dd_state *velems;
index 8dc2d38e039ad19dfa95cc17534064fb5a383f61..f8d2637cc6fe61f2e012279bf87e0a9adcd6a4bf 100644 (file)
@@ -1851,7 +1851,7 @@ ilo_set_sampler_views(struct pipe_context *pipe, unsigned shader,
 static void
 ilo_set_shader_images(struct pipe_context *pipe, unsigned shader,
                       unsigned start, unsigned count,
-                      struct pipe_image_view **views)
+                      struct pipe_image_view *views)
 {
 #if 0
    struct ilo_state_vector *vec = &ilo_context(pipe)->state_vector;
index cd3f1ff18d12fad33fe76527a5a438b43e1d498a..c73664e74a2fa1ac010bf629e362001dc8242736 100644 (file)
@@ -1231,7 +1231,7 @@ nvc0_set_compute_resources(struct pipe_context *pipe,
 static void
 nvc0_set_shader_images(struct pipe_context *pipe, unsigned shader,
                        unsigned start_slot, unsigned count,
-                       struct pipe_image_view **views)
+                       struct pipe_image_view *views)
 {
 }
 
index 78706f7747966aa7c6b8ec37af7350429bd88bdf..ee68fdd6f6f28c753a9428285625286307aeed6c 100644 (file)
@@ -313,14 +313,14 @@ struct pipe_context {
     * \param shader     selects shader stage
     * \param start_slot first image slot to bind.
     * \param count      number of consecutive images to bind.
-    * \param buffers    array of pointers to the images to bind, it
+    * \param buffers    array of the images to bind, it
     *                   should contain at least \a count elements
     *                   unless it's NULL, in which case no images will
     *                   be bound.
     */
    void (*set_shader_images)(struct pipe_context *, unsigned shader,
                              unsigned start_slot, unsigned count,
-                             struct pipe_image_view **images);
+                             struct pipe_image_view *images);
 
    void (*set_vertex_buffers)( struct pipe_context *,
                                unsigned start_slot,
@@ -478,16 +478,6 @@ struct pipe_context {
    void (*surface_destroy)(struct pipe_context *ctx,
                            struct pipe_surface *);
 
-   /**
-    * Create an image view into a buffer or texture to be used with load,
-    * store, and atomic instructions by a shader stage.
-    */
-   struct pipe_image_view * (*create_image_view)(struct pipe_context *ctx,
-                                                 struct pipe_resource *texture,
-                                                 const struct pipe_image_view *templat);
-
-   void (*image_view_destroy)(struct pipe_context *ctx,
-                              struct pipe_image_view *view);
 
    /**
     * Map a resource.
index 5209afe4ad61b50d253294ceac5f80ad9a26dca5..c568c483940d0371608e8195a55d05b2f8fe5560 100644 (file)
@@ -393,14 +393,12 @@ struct pipe_sampler_view
 
 
 /**
- * A view into a writable buffer or texture that can be bound to a shader
+ * A description of a writable buffer or texture that can be bound to a shader
  * stage.
  */
 struct pipe_image_view
 {
-   struct pipe_reference reference;
    struct pipe_resource *resource; /**< resource into which this is a view  */
-   struct pipe_context *context; /**< context this view belongs to */
    enum pipe_format format;      /**< typed PIPE_FORMAT_x */
 
    union {