Mesa (staging/21.3): zink: clamp tbo creation to maxTexelBufferElements
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Feb 2 21:21:47 UTC 2022
Module: Mesa
Branch: staging/21.3
Commit: 956f8de5145d9e8acb384b65a68c43cb09eac1b8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=956f8de5145d9e8acb384b65a68c43cb09eac1b8
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Tue Jan 18 13:06:55 2022 -0500
zink: clamp tbo creation to maxTexelBufferElements
for sparse buffers, the total buffer size will be huge, so this needs
to only be the limit that the driver can support to avoid crashing
or whatever
cc: mesa-stable
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14692>
(cherry picked from commit 27d405dc2fddb5b814476a4e055358fd1efa7a4d)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/zink_context.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/.pick_status.json b/.pick_status.json
index e831bd32b72..68e4074d1a3 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1660,7 +1660,7 @@
"description": "zink: clamp tbo creation to maxTexelBufferElements",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index ad6a4f8f6a6..9bb924f1a5d 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -643,6 +643,9 @@ create_bvci(struct zink_context *ctx, struct zink_resource *res, enum pipe_forma
assert(bvci.format);
bvci.offset = offset;
bvci.range = !offset && range == res->base.b.width0 ? VK_WHOLE_SIZE : range;
+ uint32_t clamp = util_format_get_blocksize(format) * screen->info.props.limits.maxTexelBufferElements;
+ if (bvci.range == VK_WHOLE_SIZE && res->base.b.width0 > clamp)
+ bvci.range = clamp;
bvci.flags = 0;
return bvci;
}
More information about the mesa-commit
mailing list