Validate that intra-buffer copy has non-overlapping ranges;

(cherry picked from commit 06bfbbaa6b)
This commit is contained in:
bjorn 2024-01-29 21:28:00 -08:00
parent 561b20699a
commit b09d612e6b
1 changed files with 1 additions and 0 deletions

View File

@ -1978,6 +1978,7 @@ void lovrBufferCopy(Buffer* src, Buffer* dst, uint32_t srcOffset, uint32_t dstOf
lovrCheck(!lovrBufferIsTemporary(dst), "Temporary buffers can not have another Buffer copied to them");
lovrCheck(srcOffset + extent <= src->info.size, "Buffer copy range goes past the end of the source Buffer");
lovrCheck(dstOffset + extent <= dst->info.size, "Buffer copy range goes past the end of the destination Buffer");
lovrCheck(src != dst || (srcOffset >= dstOffset + extent || dstOffset >= srcOffset + extent), "Copying part of a Buffer to itself requires non-overlapping copy regions");
gpu_barrier barriers[2];
barriers[0] = syncTransfer(&src->sync, GPU_CACHE_TRANSFER_READ);
barriers[1] = syncTransfer(&dst->sync, GPU_CACHE_TRANSFER_WRITE);