summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw
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/auxiliary/draw
parentb11fc226e6b106de8eb777a8e62c4f7303c66fbc (diff)
downloadexternal_mesa3d-a3ed98f7aa85636579a5696bf036ec13e5c9104a.zip
external_mesa3d-a3ed98f7aa85636579a5696bf036ec13e5c9104a.tar.gz
external_mesa3d-a3ed98f7aa85636579a5696bf036ec13e5c9104a.tar.bz2
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/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c37
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c33
2 files changed, 37 insertions, 33 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 3c93bf7..d00b721 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 e39276a..17b1d3d 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;