diff options
Diffstat (limited to 'runtime/src/vulkan_bindless.h')
| -rw-r--r-- | runtime/src/vulkan_bindless.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/runtime/src/vulkan_bindless.h b/runtime/src/vulkan_bindless.h index 9111f764c..5f484bf16 100644 --- a/runtime/src/vulkan_bindless.h +++ b/runtime/src/vulkan_bindless.h | |||
| @@ -435,19 +435,21 @@ public: | |||
| 435 | result == DescriptorTable::InsertResult::added_with_relocation; | 435 | result == DescriptorTable::InsertResult::added_with_relocation; |
| 436 | return true; | 436 | return true; |
| 437 | } | 437 | } |
| 438 | // Erasing compacts the key's probe cluster, so other keys' entries may change slots. | 438 | // Erasing empties only the key's own slot; no other entry moves (DescriptorTable::erase), so it needs no idle. |
| 439 | // The caller erases a key once no submitted work uses it (its texture is gone), like D3D12 requires. | ||
| 439 | bool erase_key(const DescriptorKey& key) { | 440 | bool erase_key(const DescriptorKey& key) { |
| 440 | if (!table_.erase(key)) return false; | 441 | if (!table_.erase(key)) return false; |
| 441 | table_dirty_ = existing_entries_changed_ = true; | 442 | table_dirty_ = true; |
| 442 | return true; | 443 | return true; |
| 443 | } | 444 | } |
| 444 | const DescriptorTable& table() const { return table_; } | 445 | const DescriptorTable& table() const { return table_; } |
| 445 | 446 | ||
| 446 | // True when the next flush() will change entries a running shader may be probing, or replace the table's | 447 | // True when the next flush() will change entries a running shader may be probing (a live key's index replaced |
| 447 | // buffer: the caller then flushes only once no command buffer that uses the set is still executing. Without | 448 | // or a live key moved by a relocating insert), or replace the table's buffer: the caller then flushes only once |
| 448 | // it the flush only adds entries, and the copy of an entry is not atomic: a shader probing a different key | 449 | // no command buffer that uses the set is still executing. Without it the flush only adds entries or empties the |
| 449 | // could in principle see a torn entry that matches it, which is accepted as vanishingly unlikely because the | 450 | // slots of erased keys, and the copy of an entry is not atomic: a shader probing a different key could in |
| 450 | // added key is new (there is no live key equal to it). | 451 | // principle see a torn entry that matches it, which is accepted as vanishingly unlikely because the added or |
| 452 | // erased key is not live (no running work uses it). | ||
| 451 | bool flush_needs_idle() const { | 453 | bool flush_needs_idle() const { |
| 452 | return table_dirty_ && (existing_entries_changed_ || force_full_upload_ || | 454 | return table_dirty_ && (existing_entries_changed_ || force_full_upload_ || |
| 453 | table_.size_bytes() > table_buffers_.table.size); | 455 | table_.size_bytes() > table_buffers_.table.size); |