{
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);
}
}
{
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);
}
}
/**
* 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 &&
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 );
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;
+ }
}
}
boolean origin_lower_left;
boolean pixel_center_integer;
boolean color0_writes_all_cbufs;
+ boolean writes_viewport_index;
unsigned num_written_clipdistance;
/**
"BLOCK_SIZE",
"THREAD_ID",
"TEXCOORD",
- "PCOORD"
+ "PCOORD",
+ "VIEWPORT_INDEX"
};
const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
/* 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)
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,
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);
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);
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);
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);
/* 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);
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);
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
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);
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);
* ``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
}
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);
}
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);
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;
}
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
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);
}
-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);
/* 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);
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;
}
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;
}
}
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
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;
}
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);
}
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);
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;
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);
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;
}
{
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;
}
{
}
-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)
{
}
{
}
-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)
{
}
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;
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)
}
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);
}
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);
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;
}
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);
}
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);
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;
}
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);
}
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);
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;
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. */
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);
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 =
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;
}
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;
*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;
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;
}
}
-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;
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;
}
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;
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.
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;
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);
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);
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;
}
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);
}
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;
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);
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;
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);
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;
}
#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;
}
/* 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;
}
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;
}
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
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();
}
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);
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,
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)
#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
{
#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
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 )
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);
}
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 )
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 )
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 )
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 )
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 );
}
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 )
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 */
}
}
* 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);