Merge branch '7.8'
[mesa.git] / src / gallium / drivers / i965 / brw_pipe_sampler.c
index fe1d18ae7736dce33c7219bdfc5f129e218d7bb0..3fe753ec42c44a4d8cadbc8fd3cb948af44b7e4a 100644 (file)
@@ -214,17 +214,18 @@ static void brw_bind_vertex_sampler_state(struct pipe_context *pipe,
 
 static struct pipe_sampler_view *
 brw_create_sampler_view(struct pipe_context *pipe,
-                        struct pipe_texture *texture,
+                        struct pipe_resource *texture,
                         const struct pipe_sampler_view *templ)
 {
-   struct brw_context *brw = brw_context(pipe);
    struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
 
-   *view = *templ;
-   view->reference.count = 1;
-   view->texture = NULL;
-   pipe_texture_reference(&view->texture, texture);
-   view->context = pipe;
+   if (view) {
+      *view = *templ;
+      view->reference.count = 1;
+      view->texture = NULL;
+      pipe_resource_reference(&view->texture, texture);
+      view->context = pipe;
+   }
 
    return view;
 }
@@ -234,7 +235,7 @@ static void
 brw_sampler_view_destroy(struct pipe_context *pipe,
                          struct pipe_sampler_view *view)
 {
-   pipe_texture_reference(&view->texture, NULL);
+   pipe_resource_reference(&view->texture, NULL);
    FREE(view);
 }