gallium: new, unified pipe_context::set_sampler_views() function
authorBrian Paul <brianp@vmware.com>
Tue, 8 Oct 2013 00:16:22 +0000 (18:16 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 23 Oct 2013 16:15:38 +0000 (10:15 -0600)
The new function replaces four old functions: set_fragment/vertex/
geometry/compute_sampler_views().

Note: at this time, it's expected that the 'start' parameter will
always be zero.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
44 files changed:
src/gallium/auxiliary/cso_cache/cso_context.c
src/gallium/auxiliary/draw/draw_pipe_aaline.c
src/gallium/auxiliary/draw/draw_pipe_pstipple.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_idct.c
src/gallium/auxiliary/vl/vl_matrix_filter.c
src/gallium/auxiliary/vl/vl_mc.c
src/gallium/auxiliary/vl/vl_median_filter.c
src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
src/gallium/auxiliary/vl/vl_zscan.c
src/gallium/docs/d3d11ddi.txt
src/gallium/docs/source/context.rst
src/gallium/drivers/freedreno/freedreno_texture.c
src/gallium/drivers/galahad/glhd_context.c
src/gallium/drivers/i915/i915_state.c
src/gallium/drivers/identity/id_context.c
src/gallium/drivers/ilo/ilo_state.c
src/gallium/drivers/llvmpipe/lp_state_sampler.c
src/gallium/drivers/noop/noop_state.c
src/gallium/drivers/nouveau/nv30/nv30_context.h
src/gallium/drivers/nouveau/nv30/nv30_fragtex.c
src/gallium/drivers/nouveau/nv30/nv40_verttex.c
src/gallium/drivers/nouveau/nv50/nv50_state.c
src/gallium/drivers/nouveau/nvc0/nvc0_state.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r600/evergreen_compute.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/rbug/rbug_context.c
src/gallium/drivers/softpipe/sp_state_sampler.c
src/gallium/drivers/svga/svga_pipe_sampler.c
src/gallium/drivers/trace/tr_context.c
src/gallium/include/pipe/p_context.h
src/gallium/tests/graw/fs-test.c
src/gallium/tests/graw/gs-test.c
src/gallium/tests/graw/quad-sample.c
src/gallium/tests/graw/quad-tex.c
src/gallium/tests/graw/tex-srgb.c
src/gallium/tests/graw/tex-swizzle.c
src/gallium/tests/graw/vs-test.c
src/gallium/tests/trivial/compute.c
src/gallium/tools/trace/dump_state.py

index 4d7c38712562bda36dc90aacf5c3efcbfe115f00..23d3245e881b53e8fc1d7affd8ca40b13a09c435 100644 (file)
@@ -306,6 +306,7 @@ void cso_release_all( struct cso_context *ctx )
       ctx->pipe->bind_rasterizer_state( ctx->pipe, NULL );
 
       {
+         static struct pipe_sampler_view *views[PIPE_MAX_SAMPLERS] = { NULL };
          static void *zeros[PIPE_MAX_SAMPLERS] = { NULL };
          struct pipe_screen *scr = ctx->pipe->screen;
          unsigned sh;
@@ -315,6 +316,7 @@ void cso_release_all( struct cso_context *ctx )
             assert(max <= PIPE_MAX_SAMPLERS);
             if (max > 0) {
                ctx->pipe->bind_sampler_states(ctx->pipe, sh, 0, max, zeros);
+               ctx->pipe->set_sampler_views(ctx->pipe, sh, 0, max, views);
             }
          }
       }
@@ -323,9 +325,7 @@ void cso_release_all( struct cso_context *ctx )
       ctx->pipe->bind_fs_state( ctx->pipe, NULL );
       ctx->pipe->bind_vs_state( ctx->pipe, NULL );
       ctx->pipe->bind_vertex_elements_state( ctx->pipe, NULL );
-      ctx->pipe->set_fragment_sampler_views(ctx->pipe, 0, NULL);
-      if (ctx->pipe->set_vertex_sampler_views)
-         ctx->pipe->set_vertex_sampler_views(ctx->pipe, 0, NULL);
+
       if (ctx->pipe->set_stream_output_targets)
          ctx->pipe->set_stream_output_targets(ctx->pipe, 0, NULL, 0);
    }
@@ -1185,19 +1185,8 @@ cso_set_sampler_views(struct cso_context *ctx,
    info->nr_views = count;
 
    /* bind the new sampler views */
-   switch (shader_stage) {
-   case PIPE_SHADER_FRAGMENT:
-      ctx->pipe->set_fragment_sampler_views(ctx->pipe, count, info->views);
-      break;
-   case PIPE_SHADER_VERTEX:
-      ctx->pipe->set_vertex_sampler_views(ctx->pipe, count, info->views);
-      break;
-   case PIPE_SHADER_GEOMETRY:
-      ctx->pipe->set_geometry_sampler_views(ctx->pipe, count, info->views);
-      break;
-   default:
-      assert(!"bad shader type in cso_set_sampler_views()");
-   }
+   ctx->pipe->set_sampler_views(ctx->pipe, shader_stage, 0, count,
+                                info->views);
 }
 
 
@@ -1236,19 +1225,7 @@ cso_restore_sampler_views(struct cso_context *ctx, unsigned shader_stage)
    num = MAX2(info->nr_views, nr_saved);
 
    /* bind the old/saved sampler views */
-   switch (shader_stage) {
-   case PIPE_SHADER_FRAGMENT:
-      ctx->pipe->set_fragment_sampler_views(ctx->pipe, num, info->views);
-      break;
-   case PIPE_SHADER_VERTEX:
-      ctx->pipe->set_vertex_sampler_views(ctx->pipe, num, info->views);
-      break;
-   case PIPE_SHADER_GEOMETRY:
-      ctx->pipe->set_geometry_sampler_views(ctx->pipe, num, info->views);
-      break;
-   default:
-      assert(!"bad shader type in cso_restore_sampler_views()");
-   }
+   ctx->pipe->set_sampler_views(ctx->pipe, shader_stage, 0, num, info->views);
 
    info->nr_views = nr_saved;
    info->nr_views_saved = 0;
index 3c93bf7f7224fabfcd5eb34f634610c28135597d..d00b721f190ebf80a144b1d2cd7698b91cd66f64 100644 (file)
@@ -121,8 +121,8 @@ struct aaline_stage
    void (*driver_bind_sampler_states)(struct pipe_context *, unsigned, unsigned,
                                       unsigned, void **);
 
-   void (*driver_set_sampler_views)(struct pipe_context *,
-                                    unsigned,
+   void (*driver_set_sampler_views)(struct pipe_context *, unsigned shader,
+                                    unsigned start, unsigned count,
                                     struct pipe_sampler_view **);
 };
 
@@ -708,7 +708,8 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header)
    aaline->driver_bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0,
                                       num_samplers, aaline->state.sampler);
 
-   aaline->driver_set_sampler_views(pipe, num_samplers, aaline->state.sampler_views);
+   aaline->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
+                                    num_samplers, aaline->state.sampler_views);
 
    /* Disable triangle culling, stippling, unfilled mode etc. */
    r = draw_get_rasterizer_no_cull(draw, rast->scissor, rast->flatshade);
@@ -740,8 +741,8 @@ aaline_flush(struct draw_stage *stage, unsigned flags)
                                       aaline->num_samplers,
                                       aaline->state.sampler);
 
-   aaline->driver_set_sampler_views(pipe,
-                                    aaline->num_sampler_views,
+   aaline->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
+                                    aaline->num_samplers,
                                     aaline->state.sampler_views);
 
    /* restore original rasterizer state */
@@ -791,7 +792,7 @@ aaline_destroy(struct draw_stage *stage)
    pipe->delete_fs_state = aaline->driver_delete_fs_state;
 
    pipe->bind_sampler_states = aaline->driver_bind_sampler_states;
-   pipe->set_fragment_sampler_views = aaline->driver_set_sampler_views;
+   pipe->set_sampler_views = aaline->driver_set_sampler_views;
 
    FREE( stage );
 }
@@ -932,8 +933,8 @@ aaline_bind_sampler_states(struct pipe_context *pipe, unsigned shader,
 
 
 static void
-aaline_set_sampler_views(struct pipe_context *pipe,
-                         unsigned num,
+aaline_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+                         unsigned start, unsigned num,
                          struct pipe_sampler_view **views)
 {
    struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
@@ -943,17 +944,17 @@ aaline_set_sampler_views(struct pipe_context *pipe,
       return;
    }
 
-   /* save current */
-   for (i = 0; i < num; i++) {
-      pipe_sampler_view_reference(&aaline->state.sampler_views[i], views[i]);
-   }
-   for ( ; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
-      pipe_sampler_view_reference(&aaline->state.sampler_views[i], NULL);
+   if (shader == PIPE_SHADER_FRAGMENT) {
+      /* save current */
+      for (i = 0; i < num; i++) {
+         pipe_sampler_view_reference(&aaline->state.sampler_views[start + i],
+                                     views[i]);
+      }
+      aaline->num_sampler_views = num;
    }
-   aaline->num_sampler_views = num;
 
    /* pass-through */
-   aaline->driver_set_sampler_views(pipe, num, views);
+   aaline->driver_set_sampler_views(pipe, shader, start, num, views);
 }
 
 
@@ -1008,7 +1009,7 @@ draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe)
    aaline->driver_delete_fs_state = pipe->delete_fs_state;
 
    aaline->driver_bind_sampler_states = pipe->bind_sampler_states;
-   aaline->driver_set_sampler_views = pipe->set_fragment_sampler_views;
+   aaline->driver_set_sampler_views = pipe->set_sampler_views;
 
    /* override the driver's functions */
    pipe->create_fs_state = aaline_create_fs_state;
@@ -1016,7 +1017,7 @@ draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe)
    pipe->delete_fs_state = aaline_delete_fs_state;
 
    pipe->bind_sampler_states = aaline_bind_sampler_states;
-   pipe->set_fragment_sampler_views = aaline_set_sampler_views;
+   pipe->set_sampler_views = aaline_set_sampler_views;
    
    /* Install once everything is known to be OK:
     */
index e39276a55d38b0bb2e6de29759bbbfa1551190ba..17b1d3d7039d4124a34d168c26b6b88464838122 100644 (file)
@@ -103,7 +103,8 @@ struct pstip_stage
                                       unsigned, unsigned, void **);
 
    void (*driver_set_sampler_views)(struct pipe_context *,
-                                    unsigned,
+                                    unsigned shader, unsigned start,
+                                    unsigned count,
                                     struct pipe_sampler_view **);
 
    void (*driver_set_polygon_stipple)(struct pipe_context *,
@@ -552,7 +553,9 @@ pstip_first_tri(struct draw_stage *stage, struct prim_header *header)
    pstip->driver_bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0,
                                      num_samplers, pstip->state.samplers);
 
-   pstip->driver_set_sampler_views(pipe, num_samplers, pstip->state.sampler_views);
+   pstip->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
+                                   num_samplers, pstip->state.sampler_views);
+
    draw->suspend_flushing = FALSE;
 
    /* now really draw first triangle */
@@ -579,9 +582,10 @@ pstip_flush(struct draw_stage *stage, unsigned flags)
                                      pstip->num_samplers,
                                      pstip->state.samplers);
 
-   pstip->driver_set_sampler_views(pipe,
+   pstip->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
                                    pstip->num_sampler_views,
                                    pstip->state.sampler_views);
+
    draw->suspend_flushing = FALSE;
 }
 
@@ -732,24 +736,23 @@ pstip_bind_sampler_states(struct pipe_context *pipe, unsigned shader,
 
 static void
 pstip_set_sampler_views(struct pipe_context *pipe,
-                        unsigned num,
+                        unsigned shader, unsigned start, unsigned num,
                         struct pipe_sampler_view **views)
 {
    struct pstip_stage *pstip = pstip_stage_from_pipe(pipe);
    uint i;
 
-   /* save current */
-   for (i = 0; i < num; i++) {
-      pipe_sampler_view_reference(&pstip->state.sampler_views[i], views[i]);
-   }
-   for (; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
-      pipe_sampler_view_reference(&pstip->state.sampler_views[i], NULL);
+   if (shader == PIPE_SHADER_FRAGMENT) {
+      /* save current */
+      for (i = 0; i < num; i++) {
+         pipe_sampler_view_reference(&pstip->state.sampler_views[start + i],
+                                     views[i]);
+      }
+      pstip->num_sampler_views = num;
    }
 
-   pstip->num_sampler_views = num;
-
    /* pass-through */
-   pstip->driver_set_sampler_views(pstip->pipe, num, views);
+   pstip->driver_set_sampler_views(pstip->pipe, shader, start, num, views);
 }
 
 
@@ -804,7 +807,7 @@ draw_install_pstipple_stage(struct draw_context *draw,
    pstip->driver_delete_fs_state = pipe->delete_fs_state;
 
    pstip->driver_bind_sampler_states = pipe->bind_sampler_states;
-   pstip->driver_set_sampler_views = pipe->set_fragment_sampler_views;
+   pstip->driver_set_sampler_views = pipe->set_sampler_views;
    pstip->driver_set_polygon_stipple = pipe->set_polygon_stipple;
 
    /* override the driver's functions */
@@ -813,7 +816,7 @@ draw_install_pstipple_stage(struct draw_context *draw,
    pipe->delete_fs_state = pstip_delete_fs_state;
 
    pipe->bind_sampler_states = pstip_bind_sampler_states;
-   pipe->set_fragment_sampler_views = pstip_set_sampler_views;
+   pipe->set_sampler_views = pstip_set_sampler_views;
    pipe->set_polygon_stipple = pstip_set_polygon_stipple;
 
    return TRUE;
index a51b9ef20b35d0c901bc4719eba38921534c043d..096d3bc2b98845b22a3493fc5ae45a02fbda4cd2 100644 (file)
@@ -535,9 +535,9 @@ static void blitter_restore_textures(struct blitter_context_priv *ctx)
    ctx->base.saved_num_sampler_states = ~0;
 
    /* Fragment sampler views. */
-   pipe->set_fragment_sampler_views(pipe,
-                                    ctx->base.saved_num_sampler_views,
-                                    ctx->base.saved_sampler_views);
+   pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
+                           ctx->base.saved_num_sampler_views,
+                           ctx->base.saved_sampler_views);
 
    for (i = 0; i < ctx->base.saved_num_sampler_views; i++)
       pipe_sampler_view_reference(&ctx->base.saved_sampler_views[i], NULL);
@@ -1309,7 +1309,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
       views[0] = src;
       views[1] = pipe->create_sampler_view(pipe, src->texture, &templ);
 
-      pipe->set_fragment_sampler_views(pipe, 2, views);
+      pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 2, views);
       pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0, 2, samplers);
 
       pipe_sampler_view_reference(&views[1], NULL);
@@ -1324,13 +1324,13 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
 
       view = pipe->create_sampler_view(pipe, src->texture, &templ);
 
-      pipe->set_fragment_sampler_views(pipe, 1, &view);
+      pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &view);
       pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT,
                                 0, 1, &sampler_state);
 
       pipe_sampler_view_reference(&view, NULL);
    } else {
-      pipe->set_fragment_sampler_views(pipe, 1, &src);
+      pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &src);
       pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT,
                                 0, 1, &sampler_state);
    }
index db4c697828fb9f0fd0a29a5aff1a2466ad9fb582..1c8312e9d06738bdb8e9b73b5d54dc8a02f865c2 100644 (file)
@@ -727,7 +727,9 @@ draw_layers(struct vl_compositor *c, struct vl_compositor_state *s, struct u_rec
          c->pipe->bind_fs_state(c->pipe, layer->fs);
          c->pipe->bind_sampler_states(c->pipe, PIPE_SHADER_FRAGMENT, 0,
                                       num_sampler_views, layer->samplers);
-         c->pipe->set_fragment_sampler_views(c->pipe, num_sampler_views, samplers);
+         c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0,
+                                    num_sampler_views, samplers);
+
          util_draw_arrays(c->pipe, PIPE_PRIM_QUADS, vb_index * 4, 4);
          vb_index++;
 
index dc14bb71b46bd402fc91c0d50d703292d3113ebd..79adb045dad4ed6cf21dee3447c28c72e8a047b3 100644 (file)
@@ -829,7 +829,8 @@ vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_
    idct->pipe->bind_sampler_states(idct->pipe, PIPE_SHADER_FRAGMENT,
                                    0, 2, idct->samplers);
 
-   idct->pipe->set_fragment_sampler_views(idct->pipe, 2, buffer->sampler_views.stage[0]);
+   idct->pipe->set_sampler_views(idct->pipe, PIPE_SHADER_FRAGMENT, 0, 2,
+                                 buffer->sampler_views.stage[0]);
 
    /* mismatch control */
    idct->pipe->set_framebuffer_state(idct->pipe, &buffer->fb_state_mismatch);
@@ -855,6 +856,7 @@ vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer)
    idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state);
    idct->pipe->bind_sampler_states(idct->pipe, PIPE_SHADER_FRAGMENT,
                                    0, 2, idct->samplers);
-   idct->pipe->set_fragment_sampler_views(idct->pipe, 2, buffer->sampler_views.stage[1]);
+   idct->pipe->set_sampler_views(idct->pipe, PIPE_SHADER_FRAGMENT,
+                                 0, 2, buffer->sampler_views.stage[1]);
 }
 
index b7c88e776b69c87b18a8885def6f8983a53722ca..56b7003f0fc3e39a79099272308b9f3dd423b7f7 100644 (file)
@@ -308,7 +308,8 @@ vl_matrix_filter_render(struct vl_matrix_filter *filter,
    filter->pipe->bind_blend_state(filter->pipe, filter->blend);
    filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
                                      0, 1, &filter->sampler);
-   filter->pipe->set_fragment_sampler_views(filter->pipe, 1, &src);
+   filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
+                                   0, 1, &src);
    filter->pipe->bind_vs_state(filter->pipe, filter->vs);
    filter->pipe->bind_fs_state(filter->pipe, filter->fs);
    filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
index bd75df164ab3fb5e7fa9fcaafa8e430a24012be4..7d4aee67c7b1fa7b155c45750c1b719ed92514ed 100644 (file)
@@ -613,7 +613,8 @@ vl_mc_render_ref(struct vl_mc *renderer, struct vl_mc_buffer *buffer, struct pip
    renderer->pipe->bind_vs_state(renderer->pipe, renderer->vs_ref);
    renderer->pipe->bind_fs_state(renderer->pipe, renderer->fs_ref);
 
-   renderer->pipe->set_fragment_sampler_views(renderer->pipe, 1, &ref);
+   renderer->pipe->set_sampler_views(renderer->pipe, PIPE_SHADER_FRAGMENT,
+                                     0, 1, &ref);
    renderer->pipe->bind_sampler_states(renderer->pipe, PIPE_SHADER_FRAGMENT,
                                        0, 1, &renderer->sampler_ref);
 
index f5ef117893d26cc5413d4b3e9e5cee26b227b000..6d98392d6e916e2af29b7d2bcb47c1331c54e935 100644 (file)
@@ -387,7 +387,8 @@ vl_median_filter_render(struct vl_median_filter *filter,
    filter->pipe->bind_blend_state(filter->pipe, filter->blend);
    filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
                                      0, 1, &filter->sampler);
-   filter->pipe->set_fragment_sampler_views(filter->pipe, 1, &src);
+   filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
+                                   0, 1, &src);
    filter->pipe->bind_vs_state(filter->pipe, filter->vs);
    filter->pipe->bind_fs_state(filter->pipe, filter->fs);
    filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
index bc207ac725d5a830bca6f5c2e8d55e87f77be69d..ca4eb3ef6aa68eb6ea265fe912f405836a9d56b6 100644 (file)
@@ -746,7 +746,9 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder,
          if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT)
             vl_idct_prepare_stage2(i ? &dec->idct_c : &dec->idct_y, &buf->idct[plane]);
          else {
-            dec->base.context->set_fragment_sampler_views(dec->base.context, 1, &mc_source_sv[plane]);
+            dec->base.context->set_sampler_views(dec->base.context,
+                                                 PIPE_SHADER_FRAGMENT, 0, 1,
+                                                 &mc_source_sv[plane]);
             dec->base.context->bind_sampler_states(dec->base.context,
                                                    PIPE_SHADER_FRAGMENT,
                                                    0, 1, &dec->sampler_ycbcr);
index 2d616d57c7a305c29207d2959818fd8ff12da55c..40502ae633fd55623dab1261df0bbdf76c99d9ce 100644 (file)
@@ -578,7 +578,8 @@ vl_zscan_render(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned
                                     0, 3, zscan->samplers);
    zscan->pipe->set_framebuffer_state(zscan->pipe, &buffer->fb_state);
    zscan->pipe->set_viewport_states(zscan->pipe, 0, 1, &buffer->viewport);
-   zscan->pipe->set_fragment_sampler_views(zscan->pipe, 3, &buffer->src);
+   zscan->pipe->set_sampler_views(zscan->pipe, PIPE_SHADER_FRAGMENT,
+                                  0, 3, &buffer->src);
    zscan->pipe->bind_vs_state(zscan->pipe, zscan->vs);
    zscan->pipe->bind_fs_state(zscan->pipe, zscan->fs);
    util_draw_arrays_instanced(zscan->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances);
index 14a589fffe284432ccfce412d72b70e07a6456bb..a7036481411843666907eea1083acb877821f298 100644 (file)
@@ -343,7 +343,7 @@ PsSetShader -> bind_fs_state
 PsSetShaderWithIfaces (D3D11 only)
        - Gallium does not support shader interfaces
 
-PsSetShaderResources -> set_fragment_sampler_views
+PsSetShaderResources -> set_sampler_views
        * may want to allow binding subsets instead of all at once
 
 QueryBegin -> begin_query
@@ -458,5 +458,5 @@ VsSetShader -> bind_vs_state
 VsSetShaderWithIfaces (D3D11 only)
        - Gallium does not support shader interfaces
 
-VsSetShaderResources  -> set_fragment_sampler_views
+VsSetShaderResources  -> set_sampler_views
        * may want to allow binding subsets instead of all at once
index e471eebd66e4acefbc5d0025082b5d1a806dd6a9..1037162aefb333f44911683b5d3db29513af169d 100644 (file)
@@ -104,16 +104,10 @@ The ``first_layer`` and ``last_layer`` fields specify the layer range the
 texture is going to be constrained to. Similar to the LOD range, this is added
 to the array index which is used for sampling.
 
-* ``set_fragment_sampler_views`` binds an array of sampler views to
-  fragment shader stage. Every binding point acquires a reference
+* ``set_sampler_views`` binds an array of sampler views to a shader stage.
+  Every binding point acquires a reference
   to a respective sampler view and releases a reference to the previous
-  sampler view.  If M is the maximum number of sampler units and N units
-  is passed to set_fragment_sampler_views, the driver should unbind the
-  sampler views for units N..M-1.
-
-* ``set_vertex_sampler_views`` binds an array of sampler views to vertex
-  shader stage. Every binding point acquires a reference to a respective
-  sampler view and releases a reference to the previous sampler view.
+  sampler view.
 
 * ``create_sampler_view`` creates a new sampler view. ``texture`` is associated
   with the sampler view which results in sampler view holding a reference
@@ -601,5 +595,5 @@ method.
 
 In addition, normal texture sampling is allowed from the compute
 program: ``bind_sampler_states`` may be used to set up texture
-samplers for the compute stage and ``set_compute_sampler_views`` may
+samplers for the compute stage and ``set_sampler_views`` may
 be used to bind a number of sampler views to it.
index fc0c8aa334640751ab7d4301e94edf22dfde32f3..bcc846f681994cd94124c66fb4067e52456b9536 100644 (file)
@@ -144,6 +144,24 @@ fd_verttex_set_sampler_views(struct pipe_context *pctx, unsigned nr,
        ctx->dirty |= FD_DIRTY_VERTTEX;
 }
 
+static void
+fd_set_sampler_views(struct pipe_context *pctx, unsigned shader,
+                     unsigne start, unsigned nr,
+                     struct pipe_sampler_view **views)
+{
+   assert(start == 0);
+   switch (shader) {
+   case PIPE_SHADER_FRAGMENT:
+      fd_fragtex_set_sampler_views(pctx, nr, views);
+      break;
+   case PIPE_SHADER_VERTEX:
+      fd_verttex_set_sampler_views(pctx, nr, views);
+      break;
+   default:
+      ;
+   }
+}
+
 void
 fd_texture_init(struct pipe_context *pctx)
 {
@@ -152,7 +170,5 @@ fd_texture_init(struct pipe_context *pctx)
        pctx->sampler_view_destroy = fd_sampler_view_destroy;
 
        pctx->bind_sampler_states = fd_sampler_states_bind;
-       pctx->set_fragment_sampler_views = fd_fragtex_set_sampler_views;
-
-       pctx->set_vertex_sampler_views = fd_verttex_set_sampler_views;
+       pctx->set_sampler_views = fd_set_sampler_views;
 }
index dc3d5f056dff84f8498e138d3188d0d1620d9694..0bb7abd3ac0e00dae5e5bea7dba0616f53e383ae 100644 (file)
@@ -519,58 +519,12 @@ galahad_context_set_sampler_views(struct pipe_context *_pipe,
    struct galahad_context *glhd_pipe = galahad_context(_pipe);
    struct pipe_context *pipe = glhd_pipe->pipe;
    struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS];
-   struct pipe_sampler_view **views = NULL;
    unsigned i;
 
-   if (_views) {
-      for (i = 0; i < num; i++)
-         unwrapped_views[i] = galahad_sampler_view_unwrap(_views[i]);
-      for (; i < PIPE_MAX_SAMPLERS; i++)
-         unwrapped_views[i] = NULL;
+   for (i = 0; i < num; i++)
+      unwrapped_views[i] = galahad_sampler_view_unwrap(_views[i]);
 
-      views = unwrapped_views;
-   }
-
-   switch (shader) {
-   case PIPE_SHADER_VERTEX:
-      pipe->set_vertex_sampler_views(pipe, num, views);
-      break;
-   case PIPE_SHADER_FRAGMENT:
-      pipe->set_fragment_sampler_views(pipe, num, views);
-      break;
-   case PIPE_SHADER_GEOMETRY:
-      pipe->set_geometry_sampler_views(pipe, num, views);
-      break;
-   default:
-      assert(0);
-   }
-}
-
-static void
-galahad_context_set_vertex_sampler_views(struct pipe_context *_pipe,
-                                         unsigned num,
-                                         struct pipe_sampler_view **_views)
-{
-   galahad_context_set_sampler_views(_pipe, PIPE_SHADER_VERTEX,
-                                     0, num, _views);
-}
-
-static void
-galahad_context_set_fragment_sampler_views(struct pipe_context *_pipe,
-                                           unsigned num,
-                                           struct pipe_sampler_view **_views)
-{
-   galahad_context_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT,
-                                     0, num, _views);
-}
-
-static void
-galahad_context_set_geometry_sampler_views(struct pipe_context *_pipe,
-                                           unsigned num,
-                                           struct pipe_sampler_view **_views)
-{
-   galahad_context_set_sampler_views(_pipe, PIPE_SHADER_GEOMETRY,
-                                     0, num, _views);
+   pipe->set_sampler_views(pipe, shader, start, num, unwrapped_views);
 }
 
 static void
@@ -1053,10 +1007,7 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
    GLHD_PIPE_INIT(set_polygon_stipple);
    GLHD_PIPE_INIT(set_scissor_states);
    GLHD_PIPE_INIT(set_viewport_states);
-   GLHD_PIPE_INIT(set_fragment_sampler_views);
-   GLHD_PIPE_INIT(set_vertex_sampler_views);
-   GLHD_PIPE_INIT(set_geometry_sampler_views);
-   //GLHD_PIPE_INIT(set_compute_sampler_views);
+   GLHD_PIPE_INIT(set_sampler_views);
    //GLHD_PIPE_INIT(set_shader_resources);
    GLHD_PIPE_INIT(set_vertex_buffers);
    GLHD_PIPE_INIT(set_index_buffer);
index f722e2dcfeb8c6ac2e537c6c4be87ad01c9f6c65..54c343cf2bfb4c7187ab7ae5fa50e386802e1542 100644 (file)
@@ -793,6 +793,25 @@ i915_set_vertex_sampler_views(struct pipe_context *pipe,
 }
 
 
+static void
+i915_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+                       unsigned start, unsigned num,
+                       struct pipe_sampler_view **views)
+{
+   assert(start == 0);
+   switch (shader) {
+   case PIPE_SHADER_FRAGMENT:
+      i915_set_fragment_sampler_views(pipe, num, views);
+      break;
+   case PIPE_SHADER_VERTEX:
+      i915_set_vertex_sampler_views(pipe, num, views);
+      break;
+   default:
+      ;
+   }
+}
+
+
 static struct pipe_sampler_view *
 i915_create_sampler_view(struct pipe_context *pipe,
                          struct pipe_resource *texture,
@@ -1076,8 +1095,7 @@ i915_init_state_functions( struct i915_context *i915 )
 
    i915->base.set_polygon_stipple = i915_set_polygon_stipple;
    i915->base.set_scissor_states = i915_set_scissor_states;
-   i915->base.set_fragment_sampler_views = i915_set_fragment_sampler_views;
-   i915->base.set_vertex_sampler_views = i915_set_vertex_sampler_views;
+   i915->base.set_sampler_views = i915_set_sampler_views;
    i915->base.create_sampler_view = i915_create_sampler_view;
    i915->base.sampler_view_destroy = i915_sampler_view_destroy;
    i915->base.set_viewport_states = i915_set_viewport_states;
index 0aff75f5e9fe80483d5e84fae659517f062a51bf..60e8860a2cbb21a1a3c2c3b4e406dd888518aff9 100644 (file)
@@ -486,50 +486,12 @@ identity_set_sampler_views(struct pipe_context *_pipe,
    struct identity_context *id_pipe = identity_context(_pipe);
    struct pipe_context *pipe = id_pipe->pipe;
    struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS];
-   struct pipe_sampler_view **views = NULL;
    unsigned i;
 
-   /* remove this when we have pipe->set_sampler_views(..., start, ...) */
-   assert(start == 0);
+   for (i = 0; i < num; i++)
+      unwrapped_views[i] = identity_sampler_view_unwrap(_views[i]);
 
-   if (_views) {
-      for (i = 0; i < num; i++)
-         unwrapped_views[i] = identity_sampler_view_unwrap(_views[i]);
-      for (; i < PIPE_MAX_SAMPLERS; i++)
-         unwrapped_views[i] = NULL;
-
-      views = unwrapped_views;
-   }
-
-   switch (shader) {
-   case PIPE_SHADER_VERTEX:
-      pipe->set_vertex_sampler_views(pipe, num, views);
-      break;
-   case PIPE_SHADER_GEOMETRY:
-      pipe->set_geometry_sampler_views(pipe, num, views);
-      break;
-   case PIPE_SHADER_FRAGMENT:
-      pipe->set_fragment_sampler_views(pipe, num, views);
-      break;
-   default:
-      debug_error("Unexpected shader in identity_set_sampler_views()");
-   }
-}
-
-static void
-identity_set_fragment_sampler_views(struct pipe_context *_pipe,
-                                    unsigned num,
-                                    struct pipe_sampler_view **_views)
-{
-   identity_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT, 0, num, _views);
-}
-
-static void
-identity_set_vertex_sampler_views(struct pipe_context *_pipe,
-                                  unsigned num,
-                                  struct pipe_sampler_view **_views)
-{
-   identity_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, 0, num, _views);
+   pipe->set_sampler_views(pipe, shader, start, num, unwrapped_views);
 }
 
 static void
@@ -894,8 +856,7 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
    id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple;
    id_pipe->base.set_scissor_states = identity_set_scissor_states;
    id_pipe->base.set_viewport_states = identity_set_viewport_states;
-   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_sampler_views = identity_set_sampler_views;
    id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers;
    id_pipe->base.set_index_buffer = identity_set_index_buffer;
    id_pipe->base.resource_copy_region = identity_resource_copy_region;
index caad308ab3883d9bcf2697d4ed32a1e305f0152f..91d7c7637f4cca3c3c4ea3d92fc174c32538d6a9 100644 (file)
@@ -892,6 +892,28 @@ ilo_set_compute_sampler_views(struct pipe_context *pipe,
    ilo->dirty |= ILO_DIRTY_VIEW_CS;
 }
 
+static void
+ilo_set_sampler_views2(struct pipe_context *pipe, unsigned shader,
+                       unsigned start_slot, unsigned num_views,
+                       struct pipe_sampler_view **views)
+{
+   switch (shader) {
+   case PIPE_SHADER_VERTEX:
+      ilo_set_vertex_sampler_views(pipe, num_views, views);
+      break;
+   case PIPE_SHADER_GEOMETRY:
+      ilo_set_geometry_sampler_views(pipe, num_views, views);
+      break;
+   case PIPE_SHADER_FRAGMENT:
+      ilo_set_fragment_sampler_views(pipe, num_views, views);
+      break;
+   case PIPE_SHADER_COMPUTE:
+      ilo_set_compute_sampler_views(pipe, start_slot, num_views, views);
+      break;
+   }
+}
+
+
 static void
 ilo_set_shader_resources(struct pipe_context *pipe,
                          unsigned start, unsigned count,
@@ -1289,10 +1311,7 @@ ilo_init_state_functions(struct ilo_context *ilo)
    ilo->base.set_polygon_stipple = ilo_set_polygon_stipple;
    ilo->base.set_scissor_states = ilo_set_scissor_states;
    ilo->base.set_viewport_states = ilo_set_viewport_states;
-   ilo->base.set_fragment_sampler_views = ilo_set_fragment_sampler_views;
-   ilo->base.set_vertex_sampler_views = ilo_set_vertex_sampler_views;
-   ilo->base.set_geometry_sampler_views = ilo_set_geometry_sampler_views;
-   ilo->base.set_compute_sampler_views = ilo_set_compute_sampler_views;
+   ilo->base.set_sampler_views = ilo_set_sampler_views2;
    ilo->base.set_shader_resources = ilo_set_shader_resources;
    ilo->base.set_vertex_buffers = ilo_set_vertex_buffers;
    ilo->base.set_index_buffer = ilo_set_index_buffer;
index 6bf2fb860322c4a922e72dab5b165348bc8bbf08..1d3db0f25c7aa47b7341a9bdb406b05f5483363d 100644 (file)
@@ -159,32 +159,6 @@ llvmpipe_set_sampler_views(struct pipe_context *pipe,
 }
 
 
-static void
-llvmpipe_set_fragment_sampler_views(struct pipe_context *pipe,
-                                    unsigned num,
-                                    struct pipe_sampler_view **views)
-{
-   llvmpipe_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, views);
-}
-
-
-static void
-llvmpipe_set_vertex_sampler_views(struct pipe_context *pipe,
-                                  unsigned num,
-                                  struct pipe_sampler_view **views)
-{
-   llvmpipe_set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, num, views);
-}
-
-
-static void
-llvmpipe_set_geometry_sampler_views(struct pipe_context *pipe,
-                                    unsigned num,
-                                    struct pipe_sampler_view **views)
-{
-   llvmpipe_set_sampler_views(pipe, PIPE_SHADER_GEOMETRY, 0, num, views);
-}
-
 static struct pipe_sampler_view *
 llvmpipe_create_sampler_view(struct pipe_context *pipe,
                             struct pipe_resource *texture,
@@ -395,10 +369,8 @@ llvmpipe_init_sampler_funcs(struct llvmpipe_context *llvmpipe)
    llvmpipe->pipe.create_sampler_state = llvmpipe_create_sampler_state;
 
    llvmpipe->pipe.bind_sampler_states = llvmpipe_bind_sampler_states;
-   llvmpipe->pipe.set_fragment_sampler_views = llvmpipe_set_fragment_sampler_views;
-   llvmpipe->pipe.set_vertex_sampler_views = llvmpipe_set_vertex_sampler_views;
-   llvmpipe->pipe.set_geometry_sampler_views = llvmpipe_set_geometry_sampler_views;
    llvmpipe->pipe.create_sampler_view = llvmpipe_create_sampler_view;
+   llvmpipe->pipe.set_sampler_views = llvmpipe_set_sampler_views;
    llvmpipe->pipe.sampler_view_destroy = llvmpipe_sampler_view_destroy;
    llvmpipe->pipe.delete_sampler_state = llvmpipe_delete_sampler_state;
 }
index 173e2cc6ba8bbf28d0000b0832d9eb8b8c082754..9c62c27c0a59702c6953605cf43aacfd6b096214 100644 (file)
@@ -124,13 +124,9 @@ static struct pipe_surface *noop_create_surface(struct pipe_context *ctx,
        return surface;
 }
 
-static void noop_set_vs_sampler_view(struct pipe_context *ctx, unsigned count,
-                                       struct pipe_sampler_view **views)
-{
-}
-
-static void noop_set_ps_sampler_view(struct pipe_context *ctx, unsigned count,
-                                       struct pipe_sampler_view **views)
+static void noop_set_sampler_views(struct pipe_context *ctx, unsigned shader,
+                                   unsigned start, unsigned count,
+                                   struct pipe_sampler_view **views)
 {
 }
 
@@ -312,7 +308,7 @@ void noop_init_state_functions(struct pipe_context *ctx)
        ctx->set_blend_color = noop_set_blend_color;
        ctx->set_clip_state = noop_set_clip_state;
        ctx->set_constant_buffer = noop_set_constant_buffer;
-       ctx->set_fragment_sampler_views = noop_set_ps_sampler_view;
+       ctx->set_sampler_views = noop_set_sampler_views;
        ctx->set_framebuffer_state = noop_set_framebuffer_state;
        ctx->set_polygon_stipple = noop_set_polygon_stipple;
        ctx->set_sample_mask = noop_set_sample_mask;
@@ -320,7 +316,6 @@ void noop_init_state_functions(struct pipe_context *ctx)
        ctx->set_stencil_ref = noop_set_stencil_ref;
        ctx->set_vertex_buffers = noop_set_vertex_buffers;
        ctx->set_index_buffer = noop_set_index_buffer;
-       ctx->set_vertex_sampler_views = noop_set_vs_sampler_view;
        ctx->set_viewport_states = noop_set_viewport_states;
        ctx->sampler_view_destroy = noop_sampler_view_destroy;
        ctx->surface_destroy = noop_surface_destroy;
index 292dcfe61a423a62a78fff8f01970effdbe79268..527614afc1427e909286f67dd40878d1a0d40f27 100644 (file)
@@ -194,6 +194,14 @@ void
 nv40_verttex_sampler_states_bind(struct pipe_context *pipe,
                                  unsigned nr, void **hwcso);
 
+void
+nv40_verttex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
+                               struct pipe_sampler_view **views);
+
+void
+nv30_fragtex_set_sampler_views(struct pipe_context *pipe,
+                               unsigned nr, struct pipe_sampler_view **views);
+
 void
 nv30_push_vbo(struct nv30_context *nv30, const struct pipe_draw_info *info);
 
index 87e66cc6d917d21da601f6623c18c860e69ce8a7..4ab31d1416966bb1d498dafb9ba6f4d453e4e193 100644 (file)
@@ -171,7 +171,7 @@ nv30_fragtex_sampler_states_bind(struct pipe_context *pipe,
 }
 
 
-static void
+void
 nv30_fragtex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
                                struct pipe_sampler_view **views)
 {
@@ -194,8 +194,28 @@ nv30_fragtex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
    nv30->dirty |= NV30_NEW_FRAGTEX;
 }
 
+
+static void
+nv30_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+                       unsigned start, unsigned nr,
+                       struct pipe_sampler_view **views)
+{
+   assert(start == 0);
+   switch (shader) {
+   case PIPE_SHADER_FRAGMENT:
+      nv30_fragtex_set_sampler_views(pipe, nr, views);
+      break;
+   case PIPE_SHADER_VERTEX:
+      nv40_verttex_set_sampler_views(pipe, nr, views);
+      break;
+   default:
+      ;
+   }
+}
+
+
 void
 nv30_fragtex_init(struct pipe_context *pipe)
 {
-   pipe->set_fragment_sampler_views = nv30_fragtex_set_sampler_views;
+   pipe->set_sampler_views = nv30_set_sampler_views;
 }
index 48465cf17b4a4ef5a1b753613ff4e8363728bc01..5c7fc62d5d1d81f89f055c5fa7ecc6698a7565ed 100644 (file)
@@ -69,7 +69,7 @@ nv40_verttex_sampler_states_bind(struct pipe_context *pipe,
 }
 
 
-static void
+void
 nv40_verttex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
                                struct pipe_sampler_view **views)
 {
@@ -95,5 +95,5 @@ nv40_verttex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
 void
 nv40_verttex_init(struct pipe_context *pipe)
 {
-   pipe->set_vertex_sampler_views = nv40_verttex_set_sampler_views;
+   /* nothing */
 }
index aaea19fc72b68f8192bac9e8cfcba7a45a666254..b6a180ef22f73e50a8c8774e2ac5cb7372752e33 100644 (file)
@@ -671,28 +671,27 @@ nv50_stage_set_sampler_views(struct nv50_context *nv50, int s,
 }
 
 static void
-nv50_vp_set_sampler_views(struct pipe_context *pipe,
-                          unsigned nr,
-                          struct pipe_sampler_view **views)
+nv50_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+                       unsigned start, unsigned nr,
+                       struct pipe_sampler_view **views)
 {
-   nv50_stage_set_sampler_views(nv50_context(pipe), 0, nr, views);
+   assert(start == 0);
+   switch (shader) {
+   case PIPE_SHADER_VERTEX:
+      nv50_stage_set_sampler_views(nv50_context(pipe), 0, nr, views);
+      break;
+   case PIPE_SHADER_GEOMETRY:
+      nv50_stage_set_sampler_views(nv50_context(pipe), 1, nr, views);
+      break;
+   case PIPE_SHADER_FRAGMENT:
+      nv50_stage_set_sampler_views(nv50_context(pipe), 2, nr, views);
+      break;
+   default:
+      ;
+   }
 }
 
-static void
-nv50_fp_set_sampler_views(struct pipe_context *pipe,
-                          unsigned nr,
-                          struct pipe_sampler_view **views)
-{
-   nv50_stage_set_sampler_views(nv50_context(pipe), 2, nr, views);
-}
 
-static void
-nv50_gp_set_sampler_views(struct pipe_context *pipe,
-                          unsigned nr,
-                          struct pipe_sampler_view **views)
-{
-   nv50_stage_set_sampler_views(nv50_context(pipe), 1, nr, views);
-}
 
 /* ============================= SHADERS =======================================
  */
@@ -1092,9 +1091,7 @@ nv50_init_state_functions(struct nv50_context *nv50)
 
    pipe->create_sampler_view = nv50_create_sampler_view;
    pipe->sampler_view_destroy = nv50_sampler_view_destroy;
-   pipe->set_vertex_sampler_views   = nv50_vp_set_sampler_views;
-   pipe->set_fragment_sampler_views = nv50_fp_set_sampler_views;
-   pipe->set_geometry_sampler_views = nv50_gp_set_sampler_views;
+   pipe->set_sampler_views = nv50_set_sampler_views;
 
    pipe->create_vs_state = nv50_vp_state_create;
    pipe->create_fs_state = nv50_fp_state_create;
index e0e6e135258c3cd84ee3579d09b719d596664c28..4b8632a33d77ea8ccd24926a37e7102a83709482 100644 (file)
@@ -587,30 +587,6 @@ nvc0_stage_set_sampler_views(struct nvc0_context *nvc0, int s,
    nvc0->dirty |= NVC0_NEW_TEXTURES;
 }
 
-static void
-nvc0_vp_set_sampler_views(struct pipe_context *pipe,
-                          unsigned nr,
-                          struct pipe_sampler_view **views)
-{
-   nvc0_stage_set_sampler_views(nvc0_context(pipe), 0, nr, views);
-}
-
-static void
-nvc0_fp_set_sampler_views(struct pipe_context *pipe,
-                          unsigned nr,
-                          struct pipe_sampler_view **views)
-{
-   nvc0_stage_set_sampler_views(nvc0_context(pipe), 4, nr, views);
-}
-
-static void
-nvc0_gp_set_sampler_views(struct pipe_context *pipe,
-                          unsigned nr,
-                          struct pipe_sampler_view **views)
-{
-   nvc0_stage_set_sampler_views(nvc0_context(pipe), 3, nr, views);
-}
-
 static void
 nvc0_stage_set_sampler_views_range(struct nvc0_context *nvc0, const unsigned s,
                                    unsigned start, unsigned nr,
@@ -662,13 +638,29 @@ nvc0_stage_set_sampler_views_range(struct nvc0_context *nvc0, const unsigned s,
 }
 
 static void
-nvc0_cp_set_sampler_views(struct pipe_context *pipe,
-                          unsigned start, unsigned nr,
-                          struct pipe_sampler_view **views)
+nvc0_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+                       unsigned start, unsigned nr,
+                       struct pipe_sampler_view **views)
 {
-   nvc0_stage_set_sampler_views_range(nvc0_context(pipe), 5, start, nr, views);
-
-   nvc0_context(pipe)->dirty_cp |= NVC0_NEW_CP_TEXTURES;
+   assert(start == 0);
+   switch (shader) {
+   case PIPE_SHADER_VERTEX:
+      nvc0_stage_set_sampler_views(nvc0_context(pipe), 0, nr, views);
+      break;
+   case PIPE_SHADER_GEOMETRY:
+      nvc0_stage_set_sampler_views(nvc0_context(pipe), 3, nr, views);
+      break;
+   case PIPE_SHADER_FRAGMENT:
+      nvc0_stage_set_sampler_views(nvc0_context(pipe), 4, nr, views);
+      break;
+   case PIPE_SHADER_COMPUTE:
+      nvc0_stage_set_sampler_views_range(nvc0_context(pipe), 5,
+                                         start, nr, views);
+      nvc0_context(pipe)->dirty_cp |= NVC0_NEW_CP_TEXTURES;
+      break;
+   default:
+      ;
+   }
 }
 
 
@@ -1197,10 +1189,7 @@ nvc0_init_state_functions(struct nvc0_context *nvc0)
 
    pipe->create_sampler_view = nvc0_create_sampler_view;
    pipe->sampler_view_destroy = nvc0_sampler_view_destroy;
-   pipe->set_vertex_sampler_views   = nvc0_vp_set_sampler_views;
-   pipe->set_fragment_sampler_views = nvc0_fp_set_sampler_views;
-   pipe->set_geometry_sampler_views = nvc0_gp_set_sampler_views;
-   pipe->set_compute_sampler_views = nvc0_cp_set_sampler_views;
+   pipe->set_sampler_views = nvc0_set_sampler_views;
 
    pipe->create_vs_state = nvc0_vp_state_create;
    pipe->create_fs_state = nvc0_fp_state_create;
index 6ce009e4668a115a108151b07c3a35e344bb23c6..6840e8b2cf477d21d117eccb41b9dc6f80b4e974 100644 (file)
@@ -1576,9 +1576,9 @@ static uint32_t r300_assign_texture_cache_region(unsigned index, unsigned num)
         return R300_TX_CACHE(num + index);
 }
 
-static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
-                                            unsigned count,
-                                            struct pipe_sampler_view** views)
+static void r300_set_sampler_views(struct pipe_context* pipe, unsigned shader,
+                                   unsigned start, unsigned count,
+                                   struct pipe_sampler_view** views)
 {
     struct r300_context* r300 = r300_context(pipe);
     struct r300_textures_state* state =
@@ -1588,6 +1588,11 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
     unsigned tex_units = r300->screen->caps.num_tex_units;
     boolean dirty_tex = FALSE;
 
+    if (shader != PIPE_SHADER_FRAGMENT)
+       return;
+
+    assert(start == 0);  /* non-zero not handled yet */
+
     if (count > tex_units) {
         return;
     }
@@ -2159,7 +2164,7 @@ void r300_init_state_functions(struct r300_context* r300)
     r300->context.bind_sampler_states = r300_bind_sampler_states;
     r300->context.delete_sampler_state = r300_delete_sampler_state;
 
-    r300->context.set_fragment_sampler_views = r300_set_fragment_sampler_views;
+    r300->context.set_sampler_views = r300_set_sampler_views;
     r300->context.create_sampler_view = r300_create_sampler_view;
     r300->context.sampler_view_destroy = r300_sampler_view_destroy;
 
index bcb8a390fcfa52c9725d9715835bd0f4c8b1d867..ea77f5eb89ee037555ec5865bb5d625de9490e00 100644 (file)
@@ -597,7 +597,7 @@ static void evergreen_set_compute_resources(struct pipe_context * ctx_,
        }
 }
 
-static void evergreen_set_cs_sampler_view(struct pipe_context *ctx_,
+void evergreen_set_cs_sampler_view(struct pipe_context *ctx_,
                unsigned start_slot, unsigned count,
                struct pipe_sampler_view **views)
 {
@@ -848,7 +848,6 @@ void evergreen_init_compute_state_functions(struct r600_context *ctx)
        ctx->b.b.bind_compute_state = evergreen_bind_compute_state;
 //      ctx->context.create_sampler_view = evergreen_compute_create_sampler_view;
        ctx->b.b.set_compute_resources = evergreen_set_compute_resources;
-       ctx->b.b.set_compute_sampler_views = evergreen_set_cs_sampler_view;
        ctx->b.b.set_global_binding = evergreen_set_global_binding;
        ctx->b.b.launch_grid = evergreen_launch_grid;
 
index 0304d6a16a74d1cb3905e84fc0cfac03a6daf29d..75a721cb99b20204b89225064a90a1ac90b986a7 100644 (file)
@@ -574,6 +574,11 @@ void compute_memory_pool_delete(struct compute_memory_pool* pool);
 struct compute_memory_pool* compute_memory_pool_new(
        struct r600_screen *rscreen);
 
+/* evergreen_compute.c */
+void evergreen_set_cs_sampler_view(struct pipe_context *ctx_,
+                                   unsigned start_slot, unsigned count,
+                                   struct pipe_sampler_view **views);
+
 /* evergreen_state.c */
 struct pipe_sampler_view *
 evergreen_create_sampler_view_custom(struct pipe_context *ctx,
index 482eb44a070ca9724177360f2765615a41f4065c..8f164bf18918f6807f9acf7dc8fdbb91d922a3ea 100644 (file)
@@ -578,6 +578,11 @@ static void r600_set_sampler_views(struct pipe_context *pipe, unsigned shader,
 
        assert(start == 0); /* XXX fix below */
 
+       if (shader == PIPE_SHADER_COMPUTE) {
+               evergreen_set_cs_sampler_view(pipe, start, count, views);
+               return;
+       }
+
        remaining_mask = dst->views.enabled_mask & disable_mask;
 
        while (remaining_mask) {
@@ -644,18 +649,6 @@ static void r600_set_sampler_views(struct pipe_context *pipe, unsigned shader,
        }
 }
 
-static void r600_set_vs_sampler_views(struct pipe_context *ctx, unsigned count,
-                                     struct pipe_sampler_view **views)
-{
-       r600_set_sampler_views(ctx, PIPE_SHADER_VERTEX, 0, count, views);
-}
-
-static void r600_set_ps_sampler_views(struct pipe_context *ctx, unsigned count,
-                                     struct pipe_sampler_view **views)
-{
-       r600_set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, count, views);
-}
-
 static void r600_set_viewport_states(struct pipe_context *ctx,
                                      unsigned start_slot,
                                      unsigned num_viewports,
@@ -2100,8 +2093,7 @@ void r600_init_common_state_functions(struct r600_context *rctx)
        rctx->b.b.set_viewport_states = r600_set_viewport_states;
        rctx->b.b.set_vertex_buffers = r600_set_vertex_buffers;
        rctx->b.b.set_index_buffer = r600_set_index_buffer;
-       rctx->b.b.set_fragment_sampler_views = r600_set_ps_sampler_views;
-       rctx->b.b.set_vertex_sampler_views = r600_set_vs_sampler_views;
+       rctx->b.b.set_sampler_views = r600_set_sampler_views;
        rctx->b.b.sampler_view_destroy = r600_sampler_view_destroy;
        rctx->b.b.texture_barrier = r600_texture_barrier;
        rctx->b.b.set_stream_output_targets = r600_set_streamout_targets;
index da7c3d0ab0c4798b86509c07606f3613c6133871..97710f01e7a8d01ac2cfec560e457764e26c680e 100644 (file)
@@ -2608,14 +2608,21 @@ static void *si_create_sampler_state(struct pipe_context *ctx,
 
 /* XXX consider moving this function to si_descriptors.c for gcc to inline
  *     the si_set_sampler_view calls. LTO might help too. */
-static void si_set_sampler_views(struct r600_context *rctx,
-                                unsigned shader, unsigned count,
+static void si_set_sampler_views(struct pipe_context *ctx,
+                                unsigned shader, unsigned start,
+                                 unsigned count,
                                 struct pipe_sampler_view **views)
 {
+       struct r600_context *rctx = (struct r600_context *)ctx;
        struct r600_textures_info *samplers = &rctx->samplers[shader];
        struct si_pipe_sampler_view **rviews = (struct si_pipe_sampler_view **)views;
        int i;
 
+       if (shader != PIPE_SHADER_VERTEX && shader != PIPE_SHADER_FRAGMENT)
+               return;
+
+       assert(start == 0);
+
        for (i = 0; i < count; i++) {
                if (views[i]) {
                        struct r600_texture *rtex =
@@ -2661,22 +2668,6 @@ static void si_set_sampler_views(struct r600_context *rctx,
        rctx->b.flags |= R600_CONTEXT_INV_TEX_CACHE;
 }
 
-static void si_set_vs_sampler_views(struct pipe_context *ctx, unsigned count,
-                                   struct pipe_sampler_view **views)
-{
-       struct r600_context *rctx = (struct r600_context *)ctx;
-
-       si_set_sampler_views(rctx, PIPE_SHADER_VERTEX, count, views);
-}
-
-static void si_set_ps_sampler_views(struct pipe_context *ctx, unsigned count,
-                                   struct pipe_sampler_view **views)
-{
-       struct r600_context *rctx = (struct r600_context *)ctx;
-
-       si_set_sampler_views(rctx, PIPE_SHADER_FRAGMENT, count, views);
-}
-
 static struct si_pm4_state *si_set_sampler_states(struct r600_context *rctx, unsigned count,
                                                   void **states,
                                                   struct r600_textures_info *samplers,
@@ -3033,8 +3024,7 @@ void si_init_state_functions(struct r600_context *rctx)
        rctx->b.b.delete_sampler_state = si_delete_sampler_state;
 
        rctx->b.b.create_sampler_view = si_create_sampler_view;
-       rctx->b.b.set_vertex_sampler_views = si_set_vs_sampler_views;
-       rctx->b.b.set_fragment_sampler_views = si_set_ps_sampler_views;
+       rctx->b.b.set_sampler_views = si_set_sampler_views;
        rctx->b.b.sampler_view_destroy = si_sampler_view_destroy;
 
        rctx->b.b.set_sample_mask = si_set_sample_mask;
index 083d3729f6ef7520f5da9767adb2f8585674c7fd..be3e9641d6d75d7481b9a3d637a50048eaa5e934 100644 (file)
@@ -736,36 +736,11 @@ rbug_set_sampler_views(struct pipe_context *_pipe,
       views = unwrapped_views;
    }
 
-   switch (shader) {
-   case PIPE_SHADER_VERTEX:
-      pipe->set_vertex_sampler_views(pipe, num, views);
-      break;
-   case PIPE_SHADER_FRAGMENT:
-      pipe->set_fragment_sampler_views(pipe, num, views);
-      break;
-   default:
-      assert(0);
-   }
+   pipe->set_sampler_views(pipe, shader, start, num, views);
 
    pipe_mutex_unlock(rb_pipe->call_mutex);
 }
 
-static void
-rbug_set_vertex_sampler_views(struct pipe_context *_pipe,
-                              unsigned num,
-                              struct pipe_sampler_view **_views)
-{
-   rbug_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, 0, num, _views);
-}
-
-static void
-rbug_set_fragment_sampler_views(struct pipe_context *_pipe,
-                                unsigned num,
-                                struct pipe_sampler_view **_views)
-{
-   rbug_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT, 0, num, _views);
-}
-
 static void
 rbug_set_vertex_buffers(struct pipe_context *_pipe,
                         unsigned start_slot, unsigned num_buffers,
@@ -1171,8 +1146,7 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
    rb_pipe->base.set_polygon_stipple = rbug_set_polygon_stipple;
    rb_pipe->base.set_scissor_states = rbug_set_scissor_states;
    rb_pipe->base.set_viewport_states = rbug_set_viewport_states;
-   rb_pipe->base.set_fragment_sampler_views = rbug_set_fragment_sampler_views;
-   rb_pipe->base.set_vertex_sampler_views = rbug_set_vertex_sampler_views;
+   rb_pipe->base.set_sampler_views = rbug_set_sampler_views;
    rb_pipe->base.set_vertex_buffers = rbug_set_vertex_buffers;
    rb_pipe->base.set_index_buffer = rbug_set_index_buffer;
    rb_pipe->base.set_sample_mask = rbug_set_sample_mask;
index be9d6457c8828cc8ce8eb66a7189a8036f2dba4c..dde7c1396d92bf3bb94369790f12e16e941b1ed1 100644 (file)
@@ -165,33 +165,6 @@ softpipe_set_sampler_views(struct pipe_context *pipe,
 }
 
 
-static void
-softpipe_set_fragment_sampler_views(struct pipe_context *pipe,
-                                    unsigned num,
-                                    struct pipe_sampler_view **views)
-{
-   softpipe_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, views);
-}
-
-
-static void
-softpipe_set_vertex_sampler_views(struct pipe_context *pipe,
-                                  unsigned num,
-                                  struct pipe_sampler_view **views)
-{
-   softpipe_set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, num, views);
-}
-
-
-static void
-softpipe_set_geometry_sampler_views(struct pipe_context *pipe,
-                                    unsigned num,
-                                    struct pipe_sampler_view **views)
-{
-   softpipe_set_sampler_views(pipe, PIPE_SHADER_GEOMETRY, 0, num, views);
-}
-
-
 static void
 softpipe_delete_sampler_state(struct pipe_context *pipe,
                               void *sampler)
@@ -207,11 +180,8 @@ softpipe_init_sampler_funcs(struct pipe_context *pipe)
    pipe->bind_sampler_states = softpipe_bind_sampler_states;
    pipe->delete_sampler_state = softpipe_delete_sampler_state;
 
-   pipe->set_fragment_sampler_views = softpipe_set_fragment_sampler_views;
-   pipe->set_vertex_sampler_views = softpipe_set_vertex_sampler_views;
-   pipe->set_geometry_sampler_views = softpipe_set_geometry_sampler_views;
-
    pipe->create_sampler_view = softpipe_create_sampler_view;
+   pipe->set_sampler_views = softpipe_set_sampler_views;
    pipe->sampler_view_destroy = softpipe_sampler_view_destroy;
 }
 
index b64e8138efbec711651593342c1d2eaa549aa8c8..805e23b18ee640717437b53b93ee968739bb2397 100644 (file)
@@ -289,21 +289,12 @@ svga_set_sampler_views(struct pipe_context *pipe,
 }
 
 
-static void
-svga_set_fragment_sampler_views(struct pipe_context *pipe,
-                                unsigned num,
-                                struct pipe_sampler_view **views)
-{
-   svga_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, views);
-}
-
-
 void svga_init_sampler_functions( struct svga_context *svga )
 {
    svga->pipe.create_sampler_state = svga_create_sampler_state;
    svga->pipe.bind_sampler_states = svga_bind_sampler_states;
    svga->pipe.delete_sampler_state = svga_delete_sampler_state;
-   svga->pipe.set_fragment_sampler_views = svga_set_fragment_sampler_views;
+   svga->pipe.set_sampler_views = svga_set_sampler_views;
    svga->pipe.create_sampler_view = svga_create_sampler_view;
    svga->pipe.sampler_view_destroy = svga_sampler_view_destroy;
 }
index 1b349863f5824f6bce14c915f97ca004f83eea7e..78911aa8f5e07e807cef8665b0c86b82958a26d8 100644 (file)
@@ -903,70 +903,20 @@ trace_context_set_sampler_views(struct pipe_context *_pipe,
    }
    views = unwrapped_views;
 
-   switch (shader) {
-   case PIPE_SHADER_VERTEX:
-      trace_dump_call_begin("pipe_context", "set_vertex_sampler_views");
-      break;
-   case PIPE_SHADER_GEOMETRY:
-      trace_dump_call_begin("pipe_context", "set_geometry_sampler_views");
-      break;
-   case PIPE_SHADER_FRAGMENT:
-      trace_dump_call_begin("pipe_context", "set_fragment_sampler_views");
-      break;
-   default:
-      debug_error("Unexpected shader in trace_context_set_sampler_views()");
-   }
+   trace_dump_call_begin("pipe_context", "set_sampler_views");
 
    trace_dump_arg(ptr, pipe);
-   /*trace_dump_arg(uint, shader);*/
+   trace_dump_arg(uint, shader);
+   trace_dump_arg(uint, start);
    trace_dump_arg(uint, num);
    trace_dump_arg_array(ptr, views, num);
 
-   switch (shader) {
-   case PIPE_SHADER_VERTEX:
-      pipe->set_vertex_sampler_views(pipe, num, views);
-      break;
-   case PIPE_SHADER_GEOMETRY:
-      pipe->set_geometry_sampler_views(pipe, num, views);
-      break;
-   case PIPE_SHADER_FRAGMENT:
-      pipe->set_fragment_sampler_views(pipe, num, views);
-      break;
-   default:
-      debug_error("Unexpected shader in trace_context_set_sampler_views()");
-   }
+   pipe->set_sampler_views(pipe, shader, start, num, views);
 
    trace_dump_call_end();
 }
 
 
-static INLINE void
-trace_context_set_fragment_sampler_views(struct pipe_context *_pipe,
-                                         unsigned num,
-                                         struct pipe_sampler_view **views)
-{
-   trace_context_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT, 0, num, views);
-}
-
-
-static INLINE void
-trace_context_set_vertex_sampler_views(struct pipe_context *_pipe,
-                                       unsigned num,
-                                       struct pipe_sampler_view **views)
-{
-   trace_context_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, 0, num, views);
-}
-
-
-static INLINE void
-trace_context_set_geometry_sampler_views(struct pipe_context *_pipe,
-                                       unsigned num,
-                                       struct pipe_sampler_view **views)
-{
-   trace_context_set_sampler_views(_pipe, PIPE_SHADER_GEOMETRY, 0, num, views);
-}
-
-
 static INLINE void
 trace_context_set_vertex_buffers(struct pipe_context *_pipe,
                                  unsigned start_slot, unsigned num_buffers,
@@ -1556,9 +1506,7 @@ trace_context_create(struct trace_screen *tr_scr,
    TR_CTX_INIT(set_polygon_stipple);
    TR_CTX_INIT(set_scissor_states);
    TR_CTX_INIT(set_viewport_states);
-   TR_CTX_INIT(set_fragment_sampler_views);
-   TR_CTX_INIT(set_vertex_sampler_views);
-   TR_CTX_INIT(set_geometry_sampler_views);
+   TR_CTX_INIT(set_sampler_views);
    TR_CTX_INIT(create_sampler_view);
    TR_CTX_INIT(sampler_view_destroy);
    TR_CTX_INIT(create_surface);
index 9d6b9b5db49ee31bd5bcc018855f1fd3ffc401e3..af64f4b3fb95b9ca620149915318616715be5cc0 100644 (file)
@@ -213,21 +213,9 @@ struct pipe_context {
                                 unsigned num_viewports,
                                 const struct pipe_viewport_state *);
 
-   void (*set_fragment_sampler_views)(struct pipe_context *,
-                                      unsigned num_views,
-                                      struct pipe_sampler_view **);
-
-   void (*set_vertex_sampler_views)(struct pipe_context *,
-                                    unsigned num_views,
-                                    struct pipe_sampler_view **);
-
-   void (*set_geometry_sampler_views)(struct pipe_context *,
-                                      unsigned num_views,
-                                      struct pipe_sampler_view **);
-
-   void (*set_compute_sampler_views)(struct pipe_context *,
-                                     unsigned start_slot, unsigned num_views,
-                                     struct pipe_sampler_view **);
+   void (*set_sampler_views)(struct pipe_context *, unsigned shader,
+                             unsigned start_slot, unsigned num_views,
+                             struct pipe_sampler_view **);
 
    /**
     * Bind an array of shader resources that will be used by the
index d9627913cff4fe0d941d3441dbfa6c50d21fb273..4d38e084b80b16cd45049e6b7d266e4ce41f90ab 100644 (file)
@@ -352,7 +352,7 @@ static void init_tex( void )
    if (sv == NULL)
       exit(5);
 
-   ctx->set_fragment_sampler_views(ctx, 1, &sv);
+   ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
    
 
    memset(&sampler_desc, 0, sizeof sampler_desc);
index 2a8f26eedd4cdb680d20a02ebbd04f78c08de88f..3ada18a30eef795c1782b010ddeaaee04db24f95 100644 (file)
@@ -459,7 +459,7 @@ static void init_tex( void )
    if (sv == NULL)
       exit(5);
 
-   ctx->set_fragment_sampler_views(ctx, 1, &sv);
+   ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
    
 
    memset(&sampler_desc, 0, sizeof sampler_desc);
index bfae2e080c7e490b1f4ef49181d21db1e2e94a4f..b4a29e101e43793a6b61b24e587bee723b2901de 100644 (file)
@@ -267,7 +267,7 @@ static void init_tex( void )
    if (sv == NULL)
       exit(5);
 
-   ctx->set_fragment_sampler_views(ctx, 1, &sv);
+   ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
    
 
    memset(&sampler_desc, 0, sizeof sampler_desc);
index 7802d8efddf1e5b0680daba57f8956cccd87f38d..9e4407e442e9aa6d6d2c4a992201fc490206f92b 100644 (file)
@@ -167,7 +167,7 @@ static void init_tex( void )
                                     PIPE_FORMAT_B8G8R8A8_UNORM, tex2d);
 
    sv = graw_util_create_simple_sampler_view(&info, texture);
-   info.ctx->set_fragment_sampler_views(info.ctx, 1, &sv);
+   info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
 
    sampler = graw_util_create_simple_sampler(&info, 
                                              PIPE_TEX_WRAP_REPEAT,
index 5035fa781a965dda416a2bd930362d901ef29ff9..dce91188ebe56d0cf071b0e2a5dded2ba5ef36e7 100644 (file)
@@ -128,11 +128,11 @@ static void draw( void )
 
    info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
 
-   info.ctx->set_fragment_sampler_views(info.ctx, 1, &linear_sv);
+   info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &linear_sv);
    set_vertices(vertices1, 4);
    util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4);
 
-   info.ctx->set_fragment_sampler_views(info.ctx, 1, &srgb_sv);
+   info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &srgb_sv);
    set_vertices(vertices2, 4);
    util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4);
 
index 65c1d4dde5efdd50366d54e8d6ba855d3afa40ed..910a8ca3e45c6ad1252b12f7acbed3d218a3329e 100644 (file)
@@ -146,7 +146,7 @@ init_tex(const unsigned swizzle[4])
    if (sv == NULL)
       exit(5);
 
-   info.ctx->set_fragment_sampler_views(info.ctx, 1, &sv);
+   info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
 
    sampler = graw_util_create_simple_sampler(&info,
                                              PIPE_TEX_WRAP_REPEAT,
index f351928592b7705ead17a7b03f546d9e896e96a9..f7d4d7342ec4add1894f28443a9cd277e0c3f469 100644 (file)
@@ -346,7 +346,7 @@ static void init_tex( void )
    if (sv == NULL)
       exit(5);
 
-   ctx->set_fragment_sampler_views(ctx, 1, &sv);
+   ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
    
 
    memset(&sampler_desc, 0, sizeof sampler_desc);
index 339c2647e81c5dd65c24b75e8ee7c767b5c60635..4edb8576f5229e3a53c38a955e6d989ba5bf624d 100644 (file)
@@ -312,7 +312,7 @@ static void init_sampler_views(struct context *ctx, const int *slots)
                 assert(ctx->view[i]);
         }
 
-        pipe->set_compute_sampler_views(pipe, 0, i, ctx->view);
+        pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, i, ctx->view);
 }
 
 static void destroy_sampler_views(struct context *ctx)
@@ -320,7 +320,7 @@ static void destroy_sampler_views(struct context *ctx)
         struct pipe_context *pipe = ctx->pipe;
         int i;
 
-        pipe->set_compute_sampler_views(pipe, 0, MAX_RESOURCES, NULL);
+        pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, MAX_RESOURCES, NULL);
 
         for (i = 0; i < MAX_RESOURCES; ++i) {
                 if (ctx->view[i]) {
index d4df2e09eabe57bea6b76bcba53d247aba8d26ea..8c3bdabdc8c63ea061034a3b26518b9caafa5c5c 100755 (executable)
@@ -243,9 +243,7 @@ class Context(Dispatcher):
         self._state.vs.sampler = []
         self._state.gs.sampler = []
         self._state.fs.sampler = []
-        self._state.vs.sampler_views = []
-        self._state.gs.sampler_views = []
-        self._state.fs.sampler_views = []
+        self._state.sampler_views = {}
         self._state.vs.constant_buffer = []
         self._state.gs.constant_buffer = []
         self._state.fs.constant_buffer = []
@@ -400,14 +398,8 @@ class Context(Dispatcher):
     def sampler_view_destroy(self, view):
         pass
 
-    def set_fragment_sampler_views(self, num, views):
-        self._state.fs.sampler_views = views
-
-    def set_geometry_sampler_views(self, num, views):
-        self._state.gs.sampler_views = views
-
-    def set_vertex_sampler_views(self, num, views):
-        self._state.vs.sampler_views = views
+    def set_sampler_views(self, shader, start, num, views):
+        self._state.sampler_views[shader] = views
 
     def set_vertex_buffers(self, start_slot, num_buffers, buffers):
         self._update(self._state.vertex_buffers, start_slot, num_buffers, buffers)