mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
panfrost: clamp buffer-size to max-size
When texture-buffers are created from buffers that are larger than the max-size, the correct thing to do is to clamp the size. Let's do that. This fixes these piglits: - spec/arb_texture_buffer_object/texture-buffer-size-clamp/r8ui_texture_buffer_size_via_sampler - spec/arb_texture_buffer_object/texture-buffer-size-clamp/rg8ui_texture_buffer_size_via_sampler - spec/arb_texture_buffer_object/texture-buffer-size-clamp/rgba8ui_texture_buffer_size_via_sampler Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28908>
This commit is contained in:
parent
19aa0b9473
commit
86cce0e677
1 changed files with 3 additions and 1 deletions
|
|
@ -983,7 +983,8 @@ panfrost_upload_txs_sysval(struct panfrost_batch *batch,
|
||||||
|
|
||||||
if (tex->target == PIPE_BUFFER) {
|
if (tex->target == PIPE_BUFFER) {
|
||||||
assert(dim == 1);
|
assert(dim == 1);
|
||||||
uniform->i[0] = tex->u.buf.size / util_format_get_blocksize(tex->format);
|
unsigned buf_size = tex->u.buf.size / util_format_get_blocksize(tex->format);
|
||||||
|
uniform->i[0] = MIN2(buf_size, PAN_MAX_TEXEL_BUFFER_ELEMENTS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1539,6 +1540,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
|
||||||
unsigned buf_offset = is_buffer ? so->base.u.buf.offset : 0;
|
unsigned buf_offset = is_buffer ? so->base.u.buf.offset : 0;
|
||||||
unsigned buf_size =
|
unsigned buf_size =
|
||||||
(is_buffer ? so->base.u.buf.size : 0) / util_format_get_blocksize(format);
|
(is_buffer ? so->base.u.buf.size : 0) / util_format_get_blocksize(format);
|
||||||
|
buf_size = MIN2(buf_size, PAN_MAX_TEXEL_BUFFER_ELEMENTS);
|
||||||
|
|
||||||
if (so->base.target == PIPE_TEXTURE_3D) {
|
if (so->base.target == PIPE_TEXTURE_3D) {
|
||||||
first_layer /= prsrc->image.layout.depth;
|
first_layer /= prsrc->image.layout.depth;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue