From ac8337041cb37b97e2d18677af7cddfcfe962213 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 8 Apr 2022 13:24:32 -0400 Subject: [PATCH] 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 Part-of: --- src/gallium/drivers/zink/zink_context.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 987f9bbb855..363096f1c30 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -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;