zink: clamp out partial texels when creating bufferviews

this is an illegal alignment, so clamp the range to the nearest
texel offset since the shader should be hitting the robustness
case for the partial texel

affects:
dEQP-GLES31.functional.texture.texture_buffer.modify.mapbuffer_readwrite.range_size_65537

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15827>
This commit is contained in:
Mike Blumenkrantz 2022-04-08 13:24:32 -04:00 committed by Marge Bot
parent b3ee943050
commit ac8337041c

View file

@ -701,7 +701,14 @@ 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;
unsigned blocksize = util_format_get_blocksize(format);
if (bvci.range != VK_WHOLE_SIZE) {
/* clamp out partial texels */
bvci.range -= bvci.range % blocksize;
if (bvci.offset + bvci.range >= res->base.b.width0)
bvci.range = VK_WHOLE_SIZE;
}
uint32_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;