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:
Enrico Galli
2020-08-13 20:25:39 +00:00
committed by Commit Bot service account
parent f7905c3cb5
commit 76d9e34bbc
20 changed files with 203 additions and 129 deletions

View File

@@ -442,11 +442,7 @@ namespace dawn_native { namespace opengl {
} // namespace
CommandBuffer::CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor)
: CommandBufferBase(encoder, descriptor), mCommands(encoder->AcquireCommands()) {
}
CommandBuffer::~CommandBuffer() {
FreeCommands(&mCommands);
: CommandBufferBase(encoder, descriptor) {
}
void CommandBuffer::Execute() {

View File

@@ -15,7 +15,6 @@
#ifndef DAWNNATIVE_OPENGL_COMMANDBUFFERGL_H_
#define DAWNNATIVE_OPENGL_COMMANDBUFFERGL_H_
#include "dawn_native/CommandAllocator.h"
#include "dawn_native/CommandBuffer.h"
namespace dawn_native {
@@ -33,11 +32,8 @@ namespace dawn_native { namespace opengl {
void Execute();
private:
~CommandBuffer() override;
void ExecuteComputePass();
void ExecuteRenderPass(BeginRenderPassCmd* renderPass);
CommandIterator mCommands;
};
}} // namespace dawn_native::opengl