zink: move viewport count to zink_gfx_pipeline_state

this is part of the pipeline state (there's an extension for setting it
dynamically but we don't supprot that atm

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6349>
This commit is contained in:
Mike Blumenkrantz 2020-08-03 11:47:17 -04:00 committed by Marge Bot
parent 818bd61099
commit 09be30b9e4
4 changed files with 7 additions and 5 deletions

View File

@ -348,7 +348,9 @@ zink_set_viewport_states(struct pipe_context *pctx,
ctx->viewport_states[start_slot + i] = state[i];
ctx->viewports[start_slot + i] = viewport;
}
ctx->num_viewports = start_slot + num_viewports;
if (ctx->gfx_pipeline_state.num_viewports != start_slot + num_viewports)
ctx->gfx_pipeline_state.hash = 0;
ctx->gfx_pipeline_state.num_viewports = start_slot + num_viewports;
}
static void

View File

@ -107,8 +107,6 @@ struct zink_context {
struct pipe_scissor_state scissor_states[PIPE_MAX_VIEWPORTS];
VkViewport viewports[PIPE_MAX_VIEWPORTS];
VkRect2D scissors[PIPE_MAX_VIEWPORTS];
unsigned num_viewports;
struct pipe_vertex_buffer buffers[PIPE_MAX_ATTRIBS];
uint32_t buffers_enabled_mask;

View File

@ -393,9 +393,9 @@ zink_draw_vbo(struct pipe_context *pctx,
}
}
vkCmdSetViewport(batch->cmdbuf, 0, ctx->num_viewports, ctx->viewports);
vkCmdSetViewport(batch->cmdbuf, 0, ctx->gfx_pipeline_state.num_viewports, ctx->viewports);
if (ctx->rast_state->base.scissor)
vkCmdSetScissor(batch->cmdbuf, 0, ctx->num_viewports, ctx->scissors);
vkCmdSetScissor(batch->cmdbuf, 0, ctx->gfx_pipeline_state.num_viewports, ctx->scissors);
else if (ctx->fb_state.width && ctx->fb_state.height) {
VkRect2D fb_scissor = {};
fb_scissor.extent.width = ctx->fb_state.width;

View File

@ -54,6 +54,8 @@ struct zink_gfx_pipeline_state {
VkSampleMask sample_mask;
uint8_t rast_samples;
unsigned num_viewports;
bool primitive_restart;
/* Pre-hashed value for table lookup, invalid when zero.