From a3ed98f7aa85636579a5696bf036ec13e5c9104a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 7 Oct 2013 18:16:22 -0600 Subject: gallium: new, unified pipe_context::set_sampler_views() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marek Olšák Tested-by: Emil Velikov --- src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 33 ++++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/gallium/auxiliary/draw/draw_pipe_pstipple.c') 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; -- cgit v1.2.3