gallium: remove set_sampler_units interface
authorKeith Whitwell <keith@tungstengraphics.com>
Tue, 11 Dec 2007 14:39:37 +0000 (14:39 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Tue, 11 Dec 2007 14:39:37 +0000 (14:39 +0000)
The effect of this mapping can be acheived by the state tracker and
setting up the pipe texture state pointers to incorporate its affects.

28 files changed:
src/mesa/pipe/cell/ppu/cell_context.c
src/mesa/pipe/cell/ppu/cell_context.h
src/mesa/pipe/cell/ppu/cell_state.h
src/mesa/pipe/cell/ppu/cell_state_sampler.c
src/mesa/pipe/failover/fo_context.h
src/mesa/pipe/failover/fo_state.c
src/mesa/pipe/failover/fo_state_emit.c
src/mesa/pipe/i915simple/i915_context.h
src/mesa/pipe/i915simple/i915_state.c
src/mesa/pipe/i965simple/brw_state.c
src/mesa/pipe/llvm/gallivm.cpp
src/mesa/pipe/llvm/gallivm.h
src/mesa/pipe/llvm/llvm_base_shader.cpp
src/mesa/pipe/llvm/llvm_entry.c
src/mesa/pipe/p_context.h
src/mesa/pipe/softpipe/sp_context.c
src/mesa/pipe/softpipe/sp_context.h
src/mesa/pipe/softpipe/sp_quad_fs.c
src/mesa/pipe/softpipe/sp_state.h
src/mesa/pipe/softpipe/sp_state_sampler.c
src/mesa/pipe/tgsi/exec/tgsi_exec.c
src/mesa/pipe/tgsi/exec/tgsi_exec.h
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_cb_texture.h
src/mesa/state_tracker/st_context.h

index 68543ec..5534d82 100644 (file)
@@ -217,7 +217,6 @@ cell_create_context(struct pipe_winsys *winsys, struct cell_winsys *cws)
    cell->pipe.set_framebuffer_state = cell_set_framebuffer_state;
 
    cell->pipe.set_polygon_stipple = cell_set_polygon_stipple;
-   cell->pipe.set_sampler_units = cell_set_sampler_units;
    cell->pipe.set_scissor_state = cell_set_scissor_state;
    cell->pipe.set_texture_state = cell_set_texture_state;
    cell->pipe.set_viewport_state = cell_set_viewport_state;
index a646920..12073b9 100644 (file)
@@ -58,7 +58,6 @@ struct cell_context
    struct pipe_viewport_state viewport;
    struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
    struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX];
-   uint sampler_units[PIPE_MAX_SAMPLERS];
    uint dirty;
 
    /** The primitive drawing context */
index 033767d..4bad459 100644 (file)
@@ -93,9 +93,6 @@ void cell_set_constant_buffer(struct pipe_context *pipe,
 void cell_set_polygon_stipple( struct pipe_context *,
                                const struct pipe_poly_stipple * );
 
-void cell_set_sampler_units( struct pipe_context *,
-                             uint numSamplers, const uint *units );
-
 void cell_set_scissor_state( struct pipe_context *,
                              const struct pipe_scissor_state * );
 
index c2a180e..495567b 100644 (file)
@@ -69,32 +69,22 @@ cell_delete_sampler_state(struct pipe_context *pipe,
 
 
 void
-cell_set_texture_state(struct pipe_context *pipe,
-                           unsigned unit,
-                           struct pipe_texture *texture)
+cell_set_sampler_texture(struct pipe_context *pipe,
+                        unsigned sampler,
+                        struct pipe_texture *texture)
 {
    struct cell_context *cell = cell_context(pipe);
 
    assert(unit < PIPE_MAX_SAMPLERS);
 
 #if 0
-   cell->texture[unit] = cell_texture(texture);  /* ptr, not struct */
-   cell_tile_cache_set_texture(cell->tex_cache[unit], texture);
+   cell->texture[sampler] = cell_texture(texture);  /* ptr, not struct */
+   cell_tile_cache_set_texture(cell->tex_cache[sampler], texture);
 #endif
 
    cell->dirty |= CELL_NEW_TEXTURE;
 }
 
 
-void
-cell_set_sampler_units(struct pipe_context *pipe,
-                           uint num_samplers, const uint *units )
-{
-   struct cell_context *cell = cell_context(pipe);
-   uint i;
-   for (i = 0; i < num_samplers; i++)
-      cell->sampler_units[i] = units[i];
-   cell->dirty |= CELL_NEW_SAMPLER;
-}
 
 
index 2423eb4..f5eaa0b 100644 (file)
@@ -83,7 +83,6 @@ struct failover_context {
    struct pipe_framebuffer_state framebuffer;
    struct pipe_poly_stipple poly_stipple;
    struct pipe_scissor_state scissor;
-   uint sampler_units[PIPE_MAX_SAMPLERS];
    struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
    struct pipe_viewport_state viewport;
    struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
index 689d2fa..6b4f151 100644 (file)
@@ -284,18 +284,6 @@ failover_set_polygon_stipple( struct pipe_context *pipe,
    failover->hw->set_polygon_stipple( failover->hw, stipple );
 }
 
-static void
-failover_set_sampler_units( struct pipe_context *pipe,
-                            uint num_samplers, const uint *units )
-{
-   struct failover_context *failover = failover_context(pipe);
-   uint i;
-
-   for (i = 0; i < num_samplers; i++)
-      failover->sampler_units[i] = units[i];
-   failover->dirty |= FO_NEW_SAMPLER;
-   failover->hw->set_sampler_units(failover->hw, num_samplers, units);
-}
 
 static void *
 failover_create_rasterizer_state(struct pipe_context *pipe,
@@ -390,16 +378,16 @@ failover_delete_sampler_state(struct pipe_context *pipe, void *sampler)
 
 
 static void
-failover_set_texture_state(struct pipe_context *pipe,
-                          unsigned unit,
-                           struct pipe_texture *texture)
+failover_set_sampler_texture(struct pipe_context *pipe,
+                            unsigned unit,
+                            struct pipe_texture *texture)
 {
    struct failover_context *failover = failover_context(pipe);
 
    failover->texture[unit] = texture;
    failover->dirty |= FO_NEW_TEXTURE;
    failover->dirty_texture |= (1<<unit);
-   failover->hw->set_texture_state( failover->hw, unit, texture );
+   failover->hw->set_sampler_texture( failover->hw, unit, texture );
 }
 
 
@@ -472,9 +460,8 @@ failover_init_state_functions( struct failover_context *failover )
    failover->pipe.set_clip_state = failover_set_clip_state;
    failover->pipe.set_framebuffer_state = failover_set_framebuffer_state;
    failover->pipe.set_polygon_stipple = failover_set_polygon_stipple;
-   failover->pipe.set_sampler_units = failover_set_sampler_units;
    failover->pipe.set_scissor_state = failover_set_scissor_state;
-   failover->pipe.set_texture_state = failover_set_texture_state;
+   failover->pipe.set_sampler_texture = failover_set_sampler_texture;
    failover->pipe.set_viewport_state = failover_set_viewport_state;
    failover->pipe.set_vertex_buffer = failover_set_vertex_buffer;
    failover->pipe.set_vertex_element = failover_set_vertex_element;
index 612b0a6..c99ecd4 100644 (file)
@@ -109,7 +109,7 @@ failover_state_emit( struct failover_context *failover )
    if (failover->dirty & FO_NEW_TEXTURE) {
       for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
         if (failover->dirty_texture & (1<<i)) {
-           failover->sw->set_texture_state( failover->sw, i, 
+           failover->sw->set_sampler_texture( failover->sw, i, 
                                             failover->texture[i] );
         }
       }
index a239c8f..80df7f0 100644 (file)
@@ -199,7 +199,6 @@ struct i915_context
    struct pipe_framebuffer_state framebuffer;
    struct pipe_poly_stipple poly_stipple;
    struct pipe_scissor_state scissor;
-   uint sampler_units[PIPE_MAX_SAMPLERS];
    struct i915_texture *texture[PIPE_MAX_SAMPLERS];
    struct pipe_viewport_state viewport;
    struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
index a8c6565..2a9a587 100644 (file)
@@ -431,14 +431,6 @@ static void i915_set_polygon_stipple( struct pipe_context *pipe,
 {
 }
 
-static void i915_set_sampler_units(struct pipe_context *pipe,
-                                   uint numSamplers, const uint *units)
-{
-   struct i915_context *i915 = i915_context(pipe);
-   uint i;
-   for (i = 0; i < numSamplers; i++)
-      i915->sampler_units[i] = units[i];
-}
 
 static void * i915_create_fs_state(struct pipe_context *pipe,
                                    const struct pipe_shader_state *templ)
@@ -523,13 +515,13 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
 }
 
 
-static void i915_set_texture_state(struct pipe_context *pipe,
-                                  unsigned unit,
-                                  struct pipe_texture *texture)
+static void i915_set_sampler_texture(struct pipe_context *pipe,
+                                    unsigned sampler,
+                                    struct pipe_texture *texture)
 {
    struct i915_context *i915 = i915_context(pipe);
 
-   i915->texture[unit] = (struct i915_texture*)texture;  /* ptr, not struct */
+   i915->texture[sampler] = (struct i915_texture*)texture;  /* ptr, not struct */
 
    i915->dirty |= I915_NEW_TEXTURE;
 }
@@ -714,9 +706,8 @@ i915_init_state_functions( struct i915_context *i915 )
    i915->pipe.set_framebuffer_state = i915_set_framebuffer_state;
 
    i915->pipe.set_polygon_stipple = i915_set_polygon_stipple;
-   i915->pipe.set_sampler_units = i915_set_sampler_units;
    i915->pipe.set_scissor_state = i915_set_scissor_state;
-   i915->pipe.set_texture_state = i915_set_texture_state;
+   i915->pipe.set_sampler_texture = i915_set_sampler_texture;
    i915->pipe.set_viewport_state = i915_set_viewport_state;
    i915->pipe.set_vertex_buffer = i915_set_vertex_buffer;
    i915->pipe.set_vertex_element = i915_set_vertex_element;
index 7731c2e..ff4ae79 100644 (file)
@@ -110,11 +110,6 @@ static void brw_delete_sampler_state(struct pipe_context *pipe,
 }
 
 
-static void brw_set_sampler_units(struct pipe_context *pipe,
-                                 uint numSamplers, const uint *units)
-{
-}
-
 /************************************************************************
  * Depth stencil 
  */
@@ -349,7 +344,7 @@ static void brw_set_constant_buffer(struct pipe_context *pipe,
  */
 
 
-static void brw_set_texture_state(struct pipe_context *pipe,
+static void brw_set_sampler_texture(struct pipe_context *pipe,
                                   unsigned unit,
                                   struct pipe_texture *texture)
 {
@@ -448,9 +443,8 @@ brw_init_state_functions( struct brw_context *brw )
 //   brw->pipe.set_feedback_buffer = brw_set_feedback_buffer;
 
    brw->pipe.set_polygon_stipple = brw_set_polygon_stipple;
-   brw->pipe.set_sampler_units = brw_set_sampler_units;
    brw->pipe.set_scissor_state = brw_set_scissor_state;
-   brw->pipe.set_texture_state = brw_set_texture_state;
+   brw->pipe.set_sampler_texture = brw_set_sampler_texture;
    brw->pipe.set_viewport_state = brw_set_viewport_state;
    brw->pipe.set_vertex_buffer = brw_set_vertex_buffer;
    brw->pipe.set_vertex_element = brw_set_vertex_element;
index bd8bfac..a604400 100644 (file)
@@ -927,23 +927,21 @@ typedef int (*fragment_shader_runner)(float x, float y,
                                       float (*inputs)[16][4],
                                       int num_attribs,
                                       float (*consts)[4], int num_consts,
-                                      struct tgsi_sampler *samplers,
-                                      unsigned *sampler_units);
+                                      struct tgsi_sampler *samplers);
 
 int gallivm_fragment_shader_exec(struct gallivm_prog *prog,
                                  float fx, float fy,
                                  float (*dests)[16][4],
                                  float (*inputs)[16][4],
                                  float (*consts)[4],
-                                 struct tgsi_sampler *samplers,
-                                 unsigned *sampler_units)
+                                 struct tgsi_sampler *samplers)
 {
    fragment_shader_runner runner = reinterpret_cast<fragment_shader_runner>(prog->function);
    assert(runner);
 
    runner(fx, fy, dests, inputs, prog->num_interp,
           consts, prog->num_consts,
-          samplers, sampler_units);
+          samplers);
 
    return 0;
 }
index 6a05a55..fd9a11e 100644 (file)
@@ -67,8 +67,7 @@ int gallivm_fragment_shader_exec(struct gallivm_prog *prog,
                                  float (*dests)[PIPE_MAX_SHADER_INPUTS][4],
                                  float (*inputs)[PIPE_MAX_SHADER_INPUTS][4],
                                  float (*consts)[4],
-                                 struct tgsi_sampler *samplers,
-                                 unsigned *sampler_units);
+                                 struct tgsi_sampler *samplers);
 void gallivm_prog_inputs_interpolate(struct gallivm_prog *prog,
                                      float (*inputs)[PIPE_MAX_SHADER_INPUTS][4],
                                      const struct tgsi_interp_coef *coefs);
index f141ea2..a703ba3 100644 (file)
@@ -770,8 +770,6 @@ Module* createBaseShader() {
     int32_num_consts_125->setName("num_consts");
     Value* ptr_samplers = args++;
     ptr_samplers->setName("samplers");
-    Value* ptr_sampler_units = args++;
-    ptr_sampler_units->setName("sampler_units");
     
     BasicBlock* label_entry_126 = new BasicBlock("entry",func_run_fragment_shader,0);
     BasicBlock* label_forbody6_i_127 = new BasicBlock("forbody6.i",func_run_fragment_shader,0);
index fe32e78..cbe4965 100644 (file)
@@ -219,8 +219,7 @@ int run_fragment_shader(float x, float y,
                         int num_inputs,
                         float (*aconsts)[4],
                         int num_consts,
-                        struct tgsi_sampler *samplers,
-                        unsigned *sampler_units)
+                        struct tgsi_sampler *samplers)
 {
    float4  inputs[4][16];
    float4  consts[32];
index 6b97844..83b4ab0 100644 (file)
@@ -142,15 +142,15 @@ struct pipe_context {
    void (*set_polygon_stipple)( struct pipe_context *,
                                const struct pipe_poly_stipple * );
 
-   void (*set_sampler_units)( struct pipe_context *,
-                              uint num_samplers, const uint *units );
-
    void (*set_scissor_state)( struct pipe_context *,
                               const struct pipe_scissor_state * );
 
-   void (*set_texture_state)( struct pipe_context *,
-                              unsigned unit,
-                              struct pipe_texture * );
+
+   /* Currently a sampler is constrained to sample from a single texture:
+    */
+   void (*set_sampler_texture)( struct pipe_context *,
+                               unsigned sampler,
+                               struct pipe_texture * );
 
    void (*set_viewport_state)( struct pipe_context *,
                                const struct pipe_viewport_state * );
index 43f23dc..7d243aa 100644 (file)
@@ -307,9 +307,8 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
    softpipe->pipe.set_constant_buffer = softpipe_set_constant_buffer;
    softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
    softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
-   softpipe->pipe.set_sampler_units = softpipe_set_sampler_units;
    softpipe->pipe.set_scissor_state = softpipe_set_scissor_state;
-   softpipe->pipe.set_texture_state = softpipe_set_texture_state;
+   softpipe->pipe.set_sampler_texture = softpipe_set_sampler_texture;
    softpipe->pipe.set_viewport_state = softpipe_set_viewport_state;
 
    softpipe->pipe.set_vertex_buffer = softpipe_set_vertex_buffer;
index 45d15c7..afdd0ec 100644 (file)
@@ -91,7 +91,6 @@ struct softpipe_context {
    struct pipe_viewport_state viewport;
    struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
    struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX];
-   uint sampler_units[PIPE_MAX_SAMPLERS];
    unsigned dirty;
 
    /*
index 75576a9..9307ed2 100644 (file)
@@ -98,7 +98,6 @@ shade_quad(
    /* Consts does not require 16 byte alignment. */
    machine->Consts = softpipe->mapped_constants[PIPE_SHADER_FRAGMENT];
 
-   machine->SamplerUnits = softpipe->sampler_units;
    machine->InterpCoefs = quad->coef;
 
    machine->Inputs[0].xyzw[0].f[0] = fx;
@@ -206,7 +205,7 @@ shade_quad_llvm(struct quad_stage *qs,
    /*quad->mask &=*/
       gallivm_fragment_shader_exec(llvm, fx, fy, dests, inputs,
                                    softpipe->mapped_constants[PIPE_SHADER_FRAGMENT],
-                                   qss->samplers, softpipe->sampler_units);
+                                   qss->samplers);
 #if DLLVM
    printf("OUT LLVM = 1[%f %f %f %f], 2[%f %f %f %f]\n",
           dests[0][0][0], dests[0][0][1], dests[0][0][2], dests[0][0][3], 
index 80a1cba..a3bd078 100644 (file)
@@ -111,13 +111,10 @@ void softpipe_delete_vs_state(struct pipe_context *, void *);
 void softpipe_set_polygon_stipple( struct pipe_context *,
                                  const struct pipe_poly_stipple * );
 
-void softpipe_set_sampler_units( struct pipe_context *,
-                                 uint numSamplers, const uint *units );
-
 void softpipe_set_scissor_state( struct pipe_context *,
                                  const struct pipe_scissor_state * );
 
-void softpipe_set_texture_state( struct pipe_context *,
+void softpipe_set_sampler_texture( struct pipe_context *,
                                  unsigned unit,
                                  struct pipe_texture * );
 
index 173901f..3842e71 100644 (file)
@@ -67,9 +67,9 @@ softpipe_delete_sampler_state(struct pipe_context *pipe,
 
 
 void
-softpipe_set_texture_state(struct pipe_context *pipe,
-                           unsigned unit,
-                           struct pipe_texture *texture)
+softpipe_set_sampler_texture(struct pipe_context *pipe,
+                            unsigned unit,
+                            struct pipe_texture *texture)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
 
@@ -82,15 +82,4 @@ softpipe_set_texture_state(struct pipe_context *pipe,
 }
 
 
-void
-softpipe_set_sampler_units(struct pipe_context *pipe,
-                           uint num_samplers, const uint *units )
-{
-   struct softpipe_context *softpipe = softpipe_context(pipe);
-   uint i;
-   for (i = 0; i < num_samplers; i++)
-      softpipe->sampler_units[i] = units[i];
-   softpipe->dirty |= SP_NEW_SAMPLER;
-}
-
 
index ab83f27..8636271 100644 (file)
@@ -1217,8 +1217,7 @@ exec_tex(struct tgsi_exec_machine *mach,
          const struct tgsi_full_instruction *inst,
          boolean biasLod)
 {
-   const uint sampler = inst->FullSrcRegisters[1].SrcRegister.Index;
-   const uint unit = mach->SamplerUnits[sampler];
+   const uint unit = inst->FullSrcRegisters[1].SrcRegister.Index;
    union tgsi_exec_channel r[8];
    uint chan_index;
    float lodBias;
index 2c62b30..e7952a0 100644 (file)
@@ -162,7 +162,6 @@ struct tgsi_exec_machine
    struct tgsi_exec_vector       *Temps;
    struct tgsi_exec_vector       *Addrs;
 
-   uint                          *SamplerUnits;
    struct tgsi_sampler           *Samplers;
 
    float                         Imms[TGSI_EXEC_NUM_IMMEDIATES][4];
index 67a9159..052b6dd 100644 (file)
@@ -172,26 +172,13 @@ update_samplers(struct st_context *st)
          st->pipe->bind_sampler_state(st->pipe, u, cso->data);
       }
    }
-
-
-   /* mapping from sampler vars to texture units */
-   {
-      struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
-      uint sample_units[PIPE_MAX_SAMPLERS];
-      uint s;
-      for (s = 0; s < PIPE_MAX_SAMPLERS; s++) {
-         sample_units[s] = fprog->Base.SamplerUnits[s];
-      }
-
-      st->pipe->set_sampler_units(st->pipe, PIPE_MAX_SAMPLERS, sample_units);
-   }
 }
 
 
 const struct st_tracked_state st_update_sampler = {
    .name = "st_update_sampler",
    .dirty = {
-      .mesa = _NEW_TEXTURE | _NEW_PROGRAM,
+      .mesa = _NEW_TEXTURE,
       .st  = 0,
    },
    .update = update_samplers
index c4e5af0..fb21d29 100644 (file)
 static void 
 update_textures(struct st_context *st)
 {
-   GLuint u;
+   GLuint s;
 
-   for (u = 0; u < st->ctx->Const.MaxTextureImageUnits; u++) {
+   /* ST_NEW_FRAGMENT_PROGRAM
+    */
+   struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
+
+   for (s = 0; s < st->ctx->Const.MaxTextureCoordUnits; s++) {
+      GLuint su = fprog->Base.SamplerUnits[s];
+      
       struct gl_texture_object *texObj
-         = st->ctx->Texture.Unit[u]._Current;
+         = st->ctx->Texture.Unit[su]._Current;
+
       struct pipe_texture *pt;
+
       if (texObj) {
          GLboolean flush, retval;
 
-         retval = st_finalize_texture(st->ctx, st->pipe, u, &flush);
-#if 0
-         printf("finalize_texture returned %d, flush = %d\n",
-                retval, flush);
-#endif
+         retval = st_finalize_texture(st->ctx, st->pipe, texObj, &flush);
 
          pt = st_get_texobj_texture(texObj);
       }
@@ -67,8 +71,14 @@ update_textures(struct st_context *st)
          pt = NULL;
       }
 
-      st->state.texture[u] = pt;
-      st->pipe->set_texture_state(st->pipe, u, pt);
+      /* XXX: need to ensure that textures are unbound/removed from
+       * this table before being deleted, otherwise the pointer
+       * comparison below could fail.
+       */
+      if (st->state.sampler_texture[s] != pt) {
+        st->state.sampler_texture[s] = pt;
+        st->pipe->set_sampler_texture(st->pipe, s, pt);
+      }
    }
 }
 
@@ -77,7 +87,7 @@ const struct st_tracked_state st_update_texture = {
    .name = "st_update_texture",
    .dirty = {
       .mesa = _NEW_TEXTURE,
-      .st  = 0,
+      .st  = ST_NEW_FRAGMENT_PROGRAM,
    },
    .update = update_textures
 };
index 0179000..5d4c443 100644 (file)
@@ -697,7 +697,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
 
    /* texture state: */
    {
-      pipe->set_texture_state(pipe, unit, pt);
+      pipe->set_sampler_texture(pipe, unit, pt);
    }
 
    /* Compute window coords (y=0=bottom) with pixel zoom.
@@ -719,7 +719,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
    pipe->bind_rasterizer_state(pipe, ctx->st->state.rasterizer->data);
    pipe->bind_fs_state(pipe, ctx->st->state.fs->data);
    pipe->bind_vs_state(pipe, ctx->st->state.vs->data);
-   pipe->set_texture_state(pipe, unit, ctx->st->state.texture[unit]);
+   pipe->set_sampler_texture(pipe, unit, ctx->st->state.sampler_texture[unit]);
    pipe->bind_sampler_state(pipe, unit, ctx->st->state.sampler[unit]->data);
    pipe->set_viewport_state(pipe, &ctx->st->state.viewport);
 }
index 2c93a2f..39dd21d 100644 (file)
@@ -1412,10 +1412,10 @@ copy_image_data_to_texture(struct st_context *st,
  */
 GLboolean
 st_finalize_texture(GLcontext *ctx,
-                   struct pipe_context *pipe, GLuint unit,
+                   struct pipe_context *pipe,
+                   struct gl_texture_object *tObj,
                    GLboolean *needFlush)
 {
-   struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
    struct st_texture_object *stObj = st_texture_object(tObj);
    int comp_byte = 0;
    int cpp;
index 7f8082b..878256e 100644 (file)
@@ -8,7 +8,8 @@ st_get_texobj_texture(struct gl_texture_object *texObj);
 
 extern GLboolean
 st_finalize_texture(GLcontext *ctx,
-                   struct pipe_context *pipe, GLuint unit,
+                   struct pipe_context *pipe, 
+                   struct gl_texture_object *tObj,
                    GLboolean *needFlush);
 
 
index 4855961..87646b3 100644 (file)
@@ -106,7 +106,7 @@ struct st_context
       struct pipe_clip_state clip;
       struct pipe_constant_buffer constants[2];
       struct pipe_framebuffer_state framebuffer;
-      struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
+      struct pipe_texture *sampler_texture[PIPE_MAX_SAMPLERS];
       struct pipe_poly_stipple poly_stipple;
       struct pipe_scissor_state scissor;
       struct pipe_viewport_state viewport;