Mesa (master): zink: move viewport count to zink_gfx_pipeline_state
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Sep 24 20:54:08 UTC 2020
Module: Mesa
Branch: master
Commit: 09be30b9e4c1d9246fb2084b6f30feed35f80c62
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=09be30b9e4c1d9246fb2084b6f30feed35f80c62
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Mon Aug 3 11:47:17 2020 -0400
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 at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6349>
---
src/gallium/drivers/zink/zink_context.c | 4 +++-
src/gallium/drivers/zink/zink_context.h | 2 --
src/gallium/drivers/zink/zink_draw.c | 4 ++--
src/gallium/drivers/zink/zink_pipeline.h | 2 ++
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 6ef4e8fb23e..a0eaddf9e2e 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -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
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index a9c3b718cee..314aa5f90e3 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -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;
diff --git a/src/gallium/drivers/zink/zink_draw.c b/src/gallium/drivers/zink/zink_draw.c
index b103d089df3..50db38f9b46 100644
--- a/src/gallium/drivers/zink/zink_draw.c
+++ b/src/gallium/drivers/zink/zink_draw.c
@@ -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;
diff --git a/src/gallium/drivers/zink/zink_pipeline.h b/src/gallium/drivers/zink/zink_pipeline.h
index 25c9db3ed66..4b14f00e594 100644
--- a/src/gallium/drivers/zink/zink_pipeline.h
+++ b/src/gallium/drivers/zink/zink_pipeline.h
@@ -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.
More information about the mesa-commit
mailing list