diff options
author | Zack Rusin <zackr@vmware.com> | 2013-05-24 16:08:39 -0400 |
---|---|---|
committer | Zack Rusin <zackr@vmware.com> | 2013-05-25 09:49:20 -0400 |
commit | eaabb4ead07ae043ecc789024028e225ebd0f318 (patch) | |
tree | 3cd3788f1f6ba45b5855e6858b306f3f6d880500 | |
parent | e6efb900e7a7601797b2e8263388fe72f6820e9b (diff) |
gallium: Add support for multiple viewports
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 <zackr@vmware.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: José Fonseca<jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
52 files changed, 265 insertions, 166 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index e46f2abf632..b06a070ad83 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -652,7 +652,7 @@ void cso_set_viewport(struct cso_context *ctx, { if (memcmp(&ctx->vp, vp, sizeof(*vp))) { ctx->vp = *vp; - ctx->pipe->set_viewport_state(ctx->pipe, vp); + ctx->pipe->set_viewport_states(ctx->pipe, 0, 1, vp); } } @@ -666,7 +666,7 @@ void cso_restore_viewport(struct cso_context *ctx) { if (memcmp(&ctx->vp, &ctx->vp_saved, sizeof(ctx->vp))) { ctx->vp = ctx->vp_saved; - ctx->pipe->set_viewport_state(ctx->pipe, &ctx->vp); + ctx->pipe->set_viewport_states(ctx->pipe, 0, 1, &ctx->vp); } } diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 78190388ef1..b555c65e858 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -311,9 +311,12 @@ void draw_set_clip_state( struct draw_context *draw, /** * Set the draw module's viewport state. */ -void draw_set_viewport_state( struct draw_context *draw, - const struct pipe_viewport_state *viewport ) +void draw_set_viewport_states( struct draw_context *draw, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *vps ) { + const struct pipe_viewport_state *viewport = vps; draw_do_flush(draw, DRAW_FLUSH_PARAMETER_CHANGE); draw->viewport = *viewport; /* struct copy */ draw->identity_viewport = (viewport->scale[0] == 1.0f && diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 47bad0d73d4..2d843b7a047 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -71,8 +71,10 @@ void draw_destroy( struct draw_context *draw ); void draw_flush(struct draw_context *draw); -void draw_set_viewport_state( struct draw_context *draw, - const struct pipe_viewport_state *viewport ); +void draw_set_viewport_states( struct draw_context *draw, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *viewports ); void draw_set_clip_state( struct draw_context *pipe, const struct pipe_clip_state *clip ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index bd79405a8aa..0230267a5de 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -211,6 +211,12 @@ tgsi_scan_shader(const struct tgsi_token *tokens, fulldecl->Semantic.Name == TGSI_SEMANTIC_EDGEFLAG) { info->writes_edgeflag = TRUE; } + + if (procType == TGSI_PROCESSOR_GEOMETRY && + fulldecl->Semantic.Name == + TGSI_SEMANTIC_VIEWPORT_INDEX) { + info->writes_viewport_index = TRUE; + } } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h index 9debc341f52..676abf0c9a9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h @@ -75,6 +75,7 @@ struct tgsi_shader_info boolean origin_lower_left; boolean pixel_center_integer; boolean color0_writes_all_cbufs; + boolean writes_viewport_index; unsigned num_written_clipdistance; /** diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index 95a5aded819..6abf9272a26 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -78,7 +78,8 @@ const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] = "BLOCK_SIZE", "THREAD_ID", "TEXCOORD", - "PCOORD" + "PCOORD", + "VIEWPORT_INDEX" }; const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] = diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 2acc5afc2b8..8c871fdf912 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -504,7 +504,7 @@ static void blitter_restore_fragment_states(struct blitter_context_priv *ctx) /* XXX check whether these are saved and whether they need to be restored * (depending on the operation) */ pipe->set_stencil_ref(pipe, &ctx->base.saved_stencil_ref); - pipe->set_viewport_state(pipe, &ctx->base.saved_viewport); + pipe->set_viewport_states(pipe, 0, 1, &ctx->base.saved_viewport); } static void blitter_check_saved_fb_state(struct blitter_context_priv *ctx) @@ -599,7 +599,7 @@ static void blitter_set_rectangle(struct blitter_context_priv *ctx, ctx->viewport.translate[1] = 0.5f * ctx->dst_height; ctx->viewport.translate[2] = 0.0f; ctx->viewport.translate[3] = 0.0f; - ctx->base.pipe->set_viewport_state(ctx->base.pipe, &ctx->viewport); + ctx->base.pipe->set_viewport_states(ctx->base.pipe, 0, 1, &ctx->viewport); } static void blitter_set_clear_color(struct blitter_context_priv *ctx, @@ -1401,7 +1401,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, pipe->bind_vertex_elements_state(pipe, ctx->velem_state); if (scissor) { - pipe->set_scissor_state(pipe, scissor); + pipe->set_scissor_states(pipe, 0, 1, scissor); } blitter_set_common_draw_rect_state(ctx, scissor != NULL); @@ -1496,7 +1496,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, blitter_restore_textures(ctx); blitter_restore_fb_state(ctx); if (scissor) { - pipe->set_scissor_state(pipe, &ctx->base.saved_scissor); + pipe->set_scissor_states(pipe, 0, 1, &ctx->base.saved_scissor); } blitter_restore_render_cond(ctx); blitter_unset_running_flag(ctx); diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 62f593a3203..4b8308796eb 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -723,7 +723,7 @@ draw_layers(struct vl_compositor *c, struct vl_compositor_state *s, struct u_rec void *blend = layer->blend ? layer->blend : i ? c->blend_add : c->blend_clear; c->pipe->bind_blend_state(c->pipe, blend); - c->pipe->set_viewport_state(c->pipe, &layer->viewport); + c->pipe->set_viewport_states(c->pipe, 0, 1, &layer->viewport); c->pipe->bind_fs_state(c->pipe, layer->fs); c->pipe->bind_fragment_sampler_states(c->pipe, num_sampler_views, layer->samplers); c->pipe->set_fragment_sampler_views(c->pipe, num_sampler_views, samplers); @@ -1014,7 +1014,7 @@ vl_compositor_render(struct vl_compositor_state *s, dirty_area->x1 = dirty_area->y1 = MIN_DIRTY; } - c->pipe->set_scissor_state(c->pipe, &s->scissor); + c->pipe->set_scissor_states(c->pipe, 0, 1, &s->scissor); c->pipe->set_framebuffer_state(c->pipe, &c->fb_state); c->pipe->bind_vs_state(c->pipe, c->vs); c->pipe->set_vertex_buffers(c->pipe, 0, 1, &c->vertex_buf); diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c index bd73dfd40f7..5346cbc0ed7 100644 --- a/src/gallium/auxiliary/vl/vl_idct.c +++ b/src/gallium/auxiliary/vl/vl_idct.c @@ -830,14 +830,14 @@ vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_ /* mismatch control */ idct->pipe->set_framebuffer_state(idct->pipe, &buffer->fb_state_mismatch); - idct->pipe->set_viewport_state(idct->pipe, &buffer->viewport_mismatch); + idct->pipe->set_viewport_states(idct->pipe, 0, 1, &buffer->viewport_mismatch); idct->pipe->bind_vs_state(idct->pipe, idct->vs_mismatch); idct->pipe->bind_fs_state(idct->pipe, idct->fs_mismatch); util_draw_arrays_instanced(idct->pipe, PIPE_PRIM_POINTS, 0, 1, 0, num_instances); /* first stage */ idct->pipe->set_framebuffer_state(idct->pipe, &buffer->fb_state); - idct->pipe->set_viewport_state(idct->pipe, &buffer->viewport); + idct->pipe->set_viewport_states(idct->pipe, 0, 1, &buffer->viewport); idct->pipe->bind_vs_state(idct->pipe, idct->vs); idct->pipe->bind_fs_state(idct->pipe, idct->fs); util_draw_arrays_instanced(idct->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances); diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c index cda90ff10eb..9bd7ed15019 100644 --- a/src/gallium/auxiliary/vl/vl_matrix_filter.c +++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c @@ -311,7 +311,7 @@ vl_matrix_filter_render(struct vl_matrix_filter *filter, filter->pipe->bind_vs_state(filter->pipe, filter->vs); filter->pipe->bind_fs_state(filter->pipe, filter->fs); filter->pipe->set_framebuffer_state(filter->pipe, &fb_state); - filter->pipe->set_viewport_state(filter->pipe, &viewport); + filter->pipe->set_viewport_states(filter->pipe, 0, 1, &viewport); filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, &filter->quad); filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves); diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c index b4272093655..1fd40c37d16 100644 --- a/src/gallium/auxiliary/vl/vl_mc.c +++ b/src/gallium/auxiliary/vl/vl_mc.c @@ -600,7 +600,7 @@ prepare_pipe_4_rendering(struct vl_mc *renderer, struct vl_mc_buffer *buffer, un renderer->pipe->bind_blend_state(renderer->pipe, renderer->blend_clear[mask]); renderer->pipe->set_framebuffer_state(renderer->pipe, &buffer->fb_state); - renderer->pipe->set_viewport_state(renderer->pipe, &buffer->viewport); + renderer->pipe->set_viewport_states(renderer->pipe, 0, 1, &buffer->viewport); } void diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c index 2db147904b8..158751a22b3 100644 --- a/src/gallium/auxiliary/vl/vl_median_filter.c +++ b/src/gallium/auxiliary/vl/vl_median_filter.c @@ -390,7 +390,7 @@ vl_median_filter_render(struct vl_median_filter *filter, filter->pipe->bind_vs_state(filter->pipe, filter->vs); filter->pipe->bind_fs_state(filter->pipe, filter->fs); filter->pipe->set_framebuffer_state(filter->pipe, &fb_state); - filter->pipe->set_viewport_state(filter->pipe, &viewport); + filter->pipe->set_viewport_states(filter->pipe, 0, 1, &viewport); filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, &filter->quad); filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves); diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c index 262fb0dc491..33baa3d9902 100644 --- a/src/gallium/auxiliary/vl/vl_zscan.c +++ b/src/gallium/auxiliary/vl/vl_zscan.c @@ -576,7 +576,7 @@ vl_zscan_render(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned zscan->pipe->bind_blend_state(zscan->pipe, zscan->blend); zscan->pipe->bind_fragment_sampler_states(zscan->pipe, 3, zscan->samplers); zscan->pipe->set_framebuffer_state(zscan->pipe, &buffer->fb_state); - zscan->pipe->set_viewport_state(zscan->pipe, &buffer->viewport); + zscan->pipe->set_viewport_states(zscan->pipe, 0, 1, &buffer->viewport); zscan->pipe->set_fragment_sampler_views(zscan->pipe, 3, &buffer->src); zscan->pipe->bind_vs_state(zscan->pipe, zscan->vs); zscan->pipe->bind_fs_state(zscan->pipe, zscan->fs); diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 2cc1848be6a..679772fae81 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -68,13 +68,15 @@ objects. They all follow simple, one-method binding calls, e.g. * ``set_sample_mask`` * ``set_clip_state`` * ``set_polygon_stipple`` -* ``set_scissor_state`` sets the bounds for the scissor test, which culls +* ``set_scissor_states`` sets the bounds for the scissor test, which culls pixels before blending to render targets. If the :ref:`Rasterizer` does not have the scissor test enabled, then the scissor bounds never need to be set since they will not be used. Note that scissor xmin and ymin are inclusive, but xmax and ymax are exclusive. The inclusive ranges in x - and y would be [xmin..xmax-1] and [ymin..ymax-1]. -* ``set_viewport_state`` + and y would be [xmin..xmax-1] and [ymin..ymax-1]. The number of scissors + should be the same as the number of set viewports and can be up to + PIPE_MAX_VIEWPORTS. +* ``set_viewport_states`` Sampler Views diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c index ce9a522c6ab..9f4e4f83ade 100644 --- a/src/gallium/drivers/freedreno/freedreno_state.c +++ b/src/gallium/drivers/freedreno/freedreno_state.c @@ -158,7 +158,9 @@ fd_set_polygon_stipple(struct pipe_context *pctx, } static void -fd_set_scissor_state(struct pipe_context *pctx, +fd_set_scissor_states(struct pipe_context *pctx, + unsigned start_slot, + unsigned num_scissors, const struct pipe_scissor_state *scissor) { struct fd_context *ctx = fd_context(pctx); @@ -168,7 +170,9 @@ fd_set_scissor_state(struct pipe_context *pctx, } static void -fd_set_viewport_state(struct pipe_context *pctx, +fd_set_viewport_states(struct pipe_context *pctx, + unsigned start_slot, + unsigned num_viewports, const struct pipe_viewport_state *viewport) { struct fd_context *ctx = fd_context(pctx); @@ -234,8 +238,8 @@ fd_state_init(struct pipe_context *pctx) pctx->set_constant_buffer = fd_set_constant_buffer; pctx->set_framebuffer_state = fd_set_framebuffer_state; pctx->set_polygon_stipple = fd_set_polygon_stipple; - pctx->set_scissor_state = fd_set_scissor_state; - pctx->set_viewport_state = fd_set_viewport_state; + pctx->set_scissor_states = fd_set_scissor_states; + pctx->set_viewport_states = fd_set_viewport_states; pctx->set_vertex_buffers = fd_set_vertex_buffers; pctx->set_index_buffer = fd_set_index_buffer; diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index a73a3ad44c0..7e8af565c13 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -524,25 +524,29 @@ galahad_context_set_polygon_stipple(struct pipe_context *_pipe, } static void -galahad_context_set_scissor_state(struct pipe_context *_pipe, +galahad_context_set_scissor_states(struct pipe_context *_pipe, + unsigned start_slot, + unsigned num_scissors, const struct pipe_scissor_state *scissor) { struct galahad_context *glhd_pipe = galahad_context(_pipe); struct pipe_context *pipe = glhd_pipe->pipe; - pipe->set_scissor_state(pipe, - scissor); + pipe->set_scissor_states(pipe, start_slot, num_scissors, + scissor); } static void -galahad_context_set_viewport_state(struct pipe_context *_pipe, +galahad_context_set_viewport_states(struct pipe_context *_pipe, + unsigned start_slot, + unsigned num_viewports, const struct pipe_viewport_state *viewport) { struct galahad_context *glhd_pipe = galahad_context(_pipe); struct pipe_context *pipe = glhd_pipe->pipe; - pipe->set_viewport_state(pipe, - viewport); + pipe->set_viewport_states(pipe, start_slot, num_viewports, + viewport); } static void @@ -1077,8 +1081,8 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) GLHD_PIPE_INIT(set_constant_buffer); GLHD_PIPE_INIT(set_framebuffer_state); GLHD_PIPE_INIT(set_polygon_stipple); - GLHD_PIPE_INIT(set_scissor_state); - GLHD_PIPE_INIT(set_viewport_state); + GLHD_PIPE_INIT(set_scissor_states); + GLHD_PIPE_INIT(set_viewport_states); GLHD_PIPE_INIT(set_fragment_sampler_views); GLHD_PIPE_INIT(set_vertex_sampler_views); GLHD_PIPE_INIT(set_geometry_sampler_views); diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 4a4faa5298c..06d4d3bd1af 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -534,7 +534,9 @@ static void i915_delete_depth_stencil_state(struct pipe_context *pipe, } -static void i915_set_scissor_state( struct pipe_context *pipe, +static void i915_set_scissor_states( struct pipe_context *pipe, + unsigned start_slot, + unsigned num_scissors, const struct pipe_scissor_state *scissor ) { struct i915_context *i915 = i915_context(pipe); @@ -825,7 +827,9 @@ static void i915_set_clip_state( struct pipe_context *pipe, /* Called when driver state tracker notices changes to the viewport * matrix: */ -static void i915_set_viewport_state( struct pipe_context *pipe, +static void i915_set_viewport_states( struct pipe_context *pipe, + unsigned start_slot, + unsigned num_viewports, const struct pipe_viewport_state *viewport ) { struct i915_context *i915 = i915_context(pipe); @@ -833,7 +837,8 @@ static void i915_set_viewport_state( struct pipe_context *pipe, i915->viewport = *viewport; /* struct copy */ /* pass the viewport info to the draw module */ - draw_set_viewport_state(i915->draw, &i915->viewport); + draw_set_viewport_states(i915->draw, start_slot, num_viewports, + &i915->viewport); i915->dirty |= I915_NEW_VIEWPORT; } @@ -1040,12 +1045,12 @@ i915_init_state_functions( struct i915_context *i915 ) i915->base.set_framebuffer_state = i915_set_framebuffer_state; i915->base.set_polygon_stipple = i915_set_polygon_stipple; - i915->base.set_scissor_state = i915_set_scissor_state; + i915->base.set_scissor_states = i915_set_scissor_states; i915->base.set_fragment_sampler_views = i915_set_fragment_sampler_views; i915->base.set_vertex_sampler_views = i915_set_vertex_sampler_views; i915->base.create_sampler_view = i915_create_sampler_view; i915->base.sampler_view_destroy = i915_sampler_view_destroy; - i915->base.set_viewport_state = i915_set_viewport_state; + i915->base.set_viewport_states = i915_set_viewport_states; i915->base.set_vertex_buffers = i915_set_vertex_buffers; i915->base.set_index_buffer = i915_set_index_buffer; } diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 0eff6c926c2..6b342ebd146 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -486,25 +486,27 @@ identity_set_polygon_stipple(struct pipe_context *_pipe, } static void -identity_set_scissor_state(struct pipe_context *_pipe, - const struct pipe_scissor_state *scissor) +identity_set_scissor_states(struct pipe_context *_pipe, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state *scissor) { struct identity_context *id_pipe = identity_context(_pipe); struct pipe_context *pipe = id_pipe->pipe; - pipe->set_scissor_state(pipe, - scissor); + pipe->set_scissor_states(pipe, start_slot, num_scissors, scissor); } static void -identity_set_viewport_state(struct pipe_context *_pipe, - const struct pipe_viewport_state *viewport) +identity_set_viewport_states(struct pipe_context *_pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *viewport) { struct identity_context *id_pipe = identity_context(_pipe); struct pipe_context *pipe = id_pipe->pipe; - pipe->set_viewport_state(pipe, - viewport); + pipe->set_viewport_states(pipe, start_slot, num_viewports, viewport); } static void @@ -914,8 +916,8 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) id_pipe->base.set_constant_buffer = identity_set_constant_buffer; id_pipe->base.set_framebuffer_state = identity_set_framebuffer_state; id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple; - id_pipe->base.set_scissor_state = identity_set_scissor_state; - id_pipe->base.set_viewport_state = identity_set_viewport_state; + id_pipe->base.set_scissor_states = identity_set_scissor_states; + id_pipe->base.set_viewport_states = identity_set_viewport_states; id_pipe->base.set_fragment_sampler_views = identity_set_fragment_sampler_views; id_pipe->base.set_vertex_sampler_views = identity_set_vertex_sampler_views; id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers; diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c index 8443a2cc9d2..33da429bf37 100644 --- a/src/gallium/drivers/ilo/ilo_state.c +++ b/src/gallium/drivers/ilo/ilo_state.c @@ -563,8 +563,10 @@ ilo_set_polygon_stipple(struct pipe_context *pipe, } static void -ilo_set_scissor_state(struct pipe_context *pipe, - const struct pipe_scissor_state *state) +ilo_set_scissor_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state *state) { struct ilo_context *ilo = ilo_context(pipe); @@ -574,8 +576,10 @@ ilo_set_scissor_state(struct pipe_context *pipe, } static void -ilo_set_viewport_state(struct pipe_context *pipe, - const struct pipe_viewport_state *state) +ilo_set_viewport_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *state) { struct ilo_context *ilo = ilo_context(pipe); @@ -992,8 +996,8 @@ ilo_init_state_functions(struct ilo_context *ilo) ilo->base.set_constant_buffer = ilo_set_constant_buffer; ilo->base.set_framebuffer_state = ilo_set_framebuffer_state; ilo->base.set_polygon_stipple = ilo_set_polygon_stipple; - ilo->base.set_scissor_state = ilo_set_scissor_state; - ilo->base.set_viewport_state = ilo_set_viewport_state; + ilo->base.set_scissor_states = ilo_set_scissor_states; + ilo->base.set_viewport_states = ilo_set_viewport_states; ilo->base.set_fragment_sampler_views = ilo_set_fragment_sampler_views; ilo->base.set_vertex_sampler_views = ilo_set_vertex_sampler_views; ilo->base.set_geometry_sampler_views = ilo_set_geometry_sampler_views; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 073d7519184..35630b95249 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -230,6 +230,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 1; case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER: return 0; + case PIPE_CAP_MAX_VIEWPORTS: + return 1; } /* should only get here on unhandled cases */ debug_printf("Unexpected PIPE_CAP %d query\n", param); diff --git a/src/gallium/drivers/llvmpipe/lp_state_clip.c b/src/gallium/drivers/llvmpipe/lp_state_clip.c index 32ae079cc15..a26c79f72f6 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_clip.c +++ b/src/gallium/drivers/llvmpipe/lp_state_clip.c @@ -44,28 +44,33 @@ llvmpipe_set_clip_state(struct pipe_context *pipe, static void -llvmpipe_set_viewport_state(struct pipe_context *pipe, - const struct pipe_viewport_state *viewport) +llvmpipe_set_viewport_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *viewports) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); /* pass the viewport info to the draw module */ - draw_set_viewport_state(llvmpipe->draw, viewport); + draw_set_viewport_states(llvmpipe->draw, start_slot, num_viewports, + viewports); - llvmpipe->viewport = *viewport; /* struct copy */ + llvmpipe->viewport = *viewports; /* struct copy */ llvmpipe->dirty |= LP_NEW_VIEWPORT; } static void -llvmpipe_set_scissor_state(struct pipe_context *pipe, - const struct pipe_scissor_state *scissor) +llvmpipe_set_scissor_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state *scissors) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); draw_flush(llvmpipe->draw); - llvmpipe->scissor = *scissor; /* struct copy */ + llvmpipe->scissor = *scissors; /* struct copy */ llvmpipe->dirty |= LP_NEW_SCISSOR; } @@ -89,6 +94,6 @@ llvmpipe_init_clip_funcs(struct llvmpipe_context *llvmpipe) { llvmpipe->pipe.set_clip_state = llvmpipe_set_clip_state; llvmpipe->pipe.set_polygon_stipple = llvmpipe_set_polygon_stipple; - llvmpipe->pipe.set_scissor_state = llvmpipe_set_scissor_state; - llvmpipe->pipe.set_viewport_state = llvmpipe_set_viewport_state; + llvmpipe->pipe.set_scissor_states = llvmpipe_set_scissor_states; + llvmpipe->pipe.set_viewport_states = llvmpipe_set_viewport_states; } diff --git a/src/gallium/drivers/noop/noop_state.c b/src/gallium/drivers/noop/noop_state.c index f56ff597c6c..29eeda87339 100644 --- a/src/gallium/drivers/noop/noop_state.c +++ b/src/gallium/drivers/noop/noop_state.c @@ -152,8 +152,10 @@ static void noop_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask { } -static void noop_set_scissor_state(struct pipe_context *ctx, - const struct pipe_scissor_state *state) +static void noop_set_scissor_states(struct pipe_context *ctx, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state *state) { } @@ -162,8 +164,10 @@ static void noop_set_stencil_ref(struct pipe_context *ctx, { } -static void noop_set_viewport_state(struct pipe_context *ctx, - const struct pipe_viewport_state *state) +static void noop_set_viewport_states(struct pipe_context *ctx, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *state) { } @@ -311,12 +315,12 @@ void noop_init_state_functions(struct pipe_context *ctx) ctx->set_framebuffer_state = noop_set_framebuffer_state; ctx->set_polygon_stipple = noop_set_polygon_stipple; ctx->set_sample_mask = noop_set_sample_mask; - ctx->set_scissor_state = noop_set_scissor_state; + ctx->set_scissor_states = noop_set_scissor_states; ctx->set_stencil_ref = noop_set_stencil_ref; ctx->set_vertex_buffers = noop_set_vertex_buffers; ctx->set_index_buffer = noop_set_index_buffer; ctx->set_vertex_sampler_views = noop_set_vs_sampler_view; - ctx->set_viewport_state = noop_set_viewport_state; + ctx->set_viewport_states = noop_set_viewport_states; ctx->sampler_view_destroy = noop_sampler_view_destroy; ctx->surface_destroy = noop_surface_destroy; ctx->draw_vbo = noop_draw_vbo; diff --git a/src/gallium/drivers/nv30/nv30_draw.c b/src/gallium/drivers/nv30/nv30_draw.c index e0a1628eb91..85b4fcd877b 100644 --- a/src/gallium/drivers/nv30/nv30_draw.c +++ b/src/gallium/drivers/nv30/nv30_draw.c @@ -373,7 +373,7 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) nv30_render_validate(nv30); if (nv30->draw_dirty & NV30_NEW_VIEWPORT) - draw_set_viewport_state(draw, &nv30->viewport); + draw_set_viewport_states(draw, 0, 1, &nv30->viewport); if (nv30->draw_dirty & NV30_NEW_RASTERIZER) draw_set_rasterizer_state(draw, &nv30->rast->pipe, NULL); if (nv30->draw_dirty & NV30_NEW_CLIP) diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c index 2a80974d126..55f2b8c0a77 100644 --- a/src/gallium/drivers/nv30/nv30_state.c +++ b/src/gallium/drivers/nv30/nv30_state.c @@ -373,8 +373,10 @@ nv30_set_polygon_stipple(struct pipe_context *pipe, } static void -nv30_set_scissor_state(struct pipe_context *pipe, - const struct pipe_scissor_state *scissor) +nv30_set_scissor_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_scissor_state *scissor) { struct nv30_context *nv30 = nv30_context(pipe); @@ -383,8 +385,10 @@ nv30_set_scissor_state(struct pipe_context *pipe, } static void -nv30_set_viewport_state(struct pipe_context *pipe, - const struct pipe_viewport_state *vpt) +nv30_set_viewport_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *vpt) { struct nv30_context *nv30 = nv30_context(pipe); @@ -446,8 +450,8 @@ nv30_state_init(struct pipe_context *pipe) pipe->set_constant_buffer = nv30_set_constant_buffer; pipe->set_framebuffer_state = nv30_set_framebuffer_state; pipe->set_polygon_stipple = nv30_set_polygon_stipple; - pipe->set_scissor_state = nv30_set_scissor_state; - pipe->set_viewport_state = nv30_set_viewport_state; + pipe->set_scissor_states = nv30_set_scissor_states; + pipe->set_viewport_states = nv30_set_viewport_states; pipe->set_vertex_buffers = nv30_set_vertex_buffers; pipe->set_index_buffer = nv30_set_index_buffer; diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index ffabf4cff56..2454a3dc98a 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -871,8 +871,10 @@ nv50_set_polygon_stipple(struct pipe_context *pipe, } static void -nv50_set_scissor_state(struct pipe_context *pipe, - const struct pipe_scissor_state *scissor) +nv50_set_scissor_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state *scissor) { struct nv50_context *nv50 = nv50_context(pipe); @@ -881,8 +883,10 @@ nv50_set_scissor_state(struct pipe_context *pipe, } static void -nv50_set_viewport_state(struct pipe_context *pipe, - const struct pipe_viewport_state *vpt) +nv50_set_viewport_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *vpt) { struct nv50_context *nv50 = nv50_context(pipe); @@ -1090,8 +1094,8 @@ nv50_init_state_functions(struct nv50_context *nv50) pipe->set_constant_buffer = nv50_set_constant_buffer; pipe->set_framebuffer_state = nv50_set_framebuffer_state; pipe->set_polygon_stipple = nv50_set_polygon_stipple; - pipe->set_scissor_state = nv50_set_scissor_state; - pipe->set_viewport_state = nv50_set_viewport_state; + pipe->set_scissor_states = nv50_set_scissor_states; + pipe->set_viewport_states = nv50_set_viewport_states; pipe->create_vertex_elements_state = nv50_vertex_state_create; pipe->delete_vertex_elements_state = nv50_vertex_state_delete; diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c index 9adc99cf014..2f40369310a 100644 --- a/src/gallium/drivers/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nvc0/nvc0_state.c @@ -903,8 +903,10 @@ nvc0_set_polygon_stipple(struct pipe_context *pipe, } static void -nvc0_set_scissor_state(struct pipe_context *pipe, - const struct pipe_scissor_state *scissor) +nvc0_set_scissor_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state *scissor) { struct nvc0_context *nvc0 = nvc0_context(pipe); @@ -913,8 +915,10 @@ nvc0_set_scissor_state(struct pipe_context *pipe, } static void -nvc0_set_viewport_state(struct pipe_context *pipe, - const struct pipe_viewport_state *vpt) +nvc0_set_viewport_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *vpt) { struct nvc0_context *nvc0 = nvc0_context(pipe); @@ -1223,8 +1227,8 @@ nvc0_init_state_functions(struct nvc0_context *nvc0) pipe->set_constant_buffer = nvc0_set_constant_buffer; pipe->set_framebuffer_state = nvc0_set_framebuffer_state; pipe->set_polygon_stipple = nvc0_set_polygon_stipple; - pipe->set_scissor_state = nvc0_set_scissor_state; - pipe->set_viewport_state = nvc0_set_viewport_state; + pipe->set_scissor_states = nvc0_set_scissor_states; + pipe->set_viewport_states = nvc0_set_viewport_states; pipe->create_vertex_elements_state = nvc0_vertex_state_create; pipe->delete_vertex_elements_state = nvc0_vertex_state_delete; diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index ba1859bf8b5..7647f9e2aa0 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -275,7 +275,7 @@ static void r300_init_states(struct pipe_context *pipe) pipe->set_blend_color(pipe, &bc); pipe->set_clip_state(pipe, &cs); - pipe->set_scissor_state(pipe, &ss); + pipe->set_scissor_states(pipe, 0, 1, &ss); pipe->set_sample_mask(pipe, ~0); /* Initialize the GPU flush. */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 36d510dc45e..6cfc192900a 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1722,8 +1722,10 @@ static void r300_set_sample_mask(struct pipe_context *pipe, r300_mark_atom_dirty(r300, &r300->sample_mask); } -static void r300_set_scissor_state(struct pipe_context* pipe, - const struct pipe_scissor_state* state) +static void r300_set_scissor_states(struct pipe_context* pipe, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state* state) { struct r300_context* r300 = r300_context(pipe); @@ -1733,8 +1735,10 @@ static void r300_set_scissor_state(struct pipe_context* pipe, r300_mark_atom_dirty(r300, &r300->scissor_state); } -static void r300_set_viewport_state(struct pipe_context* pipe, - const struct pipe_viewport_state* state) +static void r300_set_viewport_states(struct pipe_context* pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state* state) { struct r300_context* r300 = r300_context(pipe); struct r300_viewport_state* viewport = @@ -1743,7 +1747,7 @@ static void r300_set_viewport_state(struct pipe_context* pipe, r300->viewport = *state; if (r300->draw) { - draw_set_viewport_state(r300->draw, state); + draw_set_viewport_states(r300->draw, start_slot, num_viewports, state); viewport->vte_control = R300_VTX_XY_FMT | R300_VTX_Z_FMT; return; } @@ -2162,9 +2166,9 @@ void r300_init_state_functions(struct r300_context* r300) r300->context.create_sampler_view = r300_create_sampler_view; r300->context.sampler_view_destroy = r300_sampler_view_destroy; - r300->context.set_scissor_state = r300_set_scissor_state; + r300->context.set_scissor_states = r300_set_scissor_states; - r300->context.set_viewport_state = r300_set_viewport_state; + r300->context.set_viewport_states = r300_set_viewport_states; if (r300->screen->caps.has_tcl) { r300->context.set_vertex_buffers = r300_set_vertex_buffers_hwtcl; 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; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 4556be699cb..82c16411acd 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -263,8 +263,10 @@ static void si_set_clip_state(struct pipe_context *ctx, si_pm4_set_state(rctx, clip, pm4); } -static void si_set_scissor_state(struct pipe_context *ctx, - const struct pipe_scissor_state *state) +static void si_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; struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state); @@ -287,8 +289,10 @@ static void si_set_scissor_state(struct pipe_context *ctx, si_pm4_set_state(rctx, scissor, pm4); } -static void si_set_viewport_state(struct pipe_context *ctx, - const struct pipe_viewport_state *state) +static void si_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; struct si_state_viewport *viewport = CALLOC_STRUCT(si_state_viewport); @@ -2705,8 +2709,8 @@ void si_init_state_functions(struct r600_context *rctx) rctx->custom_dsa_flush_inplace = si_create_db_flush_dsa(rctx, false, false); rctx->context.set_clip_state = si_set_clip_state; - rctx->context.set_scissor_state = si_set_scissor_state; - rctx->context.set_viewport_state = si_set_viewport_state; + rctx->context.set_scissor_states = si_set_scissor_states; + rctx->context.set_viewport_states = si_set_viewport_states; rctx->context.set_stencil_ref = si_set_pipe_stencil_ref; rctx->context.set_framebuffer_state = si_set_framebuffer_state; diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index bf939b9b678..721419750bb 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -693,28 +693,30 @@ rbug_set_polygon_stipple(struct pipe_context *_pipe, } static void -rbug_set_scissor_state(struct pipe_context *_pipe, - const struct pipe_scissor_state *scissor) +rbug_set_scissor_states(struct pipe_context *_pipe, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state *scissor) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; pipe_mutex_lock(rb_pipe->call_mutex); - pipe->set_scissor_state(pipe, - scissor); + pipe->set_scissor_states(pipe, start_slot, num_scissors, scissor); pipe_mutex_unlock(rb_pipe->call_mutex); } static void -rbug_set_viewport_state(struct pipe_context *_pipe, - const struct pipe_viewport_state *viewport) +rbug_set_viewport_states(struct pipe_context *_pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *viewport) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; pipe_mutex_lock(rb_pipe->call_mutex); - pipe->set_viewport_state(pipe, - viewport); + pipe->set_viewport_states(pipe, start_slot, num_viewports, viewport); pipe_mutex_unlock(rb_pipe->call_mutex); } @@ -1171,8 +1173,8 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) rb_pipe->base.set_constant_buffer = rbug_set_constant_buffer; rb_pipe->base.set_framebuffer_state = rbug_set_framebuffer_state; rb_pipe->base.set_polygon_stipple = rbug_set_polygon_stipple; - rb_pipe->base.set_scissor_state = rbug_set_scissor_state; - rb_pipe->base.set_viewport_state = rbug_set_viewport_state; + rb_pipe->base.set_scissor_states = rbug_set_scissor_states; + rb_pipe->base.set_viewport_states = rbug_set_viewport_states; rb_pipe->base.set_fragment_sampler_views = rbug_set_fragment_sampler_views; rb_pipe->base.set_vertex_sampler_views = rbug_set_vertex_sampler_views; rb_pipe->base.set_vertex_buffers = rbug_set_vertex_buffers; diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index fe5de17ff65..16311fa48f8 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -182,6 +182,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TGSI_TEXCOORD: case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER: return 0; + case PIPE_CAP_MAX_VIEWPORTS: + return 1; } /* should only get here on unhandled cases */ debug_printf("Unexpected PIPE_CAP %d query\n", param); diff --git a/src/gallium/drivers/softpipe/sp_state_clip.c b/src/gallium/drivers/softpipe/sp_state_clip.c index f3a4c234e27..cd1a1956ae4 100644 --- a/src/gallium/drivers/softpipe/sp_state_clip.c +++ b/src/gallium/drivers/softpipe/sp_state_clip.c @@ -44,13 +44,16 @@ softpipe_set_clip_state(struct pipe_context *pipe, static void -softpipe_set_viewport_state(struct pipe_context *pipe, - const struct pipe_viewport_state *viewport) +softpipe_set_viewport_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *viewport) { struct softpipe_context *softpipe = softpipe_context(pipe); /* pass the viewport info to the draw module */ - draw_set_viewport_state(softpipe->draw, viewport); + draw_set_viewport_states(softpipe->draw, start_slot, num_viewports, + viewport); softpipe->viewport = *viewport; /* struct copy */ softpipe->dirty |= SP_NEW_VIEWPORT; @@ -58,8 +61,10 @@ softpipe_set_viewport_state(struct pipe_context *pipe, static void -softpipe_set_scissor_state(struct pipe_context *pipe, - const struct pipe_scissor_state *scissor) +softpipe_set_scissor_states(struct pipe_context *pipe, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state *scissor) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -87,7 +92,7 @@ void softpipe_init_clip_funcs(struct pipe_context *pipe) { pipe->set_clip_state = softpipe_set_clip_state; - pipe->set_viewport_state = softpipe_set_viewport_state; - pipe->set_scissor_state = softpipe_set_scissor_state; + pipe->set_viewport_states = softpipe_set_viewport_states; + pipe->set_scissor_states = softpipe_set_scissor_states; pipe->set_polygon_stipple = softpipe_set_polygon_stipple; } diff --git a/src/gallium/drivers/svga/svga_pipe_misc.c b/src/gallium/drivers/svga/svga_pipe_misc.c index 7884b6d236b..f1c007b5594 100644 --- a/src/gallium/drivers/svga/svga_pipe_misc.c +++ b/src/gallium/drivers/svga/svga_pipe_misc.c @@ -31,12 +31,14 @@ #include "svga_surface.h" -static void svga_set_scissor_state( struct pipe_context *pipe, - const struct pipe_scissor_state *scissor ) +static void svga_set_scissor_states( struct pipe_context *pipe, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state *scissors ) { struct svga_context *svga = svga_context(pipe); - memcpy( &svga->curr.scissor, scissor, sizeof(*scissor) ); + memcpy( &svga->curr.scissor, scissors, sizeof(*scissors) ); svga->dirty |= SVGA_NEW_SCISSOR; } @@ -161,12 +163,14 @@ static void svga_set_clip_state( struct pipe_context *pipe, /* Called when driver state tracker notices changes to the viewport * matrix: */ -static void svga_set_viewport_state( struct pipe_context *pipe, - const struct pipe_viewport_state *viewport ) +static void svga_set_viewport_states( struct pipe_context *pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *viewports ) { struct svga_context *svga = svga_context(pipe); - svga->curr.viewport = *viewport; /* struct copy */ + svga->curr.viewport = *viewports; /* struct copy */ svga->dirty |= SVGA_NEW_VIEWPORT; } @@ -175,11 +179,11 @@ static void svga_set_viewport_state( struct pipe_context *pipe, void svga_init_misc_functions( struct svga_context *svga ) { - svga->pipe.set_scissor_state = svga_set_scissor_state; + svga->pipe.set_scissor_states = svga_set_scissor_states; svga->pipe.set_polygon_stipple = svga_set_polygon_stipple; svga->pipe.set_framebuffer_state = svga_set_framebuffer_state; svga->pipe.set_clip_state = svga_set_clip_state; - svga->pipe.set_viewport_state = svga_set_viewport_state; + svga->pipe.set_viewport_states = svga_set_viewport_states; } diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c b/src/gallium/drivers/svga/svga_swtnl_state.c index dea3a26b6f2..d744f18ee72 100644 --- a/src/gallium/drivers/svga/svga_swtnl_state.c +++ b/src/gallium/drivers/svga/svga_swtnl_state.c @@ -80,7 +80,7 @@ static void set_draw_viewport( struct svga_context *svga ) vp.translate[0] += adjx; vp.translate[1] += adjy; - draw_set_viewport_state(svga->swtnl.draw, &vp); + draw_set_viewport_states(svga->swtnl.draw, 0, 1, &vp); } static enum pipe_error diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 962b15e9b2d..ee23077d960 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -765,36 +765,44 @@ trace_context_set_polygon_stipple(struct pipe_context *_pipe, static INLINE void -trace_context_set_scissor_state(struct pipe_context *_pipe, - const struct pipe_scissor_state *state) +trace_context_set_scissor_states(struct pipe_context *_pipe, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state *states) { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; - trace_dump_call_begin("pipe_context", "set_scissor_state"); + trace_dump_call_begin("pipe_context", "set_scissor_states"); trace_dump_arg(ptr, pipe); - trace_dump_arg(scissor_state, state); + trace_dump_arg(uint, start_slot); + trace_dump_arg(uint, num_scissors); + trace_dump_arg(scissor_state, states); - pipe->set_scissor_state(pipe, state); + pipe->set_scissor_states(pipe, start_slot, num_scissors, states); trace_dump_call_end(); } static INLINE void -trace_context_set_viewport_state(struct pipe_context *_pipe, - const struct pipe_viewport_state *state) +trace_context_set_viewport_states(struct pipe_context *_pipe, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *states) { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; - trace_dump_call_begin("pipe_context", "set_viewport_state"); + trace_dump_call_begin("pipe_context", "set_viewport_states"); trace_dump_arg(ptr, pipe); - trace_dump_arg(viewport_state, state); + trace_dump_arg(uint, start_slot); + trace_dump_arg(uint, num_viewports); + trace_dump_arg(viewport_state, states); - pipe->set_viewport_state(pipe, state); + pipe->set_viewport_states(pipe, start_slot, num_viewports, states); trace_dump_call_end(); } @@ -1576,8 +1584,8 @@ trace_context_create(struct trace_screen *tr_scr, TR_CTX_INIT(set_constant_buffer); TR_CTX_INIT(set_framebuffer_state); TR_CTX_INIT(set_polygon_stipple); - TR_CTX_INIT(set_scissor_state); - TR_CTX_INIT(set_viewport_state); + TR_CTX_INIT(set_scissor_states); + TR_CTX_INIT(set_viewport_states); TR_CTX_INIT(set_fragment_sampler_views); TR_CTX_INIT(set_vertex_sampler_views); TR_CTX_INIT(set_geometry_sampler_views); diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index d1130bc5182..0403d3b3d7f 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -211,11 +211,15 @@ struct pipe_context { void (*set_polygon_stipple)( struct pipe_context *, const struct pipe_poly_stipple * ); - void (*set_scissor_state)( struct pipe_context *, - const struct pipe_scissor_state * ); + void (*set_scissor_states)( struct pipe_context *, + unsigned start_slot, + unsigned num_scissors, + const struct pipe_scissor_state * ); - void (*set_viewport_state)( struct pipe_context *, - const struct pipe_viewport_state * ); + void (*set_viewport_states)( struct pipe_context *, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *); void (*set_fragment_sampler_views)(struct pipe_context *, unsigned num_views, diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index bb8696895fb..8af1a846a38 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -507,7 +507,8 @@ enum pipe_cap { PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER = 80, PIPE_CAP_QUERY_PIPELINE_STATISTICS = 81, PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK = 82, - PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE = 83 + PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE = 83, + PIPE_CAP_MAX_VIEWPORTS = 84 }; #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0) diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 50de2d370a1..b33cf1d5213 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -164,7 +164,8 @@ struct tgsi_declaration_interp #define TGSI_SEMANTIC_THREAD_ID 18 /**< block-relative id of the current thread */ #define TGSI_SEMANTIC_TEXCOORD 19 /**< texture or sprite coordinates */ #define TGSI_SEMANTIC_PCOORD 20 /**< point sprite coordinate */ -#define TGSI_SEMANTIC_COUNT 21 /**< number of semantic values */ +#define TGSI_SEMANTIC_VIEWPORT_INDEX 21 /**< viewport index */ +#define TGSI_SEMANTIC_COUNT 22 /**< number of semantic values */ struct tgsi_declaration_semantic { diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 262078d09b3..ff0aac78394 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -65,6 +65,7 @@ extern "C" { #define PIPE_MAX_TEXTURE_LEVELS 16 #define PIPE_MAX_SO_BUFFERS 4 #define PIPE_MAX_SO_OUTPUTS 64 +#define PIPE_MAX_VIEWPORTS 16 struct pipe_reference diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index e59377f692a..685be924bfa 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -150,7 +150,7 @@ static void set_viewport( float x, float y, vp.translate[2] = half_depth + z; vp.translate[3] = 0.0f; - ctx->set_viewport_state( ctx, &vp ); + ctx->set_viewport_states( ctx, 0, 1, &vp ); } static void set_vertices( void ) diff --git a/src/gallium/tests/graw/graw_util.h b/src/gallium/tests/graw/graw_util.h index febdf4499a3..84456b4a6a2 100644 --- a/src/gallium/tests/graw/graw_util.h +++ b/src/gallium/tests/graw/graw_util.h @@ -203,7 +203,7 @@ graw_util_viewport(struct graw_info *info, vp.translate[2] = half_depth + z; vp.translate[3] = 0.0f; - info->ctx->set_viewport_state(info->ctx, &vp); + info->ctx->set_viewport_states(info->ctx, 0, 1, &vp); } diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index 351a772d538..e4e4f61eba1 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -225,7 +225,7 @@ static void set_viewport( float x, float y, vp.translate[2] = half_depth + z; vp.translate[3] = 0.0f; - ctx->set_viewport_state( ctx, &vp ); + ctx->set_viewport_states( ctx, 0, 1, &vp ); } static void set_vertices( void ) diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c index dd2865de366..9100272ffa0 100644 --- a/src/gallium/tests/graw/quad-sample.c +++ b/src/gallium/tests/graw/quad-sample.c @@ -78,7 +78,7 @@ static void set_viewport( float x, float y, vp.translate[2] = half_depth + z; vp.translate[3] = 0.0f; - ctx->set_viewport_state( ctx, &vp ); + ctx->set_viewport_states( ctx, 0, 1, &vp ); } static void set_vertices( void ) diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c index 9c6e0eb9c3b..014e0cc74a3 100644 --- a/src/gallium/tests/graw/shader-leak.c +++ b/src/gallium/tests/graw/shader-leak.c @@ -68,7 +68,7 @@ static void set_viewport( float x, float y, vp.translate[2] = half_depth + z; vp.translate[3] = 0.0f; - ctx->set_viewport_state( ctx, &vp ); + ctx->set_viewport_states( ctx, 0, 1, &vp ); } static void set_vertices( void ) diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c index 03b5234de89..535825ee9eb 100644 --- a/src/gallium/tests/graw/tri-gs.c +++ b/src/gallium/tests/graw/tri-gs.c @@ -69,7 +69,7 @@ static void set_viewport( float x, float y, vp.translate[2] = half_depth + z; vp.translate[3] = 0.0f; - ctx->set_viewport_state( ctx, &vp ); + ctx->set_viewport_states( ctx, 0, 1, &vp ); } static void set_vertices( void ) diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c index 901ac863789..d00e7e9433a 100644 --- a/src/gallium/tests/graw/tri-instanced.c +++ b/src/gallium/tests/graw/tri-instanced.c @@ -98,7 +98,7 @@ static void set_viewport( float x, float y, vp.translate[2] = half_depth + z; vp.translate[3] = 0.0f; - ctx->set_viewport_state( ctx, &vp ); + ctx->set_viewport_states( ctx, 0, 1, &vp ); } diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index 1ab6732bb17..bfb40bea239 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -136,7 +136,7 @@ static void set_viewport( float x, float y, vp.translate[2] = half_depth + z; vp.translate[3] = 0.0f; - ctx->set_viewport_state( ctx, &vp ); + ctx->set_viewport_states( ctx, 0, 1, &vp ); } static void set_vertices( void ) diff --git a/src/mesa/state_tracker/st_atom_scissor.c b/src/mesa/state_tracker/st_atom_scissor.c index eb13877787b..19c2cd2fbb3 100644 --- a/src/mesa/state_tracker/st_atom_scissor.c +++ b/src/mesa/state_tracker/st_atom_scissor.c @@ -86,7 +86,7 @@ update_scissor( struct st_context *st ) if (memcmp(&scissor, &st->state.scissor, sizeof(scissor)) != 0) { /* state has changed */ st->state.scissor = scissor; /* struct copy */ - st->pipe->set_scissor_state(st->pipe, &scissor); /* activate */ + st->pipe->set_scissor_states(st->pipe, 0, 1, &scissor); /* activate */ } } diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index fe66b99d562..b19d913e5d5 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -133,7 +133,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, * code sends state updates to the pipe, not to our private draw module. */ assert(draw); - draw_set_viewport_state(draw, &st->state.viewport); + draw_set_viewport_states(draw, 0, 1, &st->state.viewport); draw_set_clip_state(draw, &st->state.clip); draw_set_rasterizer_state(draw, &st->state.rasterizer, NULL); draw_bind_vertex_shader(draw, st->vp_variant->draw_shader); |