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:
authoraslan2142 <jan.trencansky@protonmail.com>2026-11-25 15:49:35 +0100
committerGitHub <noreply@github.com>2026-11-25 15:49:35 +0100
commit3d4f661238f72fbc2133cf80649be1b258c2db91 (patch)
tree8550c90cc687b3d402ce96019db99cb3927752fb /runtime/src
parent446574e7610921947112069f3b3d36f40a20230b (diff)
parent45219a640014635a633a9b1afaea78a9495f5424 (diff)
Merge pull request #1192 from GGandCo/fix/host-import-prefix
d3d12: preserve offsets in sub-page host buffer imports (RT-HOST-IMPORT-PREFIX)
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/vulkan_replay.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/runtime/src/vulkan_replay.h b/runtime/src/vulkan_replay.h
index e20a29105..725cd3487 100644
--- a/runtime/src/vulkan_replay.h
+++ b/runtime/src/vulkan_replay.h
@@ -2192,7 +2192,9 @@ inline ReplayResult prepare_texture_copy(const CopyTexture& copy, Prepared& p) {
2192 return ReplayResult::invalid_copy; 2192 return ReplayResult::invalid_copy;
2193 if (buffer.size > UINT64_MAX - buffer.buffer_offset) return ReplayResult::invalid_copy; 2193 if (buffer.size > UINT64_MAX - buffer.buffer_offset) return ReplayResult::invalid_copy;
2194 const VkDeviceSize backing_offset = buffer.buffer_offset + offset; 2194 const VkDeviceSize backing_offset = buffer.buffer_offset + offset;
2195 if (backing_offset % alignment && !copy.tile_footprint) return unsupported_at(__LINE__); 2195 // A host-import prefix may be word aligned without being texel aligned (e.g. +4 for RGBA16).
2196 // The replay stages those copies through aligned scratch; VkBufferCopy still needs word alignment.
2197 if (backing_offset % alignment && backing_offset % 4 && !copy.tile_footprint) return unsupported_at(__LINE__);
2196 VkBufferImageCopy region{}; 2198 VkBufferImageCopy region{};
2197 region.bufferOffset = backing_offset; 2199 region.bufferOffset = backing_offset;
2198 region.bufferRowLength = placed.row_pitch / format.bytes * format.block; 2200 region.bufferRowLength = placed.row_pitch / format.bytes * format.block;
@@ -2212,13 +2214,13 @@ inline ReplayResult prepare_texture_copy(const CopyTexture& copy, Prepared& p) {
2212 return ReplayResult::success; 2214 return ReplayResult::success;
2213} 2215}
2214 2216
2215// CopyTiles accepts arbitrary byte offsets into its linear buffer, while VkBufferImageCopy requires texel/block 2217// CopyTiles byte offsets and word-aligned imported host prefixes may violate VkBufferImageCopy texel/block
2216// alignment (VUID-vkCmdCopyBufferToImage-dstImage-07975). Stage only the occupied texels/blocks through aligned 2218// alignment (VUID-vkCmdCopyBufferToImage-dstImage-07975). Stage only the occupied texels/blocks through aligned
2217// transfer scratch; leave partial-tile padding alone. 2219// transfer scratch; leave partial-tile padding alone.
2218inline bool stage_unaligned_tile(const ReplayFunctions& vk, Prepared& p, const ResourceBinding& image, 2220inline bool stage_unaligned_tile(const ReplayFunctions& vk, Prepared& p, const ResourceBinding& image,
2219 const BlockFormat& fmt, bool upload) { 2221 const BlockFormat& fmt, bool upload) {
2220 auto& region = p.buffer_image_copies.front(); 2222 auto& region = p.buffer_image_copies.front();
2221 if (!fmt.bytes || !fmt.block || image.rgb96 || 2223 if (!vk.copy_buffer || !fmt.bytes || !fmt.block || image.rgb96 ||
2222 (image.depth24_as_float && region.imageSubresource.aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT)) 2224 (image.depth24_as_float && region.imageSubresource.aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT))
2223 return false; 2225 return false;
2224 const VkDeviceSize blocks_w = (VkDeviceSize(region.imageExtent.width) + fmt.block - 1) / fmt.block; 2226 const VkDeviceSize blocks_w = (VkDeviceSize(region.imageExtent.width) + fmt.block - 1) / fmt.block;
@@ -3067,8 +3069,8 @@ inline void plan_statistics_segments(PreparedList& out) {
3067} 3069}
3068 3070
3069// Overlapping pipeline-statistics queries (D3D-252): the same physical-segment layout the occlusion planner 3071// Overlapping pipeline-statistics queries (D3D-252): the same physical-segment layout the occlusion planner
3070// builds, in the statistics pool. Each Begin and End of a statistics query â€� and every non-timestamp resolve 3072// builds, in the statistics pool. Each Begin and End of a statistics query — and every non-timestamp resolve
3071// while one runs, because its helper dispatch would be counted â€� closes the one open physical query and opens 3073// while one runs, because its helper dispatch would be counted — closes the one open physical query and opens
3072// a new one, so each logical query keeps a contiguous slot range and its result is the sum of that range 3074// a new one, so each logical query keeps a contiguous slot range and its result is the sum of that range
3073// (statistics_sum.comp). A Begin or End of another query kind leaves the segments alone. 3075// (statistics_sum.comp). A Begin or End of another query kind leaves the segments alone.
3074inline ReplayResult plan_overlapping_statistics_segments(PreparedList& out) { 3076inline ReplayResult plan_overlapping_statistics_segments(PreparedList& out) {
@@ -3562,7 +3564,7 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun
3562 static_cast<unsigned long long>(n)); 3564 static_cast<unsigned long long>(n));
3563 } 3565 }
3564 const ResourceBinding& image = upload ? p.binding : p.source; 3566 const ResourceBinding& image = upload ? p.binding : p.source;
3565 if (result == ReplayResult::success && texture_copy->tile_footprint && !p.buffer_image_copies.empty()) { 3567 if (result == ReplayResult::success && !p.buffer_image_copies.empty()) {
3566 const auto& region = p.buffer_image_copies.front(); 3568 const auto& region = p.buffer_image_copies.front();
3567 const BlockFormat fmt = copy_block_format(image, region.imageSubresource.aspectMask); 3569 const BlockFormat fmt = copy_block_format(image, region.imageSubresource.aspectMask);
3568 const std::uint32_t alignment = 3570 const std::uint32_t alignment =