Merge branch 'master' into gallium-sampler-view
authorMichal Krol <michal@vmware.com>
Wed, 10 Mar 2010 14:49:30 +0000 (15:49 +0100)
committerMichal Krol <michal@vmware.com>
Wed, 10 Mar 2010 14:49:30 +0000 (15:49 +0100)
Conflicts:
src/gallium/auxiliary/Makefile
src/gallium/auxiliary/SConscript
src/gallium/auxiliary/tgsi/tgsi_exec.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/drivers/i915/i915_context.h
src/gallium/drivers/i965/brw_context.h
src/gallium/drivers/llvmpipe/lp_context.h
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_state_validate.c
src/gallium/drivers/nv50/nv50_tex.c
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/softpipe/sp_context.h
src/gallium/drivers/svga/svga_context.h
src/gallium/drivers/svga/svga_pipe_sampler.c

52 files changed:
1  2 
src/gallium/auxiliary/Makefile
src/gallium/auxiliary/SConscript
src/gallium/auxiliary/cso_cache/cso_context.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_blitter.h
src/gallium/auxiliary/util/u_inlines.h
src/gallium/auxiliary/util/u_tile.c
src/gallium/docs/source/context.rst
src/gallium/drivers/cell/ppu/cell_context.h
src/gallium/drivers/cell/ppu/cell_pipe_state.c
src/gallium/drivers/failover/fo_context.h
src/gallium/drivers/failover/fo_state.c
src/gallium/drivers/failover/fo_state_emit.c
src/gallium/drivers/i915/i915_context.h
src/gallium/drivers/i915/i915_state.c
src/gallium/drivers/i915/i915_state_emit.c
src/gallium/drivers/i915/i915_state_sampler.c
src/gallium/drivers/i965/brw_context.h
src/gallium/drivers/i965/brw_wm.c
src/gallium/drivers/i965/brw_wm_sampler_state.c
src/gallium/drivers/identity/id_context.c
src/gallium/drivers/llvmpipe/lp_context.c
src/gallium/drivers/llvmpipe/lp_context.h
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_setup.h
src/gallium/drivers/llvmpipe/lp_state.h
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/nv30/nv30_context.h
src/gallium/drivers/nv30/nv30_state.c
src/gallium/drivers/nv40/nv40_context.h
src/gallium/drivers/nv40/nv40_state.c
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nv50/nv50_state.c
src/gallium/drivers/nv50/nv50_tex.c
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/softpipe/sp_context.c
src/gallium/drivers/softpipe/sp_context.h
src/gallium/drivers/softpipe/sp_state.h
src/gallium/drivers/svga/svga_context.h
src/gallium/drivers/svga/svga_pipe_sampler.c
src/gallium/drivers/trace/tr_context.c
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_state.h
src/gallium/state_trackers/python/p_context.i
src/gallium/state_trackers/python/st_device.c
src/gallium/state_trackers/python/st_device.h
src/mesa/state_tracker/st_cb_drawpixels.c

index 75dfd965afa5f316080a90da46333a2dbe278d58,0ac18426d97e736248540482d1a633c68f779297..e2796d5bd3885c266cae49a2ed616e61b5bbd8e0
@@@ -126,13 -126,13 +127,14 @@@ C_SOURCES = 
        util/u_tile.c \
        util/u_timed_winsys.c \
        util/u_upload_mgr.c \
 -      util/u_simple_screen.c \
 -      vl/vl_bitstream_parser.c \
 -      vl/vl_mpeg12_mc_renderer.c \
 -      vl/vl_compositor.c \
 -      vl/vl_csc.c \
 -      vl/vl_shader_build.c \
 +      util/u_simple_screen.c
 +      # Disabling until pipe-video branch gets merged in
 +      #vl/vl_bitstream_parser.c \
 +      #vl/vl_mpeg12_mc_renderer.c \
 +      #vl/vl_compositor.c \
 +      #vl/vl_csc.c \
-       #vl/vl_shader_build.c
++      #vl/vl_shader_build.c \
+       target-helpers/wrap_screen.c
  
  GALLIVM_SOURCES = \
          gallivm/lp_bld_alpha.c \
index acb03e62829ff08e1167a965d2c94ff7fc5530af,2be16776fb897d4fe574d7c6f377a483347c526e..65e1dc8a58d1bff01f75201269c4674a220f8b70
@@@ -162,12 -170,12 +171,13 @@@ source = 
      'util/u_timed_winsys.c',
      'util/u_upload_mgr.c',
      'util/u_simple_screen.c',
 -    'vl/vl_bitstream_parser.c',
 -    'vl/vl_mpeg12_mc_renderer.c',
 -    'vl/vl_compositor.c',
 -    'vl/vl_csc.c',
 -    'vl/vl_shader_build.c',
 +    # Disabling until pipe-video branch gets merged in
 +    #'vl/vl_bitstream_parser.c',
 +    #'vl/vl_mpeg12_mc_renderer.c',
 +    #'vl/vl_compositor.c',
 +    #'vl/vl_csc.c',
 +    #'vl/vl_shader_build.c',
+     'target-helpers/wrap_screen.c',
  ]
  
  if drawllvm:
index 29060a1effea57e84d8ae9ccc12ac79f7d006a17,33d09085f0bf743e2418192a41930815d7f6bff7..71cf9525d39d367121f56f4c02830798d5c32149
@@@ -95,7 -96,11 +97,13 @@@ struct blitter_context_pri
     /* Rasterizer state. */
     void *rs_state;
  
 +   struct pipe_sampler_view *sampler_view;
++
+    /* Viewport state. */
+    struct pipe_viewport_state viewport;
+    /* Clip state. */
+    struct pipe_clip_state clip;
  };
  
  struct blitter_context *util_blitter_create(struct pipe_context *pipe)
     ctx->blitter.saved_rs_state = INVALID_PTR;
     ctx->blitter.saved_fs = INVALID_PTR;
     ctx->blitter.saved_vs = INVALID_PTR;
+    ctx->blitter.saved_velem_state = INVALID_PTR;
     ctx->blitter.saved_fb_state.nr_cbufs = ~0;
 -   ctx->blitter.saved_num_textures = ~0;
 +   ctx->blitter.saved_num_sampler_views = ~0;
     ctx->blitter.saved_num_sampler_states = ~0;
  
     /* blend state objects */
@@@ -631,7 -653,8 +673,8 @@@ static void util_blitter_do_copy(struc
     pipe->bind_vs_state(pipe, ctx->vs_tex);
     pipe->bind_fragment_sampler_states(pipe, 1,
        blitter_get_sampler_state(ctx, src->level));
 -   pipe->set_fragment_sampler_textures(pipe, 1, &src->texture);
+    pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
 +   pipe->set_fragment_sampler_views(pipe, 1, &view);
     pipe->set_framebuffer_state(pipe, &fb_state);
  
     /* set texture coordinates */
index 9911948560395428b5502b7392d1f617a637c5ba,ecafdabafae79ffa3431ca9d78d3bf79c350c8e0..2ad7201a29d96a5abdd010999bd1a3d066b3df30
@@@ -48,12 -49,14 +49,14 @@@ struct blitter_contex
  
     struct pipe_framebuffer_state saved_fb_state;  /**< framebuffer state */
     struct pipe_stencil_ref saved_stencil_ref;     /**< stencil ref */
+    struct pipe_viewport_state saved_viewport;
+    struct pipe_clip_state saved_clip;
  
     int saved_num_sampler_states;
 -   void *saved_sampler_states[32];
 +   void *saved_sampler_states[PIPE_MAX_SAMPLERS];
  
 -   int saved_num_textures;
 -   struct pipe_texture *saved_textures[32]; /* is 32 enough? */
 +   int saved_num_sampler_views;
 +   struct pipe_sampler_view *saved_sampler_views[PIPE_MAX_SAMPLERS];
  };
  
  /**
Simple merge
Simple merge
index 53e1a02bcba1f38fea25f909d719902d0724a686,4a754465bbe9f88e8930e072cafde99a49ce8a1c..73031321d98d00360dd103a32e0bf02db83d17e2
@@@ -92,12 -86,12 +93,10 @@@ struct failover_context 
     struct pipe_framebuffer_state framebuffer;
     struct pipe_poly_stipple poly_stipple;
     struct pipe_scissor_state scissor;
 -   struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
 -   struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS];
     struct pipe_viewport_state viewport;
     struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
-    struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS];
  
     uint num_vertex_buffers;
-    uint num_vertex_elements;
  
     void *sw_sampler_state[PIPE_MAX_SAMPLERS];
     void *hw_sampler_state[PIPE_MAX_SAMPLERS];
index d0c2f1474aecf01640761413023ee9272179af5b,0247fb803b297baa6d12b8d9f8ca894b72cd5c1d..25c6273570520ee98e434be680e51efb7de38e0e
@@@ -586,12 -580,9 +616,11 @@@ failover_init_state_functions( struct f
     failover->pipe.set_framebuffer_state = failover_set_framebuffer_state;
     failover->pipe.set_polygon_stipple = failover_set_polygon_stipple;
     failover->pipe.set_scissor_state = failover_set_scissor_state;
 -   failover->pipe.set_fragment_sampler_textures = failover_set_fragment_sampler_textures;
 -   failover->pipe.set_vertex_sampler_textures = failover_set_vertex_sampler_textures;
 +   failover->pipe.set_fragment_sampler_views = failover_set_fragment_sampler_views;
 +   failover->pipe.set_vertex_sampler_views = failover_set_vertex_sampler_views;
     failover->pipe.set_viewport_state = failover_set_viewport_state;
     failover->pipe.set_vertex_buffers = failover_set_vertex_buffers;
-    failover->pipe.set_vertex_elements = failover_set_vertex_elements;
     failover->pipe.set_constant_buffer = failover_set_constant_buffer;
 +   failover->pipe.create_sampler_view = failover_create_sampler_view;
 +   failover->pipe.sampler_view_destroy = failover_sampler_view_destroy;
  }
index cd6dcd59a9f825305a4c334c9bb3c6af3fefcfe1,49945376837cee71929670930c2f70ef29d0aa30..9d03ca37fda522823dcd9b05c17703f3afd7738a
@@@ -246,8 -254,7 +254,7 @@@ struct i915_contex
     unsigned dirty;
  
     unsigned num_samplers;
 -   unsigned num_textures;
 +   unsigned num_fragment_sampler_views;
-    unsigned num_vertex_elements;
     unsigned num_vertex_buffers;
  
     struct intel_batchbuffer *batch;
index 46703dce350deb06c76103ed720ac1003cdd6286,8927dfc33d474177aeae2080b704399fefd119d5..884abe622b34b2f4463afa5abab56997abbad1fd
@@@ -816,10 -815,7 +840,9 @@@ i915_init_state_functions( struct i915_
  
     i915->base.set_polygon_stipple = i915_set_polygon_stipple;
     i915->base.set_scissor_state = i915_set_scissor_state;
 -   i915->base.set_fragment_sampler_textures = i915_set_sampler_textures;
 +   i915->base.set_fragment_sampler_views = i915_set_fragment_sampler_views;
 +   i915->base.create_sampler_view = i915_create_sampler_view;
 +   i915->base.sampler_view_destroy = i915_sampler_view_destroy;
     i915->base.set_viewport_state = i915_set_viewport_state;
     i915->base.set_vertex_buffers = i915_set_vertex_buffers;
-    i915->base.set_vertex_elements = i915_set_vertex_elements;
  }
index 8816714a7aad5a607d07acb26cab1ec3e3315363,f5b1a06576bd1dda50f535e6dd8173bc0832c8f2..dab881fea2468e52a1d1e532738ed67f88be41eb
@@@ -550,11 -551,9 +551,9 @@@ struct brw_contex
        const struct brw_sampler *sampler[PIPE_MAX_SAMPLERS];
        unsigned num_samplers;
  
 -      struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
 +      struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
        struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
-       struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
-       unsigned num_vertex_elements;
 -      unsigned num_textures;
 +      unsigned num_fragment_sampler_views;
        unsigned num_vertex_buffers;
  
        struct pipe_scissor_state scissor;
index 3724adc040e360402fb900e5be2c7370768c9e05,dfb718e64fe7d6b0991d8c289615faca233b5885..7ed2378ec04710df8b34834ba5a776223cc72912
@@@ -251,13 -251,13 +251,13 @@@ static void brw_wm_populate_key( struc
  
  
     /* PIPE_NEW_BOUND_TEXTURES */
 -   for (i = 0; i < brw->curr.num_textures; i++) {
 -      const struct brw_texture *tex = brw_texture(brw->curr.texture[i]);
 +   for (i = 0; i < brw->curr.num_fragment_sampler_views; i++) {
 +      const struct brw_texture *tex = brw_texture(brw->curr.fragment_sampler_views[i]->texture);
         
-       if (tex->base.format == PIPE_FORMAT_YCBCR)
+       if (tex->base.format == PIPE_FORMAT_UYVY)
         key->yuvtex_mask |= 1 << i;
  
-       if (tex->base.format == PIPE_FORMAT_YCBCR_REV)
+       if (tex->base.format == PIPE_FORMAT_YUYV)
         key->yuvtex_swap_mask |= 1 << i;
  
        /* XXX: shadow texture
index a4bfa61ab306d994e881fb019133056798faba6d,6a6086fc51b3a172f3be2a6eee948e1716d0bcba..3f18062c584dc8129ee29f10c34e3a21ec197ebf
@@@ -127,18 -127,17 +127,17 @@@ brw_wm_sampler_update_default_colors(st
     int i;
  
     for (i = 0; i < nr; i++) {
 -      const struct brw_texture *tex = brw_texture(brw->curr.texture[i]);
 +      const struct brw_texture *tex = brw_texture(brw->curr.fragment_sampler_views[i]->texture);
        const struct brw_sampler *sampler = brw->curr.sampler[i];
        const float *bc;
+       float bordercolor[4] = {
+          sampler->border_color[0],
+          sampler->border_color[0],
+          sampler->border_color[0],
+          sampler->border_color[0]
+       };
+       
        if (util_format_is_depth_or_stencil(tex->base.format)) {
-        float bordercolor[4] = {
-           sampler->border_color[0],
-           sampler->border_color[0],
-           sampler->border_color[0],
-           sampler->border_color[0]
-        };
-          
           bc = bordercolor;
        }
        else {
index 442d851c1352ed0d742964a83b81723bff129f03,baf0ae440166762c525b966a0dbd2729a243a6f2..ef5b428161c651523151d9c297d08572ea24936a
@@@ -777,10 -766,9 +802,9 @@@ identity_context_create(struct pipe_scr
     id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple;
     id_pipe->base.set_scissor_state = identity_set_scissor_state;
     id_pipe->base.set_viewport_state = identity_set_viewport_state;
 -   id_pipe->base.set_fragment_sampler_textures = identity_set_fragment_sampler_textures;
 -   id_pipe->base.set_vertex_sampler_textures = identity_set_vertex_sampler_textures;
 +   id_pipe->base.set_fragment_sampler_views = identity_set_fragment_sampler_views;
 +   id_pipe->base.set_vertex_sampler_views = identity_set_vertex_sampler_views;
     id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers;
-    id_pipe->base.set_vertex_elements = identity_set_vertex_elements;
     id_pipe->base.surface_copy = identity_surface_copy;
     id_pipe->base.surface_fill = identity_surface_fill;
     id_pipe->base.clear = identity_clear;
index 1b98e3033dbd011a67df240c5c442da1b19b56e1,217ec59b68847eb7e6dc7d55d4b8dfe845aca58b..f83e5ffacf8ca781efce75f91b4b281befabc1a2
@@@ -67,17 -69,15 +69,15 @@@ struct llvmpipe_context 
     struct pipe_framebuffer_state framebuffer;
     struct pipe_poly_stipple poly_stipple;
     struct pipe_scissor_state scissor;
 -   struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
 -   struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS];
 +   struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
 +   struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
     struct pipe_viewport_state viewport;
     struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
-    struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
  
     unsigned num_samplers;
 -   unsigned num_textures;
 +   unsigned num_fragment_sampler_views;
     unsigned num_vertex_samplers;
 -   unsigned num_vertex_textures;
 +   unsigned num_vertex_sampler_views;
-    unsigned num_vertex_elements;
     unsigned num_vertex_buffers;
  
     unsigned dirty; /**< Mask of LP_NEW_x flags */
Simple merge
Simple merge
index 42405c1a890b29259529b69cad7e4347b2e6736a,8793c2aac5d340b7915c2e9c7ce6271cc0ed6d41..8a5f7cb25192e0d4bf03396bb70a0bf1cfe5212c
@@@ -72,17 -72,12 +72,23 @@@ struct nv50_sampler_stateobj 
        unsigned tsc[8];
  };
  
 +struct nv50_sampler_view {
 +      struct pipe_sampler_view pipe;
 +      uint32_t tic[8];
 +};
 +
+ struct nv50_vtxelt_stateobj {
+       struct pipe_vertex_element pipe[16];
+       unsigned num_elements;
+       uint32_t hw[16];
+ };
 +static INLINE struct nv50_sampler_view *
 +nv50_sampler_view(struct pipe_sampler_view *view)
 +{
 +      return (struct nv50_sampler_view *)view;
 +}
 +
  static INLINE unsigned
  get_tile_height(uint32_t tile_mode)
  {
@@@ -179,14 -157,13 +168,15 @@@ struct nv50_context 
        struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
        struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
        unsigned vtxbuf_nr;
-       struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
-       unsigned vtxelt_nr;
-       struct nv50_sampler_stateobj *sampler[3][PIPE_MAX_SAMPLERS];
-       unsigned sampler_nr[3];
+       struct nv50_vtxelt_stateobj *vtxelt;
+       struct nv50_sampler_stateobj *sampler[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
+       unsigned sampler_nr[PIPE_SHADER_TYPES];
 +      struct pipe_sampler_view *sampler_views[3][PIPE_MAX_SAMPLERS];
 +      unsigned sampler_view_nr[3];
+       struct nv50_miptree *miptree[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
+       unsigned miptree_nr[PIPE_SHADER_TYPES];
  
-       uint16_t vbo_fifo;
+       unsigned vbo_fifo;
  };
  
  static INLINE struct nv50_context *
@@@ -253,8 -242,8 +255,9 @@@ extern void nv50_so_init_sifc(struct nv
                              unsigned offset, unsigned size);
  
  /* nv50_tex.c */
- extern void nv50_tex_validate(struct nv50_context *);
 +extern boolean nv50_tex_construct(struct nv50_sampler_view *view);
+ extern void nv50_tex_relocs(struct nv50_context *);
+ extern struct nouveau_stateobj *nv50_tex_validate(struct nv50_context *);
  
  /* nv50_transfer.c */
  extern void
Simple merge
index 2f2ebc8ec436dcc3c3cb2392515cd4f891b4daae,4c48b12cd87b377b24a061b47c74276fcbf3c558..c5029bad2d8784d0c4062aa0110be7d11d9d4b20
  
  #define _(pf, t, cr, cg, cb, ca, f) _MIXED(pf, t, t, t, t, cr, cg, cb, ca, f)
  
 -struct nv50_texture_format {
 -      enum pipe_format pf;
 -      uint32_t hw;
 -};
 -
 -#define NV50_TEX_FORMAT_LIST_SIZE \
 -      (sizeof(nv50_tex_format_list) / sizeof(struct nv50_texture_format))
 -
 -static const struct nv50_texture_format nv50_tex_format_list[] =
 +static const uint32_t nv50_texture_formats[PIPE_FORMAT_COUNT] =
  {
-       _(A8R8G8B8_UNORM, UNORM, C2, C1, C0, C3,  8_8_8_8),
-       _(A8R8G8B8_SRGB,  UNORM, C2, C1, C0, C3,  8_8_8_8),
-       _(X8R8G8B8_UNORM, UNORM, C2, C1, C0, ONE, 8_8_8_8),
-       _(X8R8G8B8_SRGB,  UNORM, C2, C1, C0, ONE, 8_8_8_8),
-       _(A1R5G5B5_UNORM, UNORM, C2, C1, C0, C3,  1_5_5_5),
-       _(A4R4G4B4_UNORM, UNORM, C2, C1, C0, C3,  4_4_4_4),
+       _(B8G8R8A8_UNORM, UNORM, C2, C1, C0, C3,  8_8_8_8),
+       _(B8G8R8A8_SRGB,  UNORM, C2, C1, C0, C3,  8_8_8_8),
+       _(B8G8R8X8_UNORM, UNORM, C2, C1, C0, ONE, 8_8_8_8),
+       _(B8G8R8X8_SRGB,  UNORM, C2, C1, C0, ONE, 8_8_8_8),
+       _(B5G5R5A1_UNORM, UNORM, C2, C1, C0, C3,  1_5_5_5),
+       _(B4G4R4A4_UNORM, UNORM, C2, C1, C0, C3,  4_4_4_4),
  
-       _(R5G6B5_UNORM, UNORM, C2, C1, C0, ONE, 5_6_5),
+       _(B5G6R5_UNORM, UNORM, C2, C1, C0, ONE, 5_6_5),
  
        _(L8_UNORM, UNORM, C0, C0, C0, ONE, 8),
 +      _(L8_SRGB,  UNORM, C0, C0, C0, ONE, 8),
        _(A8_UNORM, UNORM, ZERO, ZERO, ZERO, C0, 8),
        _(I8_UNORM, UNORM, C0, C0, C0, C0, 8),
  
index c48684fe51f0eca2461ca3bf594cffd906b66ae7,b7ad6b2020608169d2939ef541537aa1945e3585..a60b12844d6398b32816ad9681020ffd2f255cf1
@@@ -106,11 -111,11 +111,11 @@@ static void r300_hw_copy(struct pipe_co
      util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state);
  
      util_blitter_save_fragment_sampler_states(
-         r300->blitter, r300->sampler_count, (void**)r300->sampler_states);
+         r300->blitter, state->sampler_count, (void**)state->sampler_states);
  
 -    util_blitter_save_fragment_sampler_textures(
 -        r300->blitter, state->texture_count,
 -        (struct pipe_texture**)state->textures);
 +    util_blitter_save_fragment_sampler_views(
 +        r300->blitter, r300->fragment_sampler_view_count,
 +        r300->fragment_sampler_views);
  
      /* Do a copy */
      util_blitter_copy(r300->blitter,
index 2edf65797a21dcc38477c0dc927ac3e3ba03e233,985e33911263f073c5430e2d48935047f32c149c..3b70bcda8273f41a09afee1a3d9565f8c56346fe
@@@ -295,16 -340,16 +340,17 @@@ struct r300_context 
      struct r300_atom rs_state;
      /* RS block state. */
      struct r300_atom rs_block_state;
-     /* Sampler states. */
-     struct r300_sampler_state* sampler_states[8];
-     int sampler_count;
      /* Scissor state. */
      struct r300_atom scissor_state;
 -    /* Textures state. */
 -    struct r300_atom textures_state;
 +    /* Sampler view states. */
 +    struct pipe_sampler_view* fragment_sampler_views[8];
 +    int fragment_sampler_view_count;
+     /* Vertex stream formatting state. */
+     struct r300_atom vertex_stream_state;
+     /* VAP (vertex shader) output mapping state. */
+     struct r300_atom vap_output_state;
      /* Vertex shader. */
-     struct r300_vertex_shader* vs;
+     struct r300_atom vs_state;
      /* Viewport state. */
      struct r300_atom viewport_state;
      /* ZTOP state. */
Simple merge
index e5ec2701c8175d345bd85433ef2241b168e7cf23,bd4c2766cb1426859c0fe11a538ef78ee8759a01..09bbf6c60e2c03699021ef0b2f551684a95fb3c4
@@@ -932,31 -923,30 +923,32 @@@ static void r300_delete_sampler_state(s
      FREE(state);
  }
  
 -static void r300_set_sampler_textures(struct pipe_context* pipe,
 -                                      unsigned count,
 -                                      struct pipe_texture** texture)
 +static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
 +                                            unsigned count,
 +                                            struct pipe_sampler_view** views)
  {
      struct r300_context* r300 = r300_context(pipe);
 -    struct r300_textures_state* state =
 -        (struct r300_textures_state*)r300->textures_state.state;
+     unsigned i;
      boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
-     int i;
+     boolean dirty_tex = FALSE;
  
      /* XXX magic num */
      if (count > 8) {
          return;
      }
-     
      for (i = 0; i < count; i++) {
 -        if (state->textures[i] != (struct r300_texture*)texture[i]) {
 -            pipe_texture_reference((struct pipe_texture**)&state->textures[i],
 -                                   texture[i]);
 +        if (r300->fragment_sampler_views[i] != views[i]) {
 +            struct r300_texture *texture;
 +
 +            pipe_sampler_view_reference(&r300->fragment_sampler_views[i],
 +                views[i]);
-             r300->dirty_state |= (R300_NEW_TEXTURE << i);
+             dirty_tex = TRUE;
  
 -            /* R300-specific - set the texrect factor in the fragment shader */
 -            if (!is_r500 && state->textures[i]->is_npot) {
 +            texture = (struct r300_texture *)views[i]->texture;
 +
 +            /* R300-specific - set the texrect factor in a fragment shader */
 +            if (!is_r500 && texture->is_npot) {
                  /* XXX It would be nice to re-emit just 1 constant,
                   * XXX not all of them */
                  r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
      }
  
      for (i = count; i < 8; i++) {
 -        if (state->textures[i]) {
 -            pipe_texture_reference((struct pipe_texture**)&state->textures[i],
 +        if (r300->fragment_sampler_views[i]) {
 +            pipe_sampler_view_reference(&r300->fragment_sampler_views[i],
                  NULL);
-             r300->dirty_state |= (R300_NEW_TEXTURE << i);
          }
      }
  
 -    state->texture_count = count;
 +    r300->fragment_sampler_view_count = count;
+     r300->textures_state.dirty = TRUE;
+     if (dirty_tex) {
+         r300->texture_cache_inval.dirty = TRUE;
+     }
  }
  
 +static struct pipe_sampler_view *
 +r300_create_sampler_view(struct pipe_context *pipe,
 +                         struct pipe_texture *texture,
 +                         const struct pipe_sampler_view *templ)
 +{
 +   struct r300_context *r300 = r300_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;
 +
 +   return view;
 +}
 +
 +
 +static void
 +r300_sampler_view_destroy(struct pipe_context *pipe,
 +                          struct pipe_sampler_view *view)
 +{
 +   pipe_texture_reference(&view->texture, NULL);
 +   FREE(view);
 +}
 +
  static void r300_set_scissor_state(struct pipe_context* pipe,
                                     const struct pipe_scissor_state* state)
  {
index 2f0f51de2c473594fabaada80bed3e41fbac10ce,9a8158e6a22978f47bdcbe213cbc8ee25f7efd4c..75e03c8ae6b179b9587a9e14a3ab53f45de93b8d
@@@ -68,17 -70,15 +70,15 @@@ struct softpipe_context 
     struct pipe_framebuffer_state framebuffer;
     struct pipe_poly_stipple poly_stipple;
     struct pipe_scissor_state scissor;
 -   struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
 -   struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS];
 +   struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
 +   struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
     struct pipe_viewport_state viewport;
     struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
-    struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
  
     unsigned num_samplers;
 -   unsigned num_textures;
 +   unsigned num_sampler_views;
     unsigned num_vertex_samplers;
 -   unsigned num_vertex_textures;
 +   unsigned num_vertex_sampler_views;
-    unsigned num_vertex_elements;
     unsigned num_vertex_buffers;
  
     unsigned dirty; /**< Mask of SP_NEW_x flags */
index b1022c3c99698412a7f7b935e0930bd13efe45bc,791d30edc0ec85b30c84e52f9c51655f17e1a454..1f66437dfe1aa033cccddfa6c333886bd6a9cb06
@@@ -178,8 -183,9 +183,9 @@@ struct svga_stat
     const struct svga_depth_stencil_state *depth;
     const struct svga_rasterizer_state *rast;
     const struct svga_sampler_state *sampler[PIPE_MAX_SAMPLERS];
+    const struct svga_velems_state *velems;
  
 -   struct pipe_texture *texture[PIPE_MAX_SAMPLERS]; /* or texture ID's? */
 +   struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS]; /* or texture ID's? */
     struct svga_fragment_shader *fs;
     struct svga_vertex_shader *vs;
  
     struct pipe_viewport_state viewport;
  
     unsigned num_samplers;
 -   unsigned num_textures;
 +   unsigned num_sampler_views;
-    unsigned num_vertex_elements;
     unsigned num_vertex_buffers;
     unsigned reduced_prim;
  
index 50fe962b28d8744e7fa751c9073f392a4ba187e2,1a8ef296cac09eb4064c994f184e26fdcd76d620..ebd1b9499728f4b57fa5741b08f691439751fdc9
@@@ -220,16 -195,16 +220,16 @@@ static void svga_set_sampler_views(stru
     }
  
     for (i = 0; i < num; i++) {
 -      pipe_texture_reference(&svga->curr.texture[i],
 -                             texture[i]);
 +      pipe_sampler_view_reference(&svga->curr.sampler_views[i],
 +                                  views[i]);
  
 -      if (!texture[i])
 +      if (!views[i])
           continue;
  
-       if (views[i]->texture->format == PIPE_FORMAT_A8R8G8B8_SRGB)
 -      if (texture[i]->format == PIPE_FORMAT_B8G8R8A8_SRGB)
++      if (views[i]->texture->format == PIPE_FORMAT_B8G8R8A8_SRGB)
           flag_srgb |= 1 << i;
  
 -      if (texture[i]->target == PIPE_TEXTURE_1D)
 +      if (views[i]->texture->target == PIPE_TEXTURE_1D)
           flag_1d |= 1 << i;
     }
  
index c84cbd0e521bf58a7e5ab7ed741530c3285a182e,133521f45e2bce9fcd2081dd576825039f23d334..f9555fb922c1bcc75caedb7a84d8d7a9ddf9f35d
@@@ -1368,12 -1355,9 +1412,11 @@@ trace_context_create(struct trace_scree
     tr_ctx->base.set_polygon_stipple = trace_context_set_polygon_stipple;
     tr_ctx->base.set_scissor_state = trace_context_set_scissor_state;
     tr_ctx->base.set_viewport_state = trace_context_set_viewport_state;
 -   tr_ctx->base.set_fragment_sampler_textures = trace_context_set_fragment_sampler_textures;
 -   tr_ctx->base.set_vertex_sampler_textures = trace_context_set_vertex_sampler_textures;
 +   tr_ctx->base.set_fragment_sampler_views = trace_context_set_fragment_sampler_views;
 +   tr_ctx->base.set_vertex_sampler_views = trace_context_set_vertex_sampler_views;
 +   tr_ctx->base.create_sampler_view = trace_create_sampler_view;
 +   tr_ctx->base.sampler_view_destroy = trace_sampler_view_destroy;
     tr_ctx->base.set_vertex_buffers = trace_context_set_vertex_buffers;
-    tr_ctx->base.set_vertex_elements = trace_context_set_vertex_elements;
     if (pipe->surface_copy)
        tr_ctx->base.surface_copy = trace_context_surface_copy;
     if (pipe->surface_fill)
Simple merge
Simple merge
Simple merge
index d5a14fd795dc283b0f4bae00301f4f174ab5ba7c,335e8e7f0d854c1d6dc7b8a3443c47d0d6b29ad5..0d87c705e7582de34b208d1b0c4b6c00a408c9fb
  #include "cso_cache/cso_context.h"
  #include "util/u_math.h"
  #include "util/u_memory.h"
 +#include "util/u_sampler.h"
  #include "util/u_simple_shaders.h"
- #include "trace/tr_screen.h"
- #include "trace/tr_context.h"
+ #include "trace/tr_public.h"
  
  #include "st_device.h"
  #include "st_winsys.h"