mirror of https://github.com/bjornbytes/lovr.git
Validate that intra-buffer copy has non-overlapping ranges;
(cherry picked from commit 06bfbbaa6b
)
This commit is contained in:
parent
561b20699a
commit
b09d612e6b
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue