Mesa (main): zink: return current pipeline object if state hasn't changed
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri May 7 02:09:29 UTC 2021
Module: Mesa
Branch: main
Commit: e645f71c68bda2a36391b4c5aef455e3608e46f3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e645f71c68bda2a36391b4c5aef455e3608e46f3
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Tue Jan 19 11:43:03 2021 -0500
zink: return current pipeline object if state hasn't changed
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10508>
---
src/gallium/drivers/zink/zink_pipeline.h | 5 +++++
src/gallium/drivers/zink/zink_program.c | 14 ++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_pipeline.h b/src/gallium/drivers/zink/zink_pipeline.h
index 8105da901a1..c686a6a1175 100644
--- a/src/gallium/drivers/zink/zink_pipeline.h
+++ b/src/gallium/drivers/zink/zink_pipeline.h
@@ -74,6 +74,9 @@ struct zink_gfx_pipeline_state {
uint32_t vertex_buffers_enabled_mask;
uint32_t vertex_strides[PIPE_MAX_ATTRIBS];
bool have_EXT_extended_dynamic_state;
+
+ VkPipeline pipeline;
+ enum pipe_prim_type mode;
};
struct zink_compute_pipeline_state {
@@ -83,6 +86,8 @@ struct zink_compute_pipeline_state {
bool dirty;
bool use_local_size;
uint32_t local_size[3];
+
+ VkPipeline pipeline;
};
VkPipeline
diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c
index b5368edab83..98b3d936ded 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -884,6 +884,9 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
struct zink_gfx_pipeline_state *state,
enum pipe_prim_type mode)
{
+ if (!state->dirty && !state->combined_dirty && !state->vertex_state_dirty && mode == state->mode)
+ return state->pipeline;
+
struct zink_screen *screen = zink_screen(ctx->base.screen);
VkPrimitiveTopology vkmode = primitive_topology(mode);
assert(vkmode <= ARRAY_SIZE(prog->pipelines));
@@ -935,7 +938,10 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
assert(entry);
}
- return ((struct gfx_pipeline_cache_entry *)(entry->data))->pipeline;
+ struct gfx_pipeline_cache_entry *cache_entry = entry->data;
+ state->pipeline = cache_entry->pipeline;
+ state->mode = mode;
+ return state->pipeline;
}
VkPipeline
@@ -945,6 +951,8 @@ zink_get_compute_pipeline(struct zink_screen *screen,
{
struct hash_entry *entry = NULL;
+ if (!state->dirty)
+ return state->pipeline;
if (state->dirty) {
state->hash = hash_compute_pipeline_state(state);
state->dirty = false;
@@ -968,7 +976,9 @@ zink_get_compute_pipeline(struct zink_screen *screen,
assert(entry);
}
- return ((struct compute_pipeline_cache_entry *)(entry->data))->pipeline;
+ struct compute_pipeline_cache_entry *cache_entry = entry->data;
+ state->pipeline = cache_entry->pipeline;
+ return state->pipeline;
}
More information about the mesa-commit
mailing list