summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau
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/nouveau
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/nouveau')
-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
5 files changed, 73 insertions, 59 deletions
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;