summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2013-10-07 18:16:22 -0600
committerBrian Paul <brianp@vmware.com>2013-10-23 10:15:38 -0600
commita3ed98f7aa85636579a5696bf036ec13e5c9104a (patch)
tree104078a2a8b875e5ec7c5524e7797d46d109d7e0 /src/gallium
parentb11fc226e6b106de8eb777a8e62c4f7303c66fbc (diff)
gallium: new, unified pipe_context::set_sampler_views() function
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>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c35
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c37
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c33
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c12
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor.c4
-rw-r--r--src/gallium/auxiliary/vl/vl_idct.c6
-rw-r--r--src/gallium/auxiliary/vl/vl_matrix_filter.c3
-rw-r--r--src/gallium/auxiliary/vl/vl_mc.c3
-rw-r--r--src/gallium/auxiliary/vl/vl_median_filter.c3
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_decoder.c4
-rw-r--r--src/gallium/auxiliary/vl/vl_zscan.c3
-rw-r--r--src/gallium/docs/d3d11ddi.txt4
-rw-r--r--src/gallium/docs/source/context.rst14
-rw-r--r--src/gallium/drivers/freedreno/freedreno_texture.c22
-rw-r--r--src/gallium/drivers/galahad/glhd_context.c57
-rw-r--r--src/gallium/drivers/i915/i915_state.c22
-rw-r--r--src/gallium/drivers/identity/id_context.c47
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c27
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_sampler.c30
-rw-r--r--src/gallium/drivers/noop/noop_state.c13
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_context.h8
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_fragtex.c24
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv40_verttex.c4
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_state.c39
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_state.c57
-rw-r--r--src/gallium/drivers/r300/r300_state.c13
-rw-r--r--src/gallium/drivers/r600/evergreen_compute.c3
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h5
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c20
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c30
-rw-r--r--src/gallium/drivers/rbug/rbug_context.c30
-rw-r--r--src/gallium/drivers/softpipe/sp_state_sampler.c32
-rw-r--r--src/gallium/drivers/svga/svga_pipe_sampler.c11
-rw-r--r--src/gallium/drivers/trace/tr_context.c62
-rw-r--r--src/gallium/include/pipe/p_context.h18
-rw-r--r--src/gallium/tests/graw/fs-test.c2
-rw-r--r--src/gallium/tests/graw/gs-test.c2
-rw-r--r--src/gallium/tests/graw/quad-sample.c2
-rw-r--r--src/gallium/tests/graw/quad-tex.c2
-rw-r--r--src/gallium/tests/graw/tex-srgb.c4
-rw-r--r--src/gallium/tests/graw/tex-swizzle.c2
-rw-r--r--src/gallium/tests/graw/vs-test.c2
-rw-r--r--src/gallium/tests/trivial/compute.c4
-rwxr-xr-xsrc/gallium/tools/trace/dump_state.py14
44 files changed, 277 insertions, 492 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 4d7c3871256..23d3245e881 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -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;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 3c93bf7f722..d00b721f190 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -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:
*/
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index e39276a55d3..17b1d3d7039 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -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;
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index a51b9ef20b3..096d3bc2b98 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -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);
}
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index db4c697828f..1c8312e9d06 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -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++;
diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c
index dc14bb71b46..79adb045dad 100644
--- a/src/gallium/auxiliary/vl/vl_idct.c
+++ b/src/gallium/auxiliary/vl/vl_idct.c
@@ -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]);
}
diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c
index b7c88e776b6..56b7003f0fc 100644
--- a/src/gallium/auxiliary/vl/vl_matrix_filter.c
+++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c
@@ -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);
diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c
index bd75df164ab..7d4aee67c7b 100644
--- a/src/gallium/auxiliary/vl/vl_mc.c
+++ b/src/gallium/auxiliary/vl/vl_mc.c
@@ -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);
diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c
index f5ef117893d..6d98392d6e9 100644
--- a/src/gallium/auxiliary/vl/vl_median_filter.c
+++ b/src/gallium/auxiliary/vl/vl_median_filter.c
@@ -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);
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index bc207ac725d..ca4eb3ef6aa 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -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);
diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c
index 2d616d57c7a..40502ae633f 100644
--- a/src/gallium/auxiliary/vl/vl_zscan.c
+++ b/src/gallium/auxiliary/vl/vl_zscan.c
@@ -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);
diff --git a/src/gallium/docs/d3d11ddi.txt b/src/gallium/docs/d3d11ddi.txt
index 14a589fffe2..a7036481411 100644
--- a/src/gallium/docs/d3d11ddi.txt
+++ b/src/gallium/docs/d3d11ddi.txt
@@ -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
diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
index e471eebd66e..1037162aefb 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -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.
diff --git a/src/gallium/drivers/freedreno/freedreno_texture.c b/src/gallium/drivers/freedreno/freedreno_texture.c
index fc0c8aa3346..bcc846f6819 100644
--- a/src/gallium/drivers/freedreno/freedreno_texture.c
+++ b/src/gallium/drivers/freedreno/freedreno_texture.c
@@ -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;
}
diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c
index dc3d5f056df..0bb7abd3ac0 100644
--- a/src/gallium/drivers/galahad/glhd_context.c
+++ b/src/gallium/drivers/galahad/glhd_context.c
@@ -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);
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index f722e2dcfeb..54c343cf2bf 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -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;
diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c
index 0aff75f5e9f..60e8860a2cb 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -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;
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index caad308ab38..91d7c7637f4 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -893,6 +893,28 @@ ilo_set_compute_sampler_views(struct pipe_context *pipe,
}
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,
struct pipe_surface **surfaces)
@@ -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;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index 6bf2fb86032..1d3db0f25c7 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -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;
}
diff --git a/src/gallium/drivers/noop/noop_state.c b/src/gallium/drivers/noop/noop_state.c
index 173e2cc6ba8..9c62c27c0a5 100644
--- a/src/gallium/drivers/noop/noop_state.c
+++ b/src/gallium/drivers/noop/noop_state.c
@@ -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;
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_context.h b/src/gallium/drivers/nouveau/nv30/nv30_context.h
index 292dcfe61a4..527614afc14 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_context.h
+++ b/src/gallium/drivers/nouveau/nv30/nv30_context.h
@@ -195,6 +195,14 @@ 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);
void
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c b/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c
index 87e66cc6d91..4ab31d14169 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c
@@ -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;
}
diff --git a/src/gallium/drivers/nouveau/nv30/nv40_verttex.c b/src/gallium/drivers/nouveau/nv30/nv40_verttex.c
index 48465cf17b4..5c7fc62d5d1 100644
--- a/src/gallium/drivers/nouveau/nv30/nv40_verttex.c
+++ b/src/gallium/drivers/nouveau/nv30/nv40_verttex.c
@@ -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 */
}
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c
index aaea19fc72b..b6a180ef22f 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c
@@ -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;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
index e0e6e135258..4b8632a33d7 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
@@ -588,30 +588,6 @@ nvc0_stage_set_sampler_views(struct nvc0_context *nvc0, int s,
}
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,
struct pipe_sampler_view **views)
@@ -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;
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 6ce009e4668..6840e8b2cf4 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -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;
diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
index bcb8a390fcf..ea77f5eb89e 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -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;
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 0304d6a16a7..75a721cb99b 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -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,
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 482eb44a070..8f164bf1891 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -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;
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index da7c3d0ab0c..97710f01e7a 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -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;
diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c
index 083d3729f6e..be3e9641d6d 100644
--- a/src/gallium/drivers/rbug/rbug_context.c
+++ b/src/gallium/drivers/rbug/rbug_context.c
@@ -736,37 +736,12 @@ 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,
const struct pipe_vertex_buffer *_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;
diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c
index be9d6457c88..dde7c1396d9 100644
--- a/src/gallium/drivers/softpipe/sp_state_sampler.c
+++ b/src/gallium/drivers/softpipe/sp_state_sampler.c
@@ -166,33 +166,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;
}
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index b64e8138efb..805e23b18ee 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -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;
}
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index 1b349863f58..78911aa8f5e 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -903,71 +903,21 @@ 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,
const struct pipe_vertex_buffer *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);
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 9d6b9b5db49..af64f4b3fb9 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -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
diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c
index d9627913cff..4d38e084b80 100644
--- a/src/gallium/tests/graw/fs-test.c
+++ b/src/gallium/tests/graw/fs-test.c
@@ -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);
diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c
index 2a8f26eedd4..3ada18a30ee 100644
--- a/src/gallium/tests/graw/gs-test.c
+++ b/src/gallium/tests/graw/gs-test.c
@@ -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);
diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c
index bfae2e080c7..b4a29e101e4 100644
--- a/src/gallium/tests/graw/quad-sample.c
+++ b/src/gallium/tests/graw/quad-sample.c
@@ -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);
diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c
index 7802d8efddf..9e4407e442e 100644
--- a/src/gallium/tests/graw/quad-tex.c
+++ b/src/gallium/tests/graw/quad-tex.c
@@ -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,
diff --git a/src/gallium/tests/graw/tex-srgb.c b/src/gallium/tests/graw/tex-srgb.c
index 5035fa781a9..dce91188ebe 100644
--- a/src/gallium/tests/graw/tex-srgb.c
+++ b/src/gallium/tests/graw/tex-srgb.c
@@ -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);
diff --git a/src/gallium/tests/graw/tex-swizzle.c b/src/gallium/tests/graw/tex-swizzle.c
index 65c1d4dde5e..910a8ca3e45 100644
--- a/src/gallium/tests/graw/tex-swizzle.c
+++ b/src/gallium/tests/graw/tex-swizzle.c
@@ -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,
diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c
index f351928592b..f7d4d7342ec 100644
--- a/src/gallium/tests/graw/vs-test.c
+++ b/src/gallium/tests/graw/vs-test.c
@@ -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);
diff --git a/src/gallium/tests/trivial/compute.c b/src/gallium/tests/trivial/compute.c
index 339c2647e81..4edb8576f52 100644
--- a/src/gallium/tests/trivial/compute.c
+++ b/src/gallium/tests/trivial/compute.c
@@ -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]) {
diff --git a/src/gallium/tools/trace/dump_state.py b/src/gallium/tools/trace/dump_state.py
index d4df2e09eab..8c3bdabdc8c 100755
--- a/src/gallium/tools/trace/dump_state.py
+++ b/src/gallium/tools/trace/dump_state.py
@@ -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)