return NULL;
swr_gs->pipe.tokens = tgsi_dup_tokens(gs->tokens);
-
lp_build_tgsi_info(gs->tokens, &swr_gs->info);
-
return swr_gs;
}
static void
swr_set_scissor_states(struct pipe_context *pipe,
unsigned start_slot,
- unsigned num_viewports,
- const struct pipe_scissor_state *scissor)
+ unsigned num_scissors,
+ const struct pipe_scissor_state *scissors)
{
struct swr_context *ctx = swr_context(pipe);
- ctx->scissor = *scissor;
- ctx->swr_scissor.xmin = scissor->minx;
- ctx->swr_scissor.xmax = scissor->maxx;
- ctx->swr_scissor.ymin = scissor->miny;
- ctx->swr_scissor.ymax = scissor->maxy;
+ memcpy(ctx->scissors + start_slot, scissors,
+ sizeof(struct pipe_scissor_state) * num_scissors);
+
+ for (unsigned i = 0; i < num_scissors; i++) {
+ auto idx = start_slot + i;
+ ctx->swr_scissors[idx].xmin = scissors[idx].minx;
+ ctx->swr_scissors[idx].xmax = scissors[idx].maxx;
+ ctx->swr_scissors[idx].ymin = scissors[idx].miny;
+ ctx->swr_scissors[idx].ymax = scissors[idx].maxy;
+ }
ctx->dirty |= SWR_NEW_SCISSOR;
}
{
struct swr_context *ctx = swr_context(pipe);
- ctx->viewport = *vpt;
+ memcpy(ctx->viewports + start_slot, vpt, sizeof(struct pipe_viewport_state) * num_viewports);
ctx->dirty |= SWR_NEW_VIEWPORT;
}
/* Viewport */
if (ctx->dirty & (SWR_NEW_VIEWPORT | SWR_NEW_FRAMEBUFFER
| SWR_NEW_RASTERIZER)) {
- pipe_viewport_state *state = &ctx->viewport;
+ pipe_viewport_state *state = &ctx->viewports[0];
pipe_framebuffer_state *fb = &ctx->framebuffer;
pipe_rasterizer_state *rasterizer = ctx->rasterizer;
- SWR_VIEWPORT *vp = &ctx->derived.vp;
+ SWR_VIEWPORT *vp = &ctx->derived.vp[0];
SWR_VIEWPORT_MATRICES *vpm = &ctx->derived.vpm;
- vp->x = state->translate[0] - state->scale[0];
- vp->width = 2 * state->scale[0];
- vp->y = state->translate[1] - fabs(state->scale[1]);
- vp->height = 2 * fabs(state->scale[1]);
- util_viewport_zmin_zmax(state, rasterizer->clip_halfz,
- &vp->minZ, &vp->maxZ);
-
- vpm->m00[0] = state->scale[0];
- vpm->m11[0] = state->scale[1];
- vpm->m22[0] = state->scale[2];
- vpm->m30[0] = state->translate[0];
- vpm->m31[0] = state->translate[1];
- vpm->m32[0] = state->translate[2];
-
- /* Now that the matrix is calculated, clip the view coords to screen
- * size. OpenGL allows for -ve x,y in the viewport. */
- if (vp->x < 0.0f) {
- vp->width += vp->x;
- vp->x = 0.0f;
- }
- if (vp->y < 0.0f) {
- vp->height += vp->y;
- vp->y = 0.0f;
- }
- vp->width = std::min(vp->width, (float)fb->width - vp->x);
- vp->height = std::min(vp->height, (float)fb->height - vp->y);
+ for (unsigned i = 0; i < KNOB_NUM_VIEWPORTS_SCISSORS; i++) {
+ vp->x = state->translate[0] - state->scale[0];
+ vp->width = 2 * state->scale[0];
+ vp->y = state->translate[1] - fabs(state->scale[1]);
+ vp->height = 2 * fabs(state->scale[1]);
+ util_viewport_zmin_zmax(state, rasterizer->clip_halfz,
+ &vp->minZ, &vp->maxZ);
+
+ vpm->m00[i] = state->scale[0];
+ vpm->m11[i] = state->scale[1];
+ vpm->m22[i] = state->scale[2];
+ vpm->m30[i] = state->translate[0];
+ vpm->m31[i] = state->translate[1];
+ vpm->m32[i] = state->translate[2];
+
+ /* Now that the matrix is calculated, clip the view coords to screen
+ * size. OpenGL allows for -ve x,y in the viewport. */
+ if (vp->x < 0.0f) {
+ vp->width += vp->x;
+ vp->x = 0.0f;
+ }
+ if (vp->y < 0.0f) {
+ vp->height += vp->y;
+ vp->y = 0.0f;
+ }
+ vp->width = std::min(vp->width, (float) fb->width - vp->x);
+ vp->height = std::min(vp->height, (float) fb->height - vp->y);
- ctx->api.pfnSwrSetViewports(ctx->swrContext, 1, vp, vpm);
+ vp++;
+ state++;
+ }
+ ctx->api.pfnSwrSetViewports(ctx->swrContext, KNOB_NUM_VIEWPORTS_SCISSORS,
+ &ctx->derived.vp[0], &ctx->derived.vpm);
}
/* When called from swr_clear (p_draw_info = null), render targets,
/* Scissor */
if (ctx->dirty & SWR_NEW_SCISSOR) {
- ctx->api.pfnSwrSetScissorRects(ctx->swrContext, 1, &ctx->swr_scissor);
+ ctx->api.pfnSwrSetScissorRects(ctx->swrContext, KNOB_NUM_VIEWPORTS_SCISSORS, ctx->swr_scissors);
}
/* Set vertex & index buffers */