Mesa (main): zink: only update inlinable constants when they change
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 27 20:33:33 UTC 2021
Module: Mesa
Branch: main
Commit: 1454955e5d5130bc0bba4e2d5ef41ceb71346729
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1454955e5d5130bc0bba4e2d5ef41ceb71346729
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri Jul 30 13:14:20 2021 -0400
zink: only update inlinable constants when they change
Reviewed-by: Hoe Hao Cheng <haochengho12907 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12577>
---
src/gallium/drivers/zink/zink_context.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 7e217781862..a13d69c34f1 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -992,10 +992,14 @@ zink_set_inlinable_constants(struct pipe_context *pctx,
uint num_values, uint32_t *values)
{
struct zink_context *ctx = (struct zink_context *)pctx;
+ const uint32_t bit = BITFIELD_BIT(shader);
- memcpy(ctx->inlinable_uniforms[shader], values, num_values * 4);
- ctx->dirty_shader_stages |= 1 << shader;
- ctx->inlinable_uniforms_valid_mask |= 1 << shader;
+ if (!(ctx->inlinable_uniforms_valid_mask & bit) ||
+ memcmp(ctx->inlinable_uniforms[shader], values, num_values * 4)) {
+ memcpy(ctx->inlinable_uniforms[shader], values, num_values * 4);
+ ctx->dirty_shader_stages |= bit;
+ ctx->inlinable_uniforms_valid_mask |= bit;
+ }
}
ALWAYS_INLINE static void
More information about the mesa-commit
mailing list