From eaabb4ead07ae043ecc789024028e225ebd0f318 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 24 May 2013 16:08:39 -0400 Subject: gallium: Add support for multiple viewports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gallium supported only a single viewport/scissor combination. This commit changes the interface to allow us to add support for multiple viewports/scissors. Signed-off-by: Zack Rusin Reviewed-by: Marek Olšák Reviewed-by: José Fonseca Reviewed-by: Brian Paul Reviewed-by: Roland Scheidegger --- src/gallium/drivers/r600/evergreen_state.c | 6 ++++-- src/gallium/drivers/r600/r600_state.c | 8 +++++--- src/gallium/drivers/r600/r600_state_common.c | 10 ++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'src/gallium/drivers/r600') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index f49c5952104..3ebb157b530 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1309,7 +1309,9 @@ static void evergreen_get_scissor_rect(struct r600_context *rctx, *br = S_028244_BR_X(br_x) | S_028244_BR_Y(br_y); } -static void evergreen_set_scissor_state(struct pipe_context *ctx, +static void evergreen_set_scissor_states(struct pipe_context *ctx, + unsigned start_slot, + unsigned num_scissors, const struct pipe_scissor_state *state) { struct r600_context *rctx = (struct r600_context *)ctx; @@ -3860,7 +3862,7 @@ void evergreen_init_state_functions(struct r600_context *rctx) rctx->context.create_sampler_view = evergreen_create_sampler_view; rctx->context.set_framebuffer_state = evergreen_set_framebuffer_state; rctx->context.set_polygon_stipple = evergreen_set_polygon_stipple; - rctx->context.set_scissor_state = evergreen_set_scissor_state; + rctx->context.set_scissor_states = evergreen_set_scissor_states; if (rctx->chip_class == EVERGREEN) rctx->context.get_sample_position = evergreen_get_sample_position; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index f0e36753d2b..068d87126e5 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1215,8 +1215,10 @@ static void r600_emit_scissor_state(struct r600_context *rctx, struct r600_atom } } -static void r600_set_scissor_state(struct pipe_context *ctx, - const struct pipe_scissor_state *state) +static void r600_set_scissor_states(struct pipe_context *ctx, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state *state) { struct r600_context *rctx = (struct r600_context *)ctx; @@ -3252,7 +3254,7 @@ void r600_init_state_functions(struct r600_context *rctx) rctx->context.create_sampler_view = r600_create_sampler_view; rctx->context.set_framebuffer_state = r600_set_framebuffer_state; rctx->context.set_polygon_stipple = r600_set_polygon_stipple; - rctx->context.set_scissor_state = r600_set_scissor_state; + rctx->context.set_scissor_states = r600_set_scissor_states; rctx->context.get_sample_position = r600_get_sample_position; } diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index fbac57688be..4995c81cc46 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -660,8 +660,10 @@ static void r600_set_ps_sampler_views(struct pipe_context *ctx, unsigned count, r600_set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, count, views); } -static void r600_set_viewport_state(struct pipe_context *ctx, - const struct pipe_viewport_state *state) +static void r600_set_viewport_states(struct pipe_context *ctx, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *state) { struct r600_context *rctx = (struct r600_context *)ctx; @@ -1547,7 +1549,7 @@ void r600_draw_rectangle(struct blitter_context *blitter, viewport.translate[1] = 0.0f; viewport.translate[2] = 0.0f; viewport.translate[3] = 0.0f; - rctx->context.set_viewport_state(&rctx->context, &viewport); + rctx->context.set_viewport_states(&rctx->context, 0, 1, &viewport); /* Upload vertices. The hw rectangle has only 3 vertices, * I guess the 4th one is derived from the first 3. @@ -1750,7 +1752,7 @@ void r600_init_common_state_functions(struct r600_context *rctx) rctx->context.set_constant_buffer = r600_set_constant_buffer; rctx->context.set_sample_mask = r600_set_sample_mask; rctx->context.set_stencil_ref = r600_set_pipe_stencil_ref; - rctx->context.set_viewport_state = r600_set_viewport_state; + rctx->context.set_viewport_states = r600_set_viewport_states; rctx->context.set_vertex_buffers = r600_set_vertex_buffers; rctx->context.set_index_buffer = r600_set_index_buffer; rctx->context.set_fragment_sampler_views = r600_set_ps_sampler_views; -- cgit v1.2.3