diff options
| author | Dennis Schöneberg <schoenebergde@gmail.com> | 2026-11-23 19:32:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-23 12:32:05 -0600 |
| commit | 1599683cafa5d046c5e2bc91b5f3d8ad2b9caa5f (patch) | |
| tree | 8f03e0b827afa1686a1f6af5a8abf4edcc87cd03 /runtime/src | |
| parent | 23060e0877d608a9f3273b89797dc802cfa2face (diff) | |
d3d12: reset predication in ClearState and align SetPredication / AtomicCopyBuffer validation (#6815)
Squash-merged after diff review of PR #6815
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/command_list.h | 12 | ||||
| -rw-r--r-- | runtime/src/vulkan_replay.h | 7 |
2 files changed, 11 insertions, 8 deletions
diff --git a/runtime/src/command_list.h b/runtime/src/command_list.h index 4b384bdc1..0d5ae922f 100644 --- a/runtime/src/command_list.h +++ b/runtime/src/command_list.h | |||
| @@ -485,7 +485,8 @@ struct WriteImmediate { | |||
| 485 | std::uint32_t mode; | 485 | std::uint32_t mode; |
| 486 | }; | 486 | }; |
| 487 | 487 | ||
| 488 | // D3D12_SUBRESOURCE_RANGE_UINT64 of a dependent resource: [begin, end) in bytes of one subresource. | 488 | // D3D12_SUBRESOURCE_RANGE_UINT64 of a dependent resource: [begin, end) in bytes of one subresource |
| 489 | // (end == UINT64_MAX is the D3D12 sentinel meaning through the end of the subresource). | ||
| 489 | struct DependentRange { | 490 | struct DependentRange { |
| 490 | ResourceId resource; | 491 | ResourceId resource; |
| 491 | std::uint32_t subresource; | 492 | std::uint32_t subresource; |
| @@ -786,16 +787,15 @@ public: | |||
| 786 | return append(write); | 787 | return append(write); |
| 787 | } | 788 | } |
| 788 | 789 | ||
| 789 | // AtomicCopyBufferUINT/UINT64, with the rules of the D3D12 debug layer's ATOMICCOPYBUFFER_* messages (IDs | 790 | // AtomicCopyBufferUINT/UINT64: both offsets aligned to the copy's size and each dependency on a named resource with |
| 790 | // 1027-1040 in d3d12sdklayers.h): both offsets aligned to the copy's size and at least one dependency, each on a | 791 | // a non-empty, non-inverted range (zero dependencies is accepted by the Windows 11 WARP and RTX 5090 D3D12 |
| 791 | // named resource. A copy of a value onto itself (vkCmdCopyBuffer forbids the overlap) is refused too. | 792 | // runtimes). A copy of a value onto itself (vkCmdCopyBuffer forbids the overlap) is refused too. |
| 792 | bool atomic_copy(const AtomicCopyBuffer& copy) { | 793 | bool atomic_copy(const AtomicCopyBuffer& copy) { |
| 793 | if ((copy.bytes != 4 && copy.bytes != 8) || !copy.dst || !copy.src) return false; | 794 | if ((copy.bytes != 4 && copy.bytes != 8) || !copy.dst || !copy.src) return false; |
| 794 | if (copy.dst == copy.src && copy.dst_offset == copy.src_offset) return false; | 795 | if (copy.dst == copy.src && copy.dst_offset == copy.src_offset) return false; |
| 795 | if (copy.dst_offset % copy.bytes || copy.src_offset % copy.bytes) return false; | 796 | if (copy.dst_offset % copy.bytes || copy.src_offset % copy.bytes) return false; |
| 796 | if (copy.dependencies.empty()) return false; | ||
| 797 | for (const auto& d : copy.dependencies) | 797 | for (const auto& d : copy.dependencies) |
| 798 | if (!d.resource) return false; | 798 | if (!d.resource || d.begin >= d.end) return false; |
| 799 | return append(copy); | 799 | return append(copy); |
| 800 | } | 800 | } |
| 801 | 801 | ||
diff --git a/runtime/src/vulkan_replay.h b/runtime/src/vulkan_replay.h index 1e0e598c7..7ed8d251a 100644 --- a/runtime/src/vulkan_replay.h +++ b/runtime/src/vulkan_replay.h | |||
| @@ -2922,8 +2922,11 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun | |||
| 2922 | for (const auto& d : atomic->dependencies) { | 2922 | for (const auto& d : atomic->dependencies) { |
| 2923 | const ResourceBinding* dependent = resolve(d.resource); | 2923 | const ResourceBinding* dependent = resolve(d.resource); |
| 2924 | if (!dependent) return ReplayResult::unresolved_resource; | 2924 | if (!dependent) return ReplayResult::unresolved_resource; |
| 2925 | if (!dependent->image && (d.subresource != 0 || d.begin > d.end || d.end > dependent->size)) | 2925 | if (!dependent->image) { |
| 2926 | return ReplayResult::invalid_copy; | 2926 | const std::uint64_t end = d.end == UINT64_MAX ? dependent->size : d.end; |
| 2927 | if (d.subresource != 0 || d.begin >= end || end > dependent->size) | ||
| 2928 | return ReplayResult::invalid_copy; | ||
| 2929 | } | ||
| 2927 | } | 2930 | } |
| 2928 | p.buffer_copies.push_back({p.source.buffer_offset + atomic->src_offset, | 2931 | p.buffer_copies.push_back({p.source.buffer_offset + atomic->src_offset, |
| 2929 | p.binding.buffer_offset + atomic->dst_offset, atomic->bytes}); | 2932 | p.binding.buffer_offset + atomic->dst_offset, atomic->bytes}); |