gallium: Add support for multiple viewports
authorZack Rusin <zackr@vmware.com>
Fri, 24 May 2013 20:08:39 +0000 (16:08 -0400)
committerZack Rusin <zackr@vmware.com>
Sat, 25 May 2013 13:49:20 +0000 (09:49 -0400)
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:
src/gallium/auxiliary/cso_cache/cso_context.c
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_context.h
src/gallium/auxiliary/tgsi/tgsi_scan.c
src/gallium/auxiliary/tgsi/tgsi_scan.h
src/gallium/auxiliary/tgsi/tgsi_strings.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_idct.c
src/gallium/auxiliary/vl/vl_matrix_filter.c
src/gallium/auxiliary/vl/vl_mc.c
src/gallium/auxiliary/vl/vl_median_filter.c
src/gallium/auxiliary/vl/vl_zscan.c
src/gallium/docs/source/context.rst
src/gallium/drivers/freedreno/freedreno_state.c
src/gallium/drivers/galahad/glhd_context.c
src/gallium/drivers/i915/i915_state.c
src/gallium/drivers/identity/id_context.c
src/gallium/drivers/ilo/ilo_state.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/llvmpipe/lp_state_clip.c
src/gallium/drivers/noop/noop_state.c
src/gallium/drivers/nv30/nv30_draw.c
src/gallium/drivers/nv30/nv30_state.c
src/gallium/drivers/nv50/nv50_state.c
src/gallium/drivers/nvc0/nvc0_state.c
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/rbug/rbug_context.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/softpipe/sp_state_clip.c
src/gallium/drivers/svga/svga_pipe_misc.c
src/gallium/drivers/svga/svga_swtnl_state.c
src/gallium/drivers/trace/tr_context.c
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_shader_tokens.h
src/gallium/include/pipe/p_state.h
src/gallium/tests/graw/fs-test.c
src/gallium/tests/graw/graw_util.h
src/gallium/tests/graw/gs-test.c
src/gallium/tests/graw/quad-sample.c
src/gallium/tests/graw/shader-leak.c
src/gallium/tests/graw/tri-gs.c
src/gallium/tests/graw/tri-instanced.c
src/gallium/tests/graw/vs-test.c
src/mesa/state_tracker/st_atom_scissor.c
src/mesa/state_tracker/st_draw_feedback.c

index e46f2abf6328c476b58f50a5ce99076202a9c929..b06a070ad83f83df5b88ba50ba151fabe5e92595 100644 (file)
@@ -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);
    }
 }
 
index 78190388ef19e5f994987f6f5d326f72de400bdd..b555c65e858627cbf268300d4a13dde816633c71 100644 (file)
@@ -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 &&
index 47bad0d73d4ffde3520d47810e68e7900a0858e7..2d843b7a0479166e40e364c2d19ac3f1bc8551ac 100644 (file)
@@ -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 );
index bd79405a8aaf00e738ba8bcffb4ae6fc24ee6089..0230267a5dedcc5a608dfc91cd3a42e57fe29e32 100644 (file)
@@ -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;
+                  }
                }
 
              }
index 9debc341f5242155a78d93786f475e50c42fbf1b..676abf0c9a91b11975be625cfad0186c2315caf3 100644 (file)
@@ -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;
    /**
index 95a5aded819334b93491a53d21918e223bbe912f..6abf9272a26b7bc6d6b9503e921df70b113baba6 100644 (file)
@@ -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] =
index 2acc5afc2b8c6b7ae13c3b160ba14a5a3d86143b..8c871fdf9129ebdb87ddd54a678593fbac2276cb 100644 (file)
@@ -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);
index 62f593a3203f94edb37018b306f8434f668c690a..4b8308796ebe537e4c5f6e36ada81acd6a159edd 100644 (file)
@@ -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);
index bd73dfd40f735406d9aedf2ff5fe1dba3e406d4b..5346cbc0ed76a5aa30db2578d392d7af1dedfffd 100644 (file)
@@ -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);
index cda90ff10eb807dd3268bb270fb9d384b8bf33db..9bd7ed150199cf28fe9faf9c1956ef26e218a9df 100644 (file)
@@ -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);
 
index b42720936552849a82762f06ebcd0e3e1dd0a788..1fd40c37d16cdb5c1d937491d66a93155568beaa 100644 (file)
@@ -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
index 2db147904b807703400d4b213a13c75a3c370652..158751a22b3190a9f21fae7a957e97e62a7f880e 100644 (file)
@@ -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);
 
index 262fb0dc491e2604803cd37c53e07473189cc3e8..33baa3d99020b5b420a151ca4ede4fdf8be8c759 100644 (file)
@@ -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);
index 2cc1848be6a0fdf23e0835cbbd25a79afd57bac4..679772fae817017908313ad6261ad44820d9550f 100644 (file)
@@ -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
index ce9a522c6ab4e123259ba24a481bea7613887e2e..9f4e4f83ade6e00d80841f7bd4dc629cfa5d4533 100644 (file)
@@ -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;
index a73a3ad44c0bba3908ea6ee7f78ee45f83482dc5..7e8af565c138fd32b960b6e08375999931b886a5 100644 (file)
@@ -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);
index 4a4faa5298c082630d5877a43c3bee8c819b8ce5..06d4d3bd1aff7551841889282654d29757c9ef99 100644 (file)
@@ -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;
 }
index 0eff6c926c229a72b3dfaf0fc05c96723929318e..6b342ebd1466873f194de952494801d44f4d5bbb 100644 (file)
@@ -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;
index 8443a2cc9d2730a540c4f3940f714fc4b021def3..33da429bf374ff35e6f1456dc194bd2559f5e2e1 100644 (file)
@@ -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;
index 073d7519184d47180634ff7314d200946a6f141f..35630b95249f11ef379e2d33449acc54b7b7330b 100644 (file)
@@ -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);
index 32ae079cc153eb302f8e97e20be53b4b61411b4c..a26c79f72f61f58d63e5c1cd027bb48625ae3e6f 100644 (file)
@@ -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;
 }
index f56ff597c6c242949b23e1eb42028dc29895763f..29eeda87339c314c91fd3129c5c11c179069d26c 100644 (file)
@@ -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;
index e0a1628eb91776fdee5cb1f4e31a2b7dbb8cc3e2..85b4fcd877b8a43d940f3ff1425635c7c7dcdd04 100644 (file)
@@ -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)
index 2a80974d126474a1b105d2f74500d9bd406a2b1e..55f2b8c0a776be286385d817c54a78560be08c4b 100644 (file)
@@ -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;
index ffabf4cff5688acd18b8e6c550c0c704ef0207ae..2454a3dc98a1e3897ccdf22613d4165b8cfee3b2 100644 (file)
@@ -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;
index 9adc99cf014afe186f5784a2207c87145c651b8f..2f40369310a09e93e999ceebaa9a75678de1e982 100644 (file)
@@ -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;
index ba1859bf8b51b0579979b4e1a48a4d00a999b1ba..7647f9e2aa040e10e83e4d78aaa2bc3bcad91736 100644 (file)
@@ -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. */
index 36d510dc45e197a6973be2d7f250cfee1eb97a24..6cfc192900ac94b537a2536c931c2c18077f588f 100644 (file)
@@ -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;
index f49c59521041835e82bca1be965b9a11b2398281..3ebb157b530fdd4c75d7805a0702697494b6ce18 100644 (file)
@@ -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;
index f0e36753d2b6f090165f41baf2ac8fb2d695a29c..068d87126e591a7ea1e3366741b6e6adac32dd80 100644 (file)
@@ -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;
 }
index fbac57688be6b1f1d10b4f6c9f43a4667e2bd110..4995c81cc4637c8eaed8fe8e494e79142f367566 100644 (file)
@@ -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;
index 4556be699cb6100291ade0711634b193afac06b8..82c16411acd9509eca6beee1541863df454b2b9a 100644 (file)
@@ -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;
index bf939b9b6780091221e37e86c86f684d630c7354..721419750bb3236f2b43775c8a3ec53f61a17ebe 100644 (file)
@@ -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;
index fe5de17ff6599eaffb94019c937f60abe31ee052..16311fa48f8a4bd6704ac487dc118da2ce023919 100644 (file)
@@ -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);
index f3a4c234e27c0edc92b725854f2532cff7566590..cd1a1956ae411003528fde1c9a4411394a548a03 100644 (file)
@@ -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;
 }
index 7884b6d236b6aba69c019a96332e3c29f0fb5229..f1c007b55949d6cb259de99912f074a6873c3df1 100644 (file)
 #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;
 }
 
 
index dea3a26b6f2c0eb837940b7cd1411f9d4178c4aa..d744f18ee72fc3845a423ea49710448314a54047 100644 (file)
@@ -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
index 962b15e9b2d00dff1de6862a5bfdf6bb8c01753d..ee23077d960fd1fb18136226118c76bab69f1cfd 100644 (file)
@@ -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);
index d1130bc5182f120ca4c0cc8a42dde351f2137d4f..0403d3b3d7fd63c29d1244f07a7b5fe71aca8b50 100644 (file)
@@ -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,
index bb8696895fb2921d15de3bb239dd54d11da89f7e..8af1a846a38b986a14eefe0f8260608f39a4b6d4 100644 (file)
@@ -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)
index 50de2d370a12f404c7fd66fa22dcb1ad6d9982fc..b33cf1d5213d9aff3d9846473e3c4453a8793b32 100644 (file)
@@ -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
 {
index 262078d09b348b33e69c03907ca8fb1cd809ec79..ff0aac78394294233790edebea8ac69260b5dd65 100644 (file)
@@ -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
index e59377f692a5654fcbf7a9aa14d34e5e05560731..685be924bfae43fd826378f35f58462b01fa4882 100644 (file)
@@ -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 )
index febdf4499a3c1dda9f89216765f34b2f9360c4ac..84456b4a6a2a7f0a4fc3b7bab99f409e425330a5 100644 (file)
@@ -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);
 }
 
 
index 351a772d538de5f2b2e8ea89d4e562a53abe3387..e4e4f61eba1af29625f0b812bc63295301fbf193 100644 (file)
@@ -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 )
index dd2865de3661027447341727ae3bd681ea2bb5b1..9100272ffa0a0c65e06415ef35758fe6c7d64a6e 100644 (file)
@@ -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 )
index 9c6e0eb9c3b7ecdd9737056d9f678edb4f271329..014e0cc74a36dca45faf658713e3de20ed90306f 100644 (file)
@@ -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 )
index 03b5234de899093d45ab2d067c323cc49b522a95..535825ee9eb3ac715b9d4d4f242b6ea4c5cd236f 100644 (file)
@@ -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 )
index 901ac8637893b06d7c14cb7d9145c5b28b3d9d38..d00e7e9433a6c7900ced424cbd13cb13240df278 100644 (file)
@@ -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 );
 }
 
 
index 1ab6732bb1796df090b460f7325830e58a53cc67..bfb40bea2396d5deb285209fac2d272dc80d7874 100644 (file)
@@ -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 )
index eb13877787b7df717c517ddfebb18804b87452f1..19c2cd2fbb39efb9258e7c1988d89fc2bb1b8a51 100644 (file)
@@ -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 */
    }
 }
 
index fe66b99d562b3b994ace3bc384408a9314a64a70..b19d913e5d567f1c18b86f2584ae479ce6026db0 100644 (file)
@@ -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);