upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 06:08:07 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 06:08:07 -0500
commitce29a787c2ebf98326f2052f03d48befaa856b21 (patch)
tree5e60c5600a68b27f4a29360914979b5b2f386ac4 /runtime/src
parent8689c28c81447bc369ea2ff88f47125a2a46242d (diff)
parentb8bd9f20a063fac0bc3c732a718d5a7a7277a606 (diff)
Merge pull request #1378 from Emirhan Karaca
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/vulkan_replay.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/runtime/src/vulkan_replay.h b/runtime/src/vulkan_replay.h
index 436eb4e93..5fd1c8fff 100644
--- a/runtime/src/vulkan_replay.h
+++ b/runtime/src/vulkan_replay.h
@@ -1196,8 +1196,11 @@ inline ReplayResult prepare_texture_copy(const CopyTexture& copy, Prepared& p) {
1196 depth - 1 > (buffer.size - offset) / slice_pitch || 1196 depth - 1 > (buffer.size - offset) / slice_pitch ||
1197 !within(offset + (depth - 1) * slice_pitch, (rows - 1) * placed.row_pitch + row_bytes, buffer.size)) 1197 !within(offset + (depth - 1) * slice_pitch, (rows - 1) * placed.row_pitch + row_bytes, buffer.size))
1198 return ReplayResult::invalid_copy; 1198 return ReplayResult::invalid_copy;
1199 if (buffer.size > UINT64_MAX - buffer.buffer_offset) return ReplayResult::invalid_copy;
1200 const VkDeviceSize backing_offset = buffer.buffer_offset + offset;
1201 if (backing_offset % alignment) return ReplayResult::unsupported;
1199 VkBufferImageCopy region{}; 1202 VkBufferImageCopy region{};
1200 region.bufferOffset = offset; 1203 region.bufferOffset = backing_offset;
1201 region.bufferRowLength = placed.row_pitch / format.bytes * format.block; 1204 region.bufferRowLength = placed.row_pitch / format.bytes * format.block;
1202 region.bufferImageHeight = depth > 1 ? std::uint32_t(slice_rows * format.block) : 0; 1205 region.bufferImageHeight = depth > 1 ? std::uint32_t(slice_rows * format.block) : 0;
1203 region.imageSubresource = {range.aspectMask, range.baseMipLevel, range.baseArrayLayer, 1}; 1206 region.imageSubresource = {range.aspectMask, range.baseMipLevel, range.baseArrayLayer, 1};
@@ -1218,8 +1221,15 @@ inline ReplayResult prepare_texture_copy(const CopyTexture& copy, Prepared& p) {
1218// CopyResource: the whole buffer, or every subresource of two textures of the same shape. 1221// CopyResource: the whole buffer, or every subresource of two textures of the same shape.
1219inline ReplayResult prepare_resource_copy(Prepared& p) { 1222inline ReplayResult prepare_resource_copy(Prepared& p) {
1220 if (p.binding.buffer && p.source.buffer) { 1223 if (p.binding.buffer && p.source.buffer) {
1221 if (p.binding.size != p.source.size) return ReplayResult::invalid_copy; 1224 if (p.binding.size != p.source.size || !p.source.size) return ReplayResult::invalid_copy;
1222 p.buffer_copies.push_back({0, 0, p.source.size}); 1225 if (p.source.size > UINT64_MAX - p.source.buffer_offset ||
1226 p.binding.size > UINT64_MAX - p.binding.buffer_offset)
1227 return ReplayResult::invalid_copy;
1228 const VkDeviceSize src = p.source.buffer_offset;
1229 const VkDeviceSize dst = p.binding.buffer_offset;
1230 if (p.source.buffer == p.binding.buffer && src < dst + p.source.size && dst < src + p.source.size)
1231 return ReplayResult::invalid_copy;
1232 p.buffer_copies.push_back({src, dst, p.source.size});
1223 return ReplayResult::success; 1233 return ReplayResult::success;
1224 } 1234 }
1225 const ResourceBinding &dst = p.binding, &src = p.source; 1235 const ResourceBinding &dst = p.binding, &src = p.source;
@@ -1669,7 +1679,7 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun
1669 job.to_float = upload; 1679 job.to_float = upload;
1670 job.app = buffer.buffer; 1680 job.app = buffer.buffer;
1671 job.app_offset = region.bufferOffset; 1681 job.app_offset = region.bufferOffset;
1672 job.app_size = buffer.size; 1682 job.app_size = buffer.buffer_offset + buffer.size;
1673 job.width = region.imageExtent.width; 1683 job.width = region.imageExtent.width;
1674 job.height = region.imageExtent.height; 1684 job.height = region.imageExtent.height;
1675 job.slices = region.imageExtent.depth; 1685 job.slices = region.imageExtent.depth;