mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 10:49:14 +00:00
Eagerly destroy CommandBuffer commands after submission
Command buffers hold references to all encoded objects. Freeing them eagerly significantly reduces the amount memory held before the JS GC clears the command buffers. Bug: dawn:262, dawn:372 Change-Id: I68dfa973f980fba8d94611ed1de3c593bdb91a63 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26562 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
f7905c3cb5
commit
76d9e34bbc
@@ -91,10 +91,13 @@ namespace dawn_native {
|
||||
return static_cast<T*>(NextData(sizeof(T) * count, alignof(T)));
|
||||
}
|
||||
|
||||
// Needs to be called if iteration was stopped early.
|
||||
// Sets iterator to the beginning of the commands without emptying the list. This method can
|
||||
// be used if iteration was stopped early and the iterator needs to be restarted.
|
||||
void Reset();
|
||||
|
||||
void DataWasDestroyed();
|
||||
// This method must to be called after commands have been deleted. This indicates that the
|
||||
// commands have been submitted and they are no longer valid.
|
||||
void MakeEmptyAsDataWasDestroyed();
|
||||
|
||||
private:
|
||||
bool IsEmpty() const;
|
||||
@@ -139,7 +142,6 @@ namespace dawn_native {
|
||||
size_t mCurrentBlock = 0;
|
||||
// Used to avoid a special case for empty iterators.
|
||||
uint32_t mEndOfBlock = detail::kEndOfBlock;
|
||||
bool mDataWasDestroyed = false;
|
||||
};
|
||||
|
||||
class CommandAllocator {
|
||||
|
||||
Reference in New Issue
Block a user