zink: avoid overflow when clamping bufferviews

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18784>
(cherry picked from commit 084f3b6664)
This commit is contained in:
Mike Blumenkrantz
2022-09-07 13:21:28 -04:00
committed by Dylan Baker
parent 01edc6f174
commit 883c0f7b2f
2 changed files with 2 additions and 2 deletions

View File

@@ -571,7 +571,7 @@
"description": "zink: avoid overflow when clamping bufferviews",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View File

@@ -800,7 +800,7 @@ create_bvci(struct zink_context *ctx, struct zink_resource *res, enum pipe_forma
if (bvci.offset + bvci.range >= res->base.b.width0)
bvci.range = VK_WHOLE_SIZE;
}
uint32_t clamp = blocksize * screen->info.props.limits.maxTexelBufferElements;
uint64_t clamp = blocksize * screen->info.props.limits.maxTexelBufferElements;
if (bvci.range == VK_WHOLE_SIZE && res->base.b.width0 > clamp)
bvci.range = clamp;
bvci.flags = 0;