mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
lavapipe: fix indirect memory copies
this was using the wrong size for the copy cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41312>
This commit is contained in:
parent
216c5c6dde
commit
87764963f2
1 changed files with 5 additions and 3 deletions
|
|
@ -2667,16 +2667,18 @@ static void handle_copy_memory_indirect(struct vk_cmd_queue_entry *cmd,
|
|||
{
|
||||
const VkCopyMemoryIndirectInfoKHR *copycmd = cmd->u.copy_memory_indirect_khr.copy_memory_indirect_info;
|
||||
|
||||
uint8_t *base = (uint8_t*)(uintptr_t)copycmd->copyAddressRange.address;
|
||||
for (uint32_t i = 0; i < copycmd->copyCount; i++) {
|
||||
uint8_t *ptr = (void*)(uintptr_t)copycmd->copyAddressRange.address;
|
||||
VkCopyMemoryIndirectCommandKHR *copy = (void*)(ptr + i * copycmd->copyAddressRange.stride);
|
||||
if (i * copycmd->copyAddressRange.stride > copycmd->copyAddressRange.size)
|
||||
break;
|
||||
VkCopyMemoryIndirectCommandKHR *copy = (void*)(base + i * copycmd->copyAddressRange.stride);
|
||||
void *src = (void*)(uintptr_t)copy->srcAddress;
|
||||
void *dst = (void*)(uintptr_t)copy->dstAddress;
|
||||
/* Techincally apps passing in size of zero still need valid pointers,
|
||||
* but in case they don't (which is easy to do) we don't want undefined behavior (or crash) in memcpy.
|
||||
*/
|
||||
if (copy->size != 0)
|
||||
memcpy(dst, src, copycmd->copyAddressRange.size);
|
||||
memcpy(dst, src, copy->size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue