summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-10-07 18:16:22 -0600
committerBrian Paul <[email protected]>2013-10-23 10:15:38 -0600
commita3ed98f7aa85636579a5696bf036ec13e5c9104a (patch)
tree104078a2a8b875e5ec7c5524e7797d46d109d7e0 /src/gallium/drivers
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 <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Tested-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-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
21 files changed, 188 insertions, 368 deletions
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);