summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2016-09-18 23:48:05 +0200
committerSamuel Pitoiset <[email protected]>2016-09-19 20:03:24 +0200
commit6ed05fa4cb22de8ef21c044e5ba586acdad3883a (patch)
treeb82fce0b96790730e0870acbe2b08fadef66af42 /src
parent407948df1beb4463c7f4c145ef1265a93ab89f57 (diff)
nvc0: get rid of nvc0_stage_sampler_states_bind_range()
Same thing as nvc0_stage_set_sampler_views_range(). Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_state.c83
1 files changed, 9 insertions, 74 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
index 5cbdda974fc..aac296c2b58 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
@@ -451,87 +451,22 @@ nvc0_stage_sampler_states_bind(struct nvc0_context *nvc0,
}
nvc0->num_samplers[s] = nr;
-
- nvc0->dirty_3d |= NVC0_NEW_3D_SAMPLERS;
-}
-
-static void
-nvc0_stage_sampler_states_bind_range(struct nvc0_context *nvc0,
- unsigned s,
- unsigned start, unsigned nr, void **cso)
-{
- const unsigned end = start + nr;
- int last_valid = -1;
- unsigned i;
-
- if (cso) {
- for (i = start; i < end; ++i) {
- const unsigned p = i - start;
- if (cso[p])
- last_valid = i;
- if (cso[p] == nvc0->samplers[s][i])
- continue;
- nvc0->samplers_dirty[s] |= 1 << i;
-
- if (nvc0->samplers[s][i])
- nvc0_screen_tsc_unlock(nvc0->screen, nvc0->samplers[s][i]);
- nvc0->samplers[s][i] = cso[p];
- }
- } else {
- for (i = start; i < end; ++i) {
- if (nvc0->samplers[s][i]) {
- nvc0_screen_tsc_unlock(nvc0->screen, nvc0->samplers[s][i]);
- nvc0->samplers[s][i] = NULL;
- nvc0->samplers_dirty[s] |= 1 << i;
- }
- }
- }
-
- if (nvc0->num_samplers[s] <= end) {
- if (last_valid < 0) {
- for (i = start; i && !nvc0->samplers[s][i - 1]; --i);
- nvc0->num_samplers[s] = i;
- } else {
- nvc0->num_samplers[s] = last_valid + 1;
- }
- }
}
static void
nvc0_bind_sampler_states(struct pipe_context *pipe,
enum pipe_shader_type shader,
- unsigned start, unsigned nr, void **s)
+ unsigned start, unsigned nr, void **samplers)
{
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- assert(start == 0);
- nvc0_stage_sampler_states_bind(nvc0_context(pipe), 0, nr, s);
- break;
- case PIPE_SHADER_TESS_CTRL:
- assert(start == 0);
- nvc0_stage_sampler_states_bind(nvc0_context(pipe), 1, nr, s);
- break;
- case PIPE_SHADER_TESS_EVAL:
- assert(start == 0);
- nvc0_stage_sampler_states_bind(nvc0_context(pipe), 2, nr, s);
- break;
- case PIPE_SHADER_GEOMETRY:
- assert(start == 0);
- nvc0_stage_sampler_states_bind(nvc0_context(pipe), 3, nr, s);
- break;
- case PIPE_SHADER_FRAGMENT:
- assert(start == 0);
- nvc0_stage_sampler_states_bind(nvc0_context(pipe), 4, nr, s);
- break;
- case PIPE_SHADER_COMPUTE:
- nvc0_stage_sampler_states_bind_range(nvc0_context(pipe), 5,
- start, nr, s);
+ const unsigned s = nvc0_shader_stage(shader);
+
+ assert(start == 0);
+ nvc0_stage_sampler_states_bind(nvc0_context(pipe), s, nr, samplers);
+
+ if (s == 5)
nvc0_context(pipe)->dirty_cp |= NVC0_NEW_CP_SAMPLERS;
- break;
- default:
- assert(!"unexpected shader type");
- break;
- }
+ else
+ nvc0_context(pipe)->dirty_3d |= NVC0_NEW_3D_SAMPLERS;
}