return;
}
- /* Update derived state, pass draw info to update function */
+ /* If indexed draw, force vertex validation since index buffer comes
+ * from draw info. */
+ if (info->index_size)
+ ctx->dirty |= SWR_NEW_VERTEX;
+
+ /* Update derived state, pass draw info to update function. */
swr_update_derived(pipe, info);
swr_update_draw_context(ctx);
ctx->api.pfnSwrSetRastState(ctx->swrContext, rastState);
}
- /* Scissor */
- if (ctx->dirty & SWR_NEW_SCISSOR) {
- ctx->api.pfnSwrSetScissorRects(ctx->swrContext, 1, &ctx->swr_scissor);
- }
-
/* Viewport */
if (ctx->dirty & (SWR_NEW_VIEWPORT | SWR_NEW_FRAMEBUFFER
| SWR_NEW_RASTERIZER)) {
ctx->api.pfnSwrSetViewports(ctx->swrContext, 1, vp, vpm);
}
- /* Set vertex & index buffers
- * (using draw info if called by swr_draw_vbo)
- * If indexed draw, revalidate since index buffer comes from
- * pipe_draw_info.
- */
- if (ctx->dirty & SWR_NEW_VERTEX ||
- (p_draw_info && p_draw_info->index_size)) {
+ /* When called from swr_clear (p_draw_info = null), render targets,
+ * rasterState and viewports (dependent on render targets) are the only
+ * necessary validation. Defer remaining validation by setting
+ * post_update_dirty_flags and clear all dirty flags. BackendState is
+ * still unconditionally validated below */
+ if (!p_draw_info) {
+ post_update_dirty_flags = ctx->dirty & ~(SWR_NEW_FRAMEBUFFER |
+ SWR_NEW_RASTERIZER |
+ SWR_NEW_VIEWPORT);
+ ctx->dirty = 0;
+ }
+
+ /* Scissor */
+ if (ctx->dirty & SWR_NEW_SCISSOR) {
+ ctx->api.pfnSwrSetScissorRects(ctx->swrContext, 1, &ctx->swr_scissor);
+ }
- /* If being called by swr_draw_vbo, copy draw details */
- struct pipe_draw_info info = {0};
- if (p_draw_info)
- info = *p_draw_info;
+ /* Set vertex & index buffers */
+ if (ctx->dirty & SWR_NEW_VERTEX) {
+ const struct pipe_draw_info &info = *p_draw_info;
/* vertex buffers */
SWR_VERTEX_BUFFER_STATE swrVertexBuffers[PIPE_MAX_ATTRIBS];