Merge branch '7.8'
[mesa.git] / src / mesa / state_tracker / st_atom_texture.c
index 21f7321f97a3d6b80daaefeb020863a011694be8..f4294ac1e6f0d40705d9a636b62dbf3e71d801e5 100644 (file)
   */
  
 
+#include "main/macros.h"
+
 #include "st_context.h"
 #include "st_atom.h"
 #include "st_texture.h"
 #include "st_cb_texture.h"
 #include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
+#include "util/u_inlines.h"
 #include "cso_cache/cso_context.h"
 
 
 static void 
 update_textures(struct st_context *st)
 {
+   struct pipe_context *pipe = st->pipe;
    struct gl_vertex_program *vprog = st->ctx->VertexProgram._Current;
    struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
    const GLbitfield samplersUsed = (vprog->Base.SamplersUsed |
@@ -54,7 +57,7 @@ update_textures(struct st_context *st)
 
    /* loop over sampler units (aka tex image units) */
    for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) {
-      struct pipe_texture *pt = NULL;
+      struct pipe_sampler_view *sampler_view = NULL;
 
       if (samplersUsed & (1 << su)) {
          struct gl_texture_object *texObj;
@@ -82,7 +85,7 @@ update_textures(struct st_context *st)
 
          st->state.num_textures = su + 1;
 
-         pt = st_get_stobj_texture(stObj);
+         sampler_view = st_get_texture_sampler_view(stObj, pipe);
       }
 
       /*
@@ -94,12 +97,18 @@ update_textures(struct st_context *st)
       }
       */
 
-      pipe_texture_reference(&st->state.sampler_texture[su], pt);
+      pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view);
    }
 
-   cso_set_sampler_textures(st->cso_context,
-                            st->state.num_textures,
-                            st->state.sampler_texture);
+   cso_set_fragment_sampler_views(st->cso_context,
+                                  st->state.num_textures,
+                                  st->state.sampler_views);
+   if (st->ctx->Const.MaxVertexTextureImageUnits > 0) {
+      cso_set_vertex_sampler_views(st->cso_context,
+                                   MIN2(st->state.num_textures,
+                                        st->ctx->Const.MaxVertexTextureImageUnits),
+                                   st->state.sampler_views);
+   }
 }