mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
asahi: Do not overread user index buffers
We need to align the extent to 4 for the GPU, but we can't copy more than the original size out of the user buffer. Always alloc the exact size we need. This does mean the GPU gets an IB extent that could include some other stuff later in the pool, if not aligned. This is probably safe? Given the base alignment, it should never cross a page boundary and fault or anything like that. Signed-off-by: Asahi Lina <lina@asahilina.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21686>
This commit is contained in:
parent
1fecb26634
commit
1313787c12
1 changed files with 3 additions and 2 deletions
|
|
@ -2389,8 +2389,9 @@ agx_index_buffer_direct_ptr(struct agx_batch *batch,
|
|||
} else {
|
||||
*extent = ALIGN_POT(draw->count * info->index_size, 4);
|
||||
|
||||
return agx_pool_upload_aligned(
|
||||
&batch->pool, ((uint8_t *)info->index.user) + offset, *extent, 64);
|
||||
return agx_pool_upload_aligned(&batch->pool,
|
||||
((uint8_t *)info->index.user) + offset,
|
||||
draw->count * info->index_size, 64);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue