Squashed commit of the following:
[mesa.git] / src / gallium / drivers / svga / svga_pipe_sampler.c
index 268781773081cc488d7016deefd1de45f677edd2..f44a0e1325a1e9ea2b88a343c2c9acb9b9023a33 100644 (file)
@@ -30,7 +30,7 @@
 #include "tgsi/tgsi_parse.h"
 
 #include "svga_context.h"
-#include "svga_screen_texture.h"
+#include "svga_resource_texture.h"
 
 #include "svga_debug.h"
 
@@ -155,7 +155,7 @@ static void svga_bind_sampler_states(struct pipe_context *pipe,
    /* Check for no-op */
    if (num == svga->curr.num_samplers &&
        !memcmp(svga->curr.sampler, sampler, num * sizeof(void *))) {
-      debug_printf("sampler noop\n");
+      if (0) debug_printf("sampler noop\n");
       return;
    }
 
@@ -178,17 +178,18 @@ static void svga_delete_sampler_state(struct pipe_context *pipe,
 
 static struct pipe_sampler_view *
 svga_create_sampler_view(struct pipe_context *pipe,
-                         struct pipe_texture *texture,
+                         struct pipe_resource *texture,
                          const struct pipe_sampler_view *templ)
 {
-   struct svga_context *softpipe = svga_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;
 }
@@ -198,9 +199,7 @@ static void
 svga_sampler_view_destroy(struct pipe_context *pipe,
                           struct pipe_sampler_view *view)
 {
-   struct svga_context *svga = svga_context(pipe);
-
-   pipe_texture_reference(&view->texture, NULL);
+   pipe_resource_reference(&view->texture, NULL);
    FREE(view);
 }
 
@@ -229,7 +228,7 @@ static void svga_set_sampler_views(struct pipe_context *pipe,
       if (!views[i])
          continue;
 
-      if (views[i]->texture->format == PIPE_FORMAT_A8R8G8B8_SRGB)
+      if (views[i]->texture->format == PIPE_FORMAT_B8G8R8A8_SRGB)
          flag_srgb |= 1 << i;
 
       if (views[i]->texture->target == PIPE_TEXTURE_1D)