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 c599eb7c2..965a21c1c 100644 --- a/runtime/src/vulkan_bindless.h +++ b/runtime/src/vulkan_bindless.h | |||
| @@ -400,19 +400,21 @@ public: | |||
| 400 | result == DescriptorTable::InsertResult::added_with_relocation; | 400 | result == DescriptorTable::InsertResult::added_with_relocation; |
| 401 | return true; | 401 | return true; |
| 402 | } | 402 | } |
| 403 | // Erasing compacts the key's probe cluster, so other keys' entries may change slots. | 403 | // Erasing empties only the key's own slot; no other entry moves (DescriptorTable::erase), so it needs no idle. |
| 404 | // The caller erases a key once no submitted work uses it (its texture is gone), like D3D12 requires. | ||
| 404 | bool erase_key(const DescriptorKey& key) { | 405 | bool erase_key(const DescriptorKey& key) { |
| 405 | if (!table_.erase(key)) return false; | 406 | if (!table_.erase(key)) return false; |
| 406 | table_dirty_ = existing_entries_changed_ = true; | 407 | table_dirty_ = true; |
| 407 | return true; | 408 | return true; |
| 408 | } | 409 | } |
| 409 | const DescriptorTable& table() const { return table_; } | 410 | const DescriptorTable& table() const { return table_; } |
| 410 | 411 | ||
| 411 | // True when the next flush() will change entries a running shader may be probing, or replace the table's | 412 | // True when the next flush() will change entries a running shader may be probing (a live key's index replaced |
| 412 | // buffer: the caller then flushes only once no command buffer that uses the set is still executing. Without | 413 | // or a live key moved by a relocating insert), or replace the table's buffer: the caller then flushes only once |
| 413 | // it the flush only adds entries, and the copy of an entry is not atomic: a shader probing a different key | 414 | // no command buffer that uses the set is still executing. Without it the flush only adds entries or empties the |
| 414 | // could in principle see a torn entry that matches it, which is accepted as vanishingly unlikely because the | 415 | // slots of erased keys, and the copy of an entry is not atomic: a shader probing a different key could in |
| 415 | // added key is new (there is no live key equal to it). | 416 | // principle see a torn entry that matches it, which is accepted as vanishingly unlikely because the added or |
| 417 | // erased key is not live (no running work uses it). | ||
| 416 | bool flush_needs_idle() const { | 418 | bool flush_needs_idle() const { |
| 417 | return table_dirty_ && (existing_entries_changed_ || force_full_upload_ || | 419 | return table_dirty_ && (existing_entries_changed_ || force_full_upload_ || |
| 418 | table_.size_bytes() > table_buffers_.table.size); | 420 | table_.size_bytes() > table_buffers_.table.size); |