Module: Mesa
Branch: gallium-sampler-view
Commit: 14a146c4995da5074eb1192a818b7a3dfc3bb438
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=14a146c4995da5074eb1192a818b7a3dfc3bb438

Author: Michal Krol <mic...@vmware.com>
Date:   Tue Feb 23 16:09:40 2010 +0100

identity: Fix after sampler view changes.

---

 src/gallium/drivers/identity/id_context.c |   42 +++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/identity/id_context.c 
b/src/gallium/drivers/identity/id_context.c
index 2272f4a..442d851 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -685,6 +685,46 @@ identity_is_buffer_referenced(struct pipe_context *_pipe,
                                      buffer);
 }
 
+static struct pipe_sampler_view *
+identity_create_sampler_view(struct pipe_context *pipe,
+                             struct pipe_texture *texture,
+                             const struct pipe_sampler_view *templ)
+{
+   struct identity_context *id_pipe = identity_context(pipe);
+   struct identity_texture *id_texture = identity_texture(texture);
+   struct pipe_context *pipe_unwrapped = id_pipe->pipe;
+   struct pipe_texture *texture_unwrapped = id_texture->texture;
+   struct identity_sampler_view *view = malloc(sizeof(struct 
identity_sampler_view));
+
+   view->sampler_view = pipe_unwrapped->create_sampler_view(pipe_unwrapped,
+                                                            texture_unwrapped,
+                                                            templ);
+
+   view->base = *templ;
+   view->base.reference.count = 1;
+   view->base.texture = NULL;
+   pipe_texture_reference(&view->base.texture, texture);
+   view->base.context = pipe;
+
+   return &view->base;
+}
+
+static void
+identity_sampler_view_destroy(struct pipe_context *pipe,
+                              struct pipe_sampler_view *view)
+{
+   struct identity_context *id_pipe = identity_context(pipe);
+   struct identity_sampler_view *id_view = identity_sampler_view(view);
+   struct pipe_context *pipe_unwrapped = id_pipe->pipe;
+   struct pipe_sampler_view *view_unwrapped = id_view->sampler_view;
+
+   pipe_unwrapped->sampler_view_destroy(pipe_unwrapped,
+                                        view_unwrapped);
+
+   pipe_texture_reference(&view->texture, NULL);
+   free(view);
+}
+
 struct pipe_context *
 identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
 {
@@ -747,6 +787,8 @@ identity_context_create(struct pipe_screen *_screen, struct 
pipe_context *pipe)
    id_pipe->base.flush = identity_flush;
    id_pipe->base.is_texture_referenced = identity_is_texture_referenced;
    id_pipe->base.is_buffer_referenced = identity_is_buffer_referenced;
+   id_pipe->base.create_sampler_view = identity_create_sampler_view;
+   id_pipe->base.sampler_view_destroy = identity_sampler_view_destroy;
 
    id_pipe->pipe = pipe;
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to