blob: 452a84f1e1ec6826d4a14d6c34c9ba06855e388b [file] [log] [blame]
/*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "include/gpu/graphite/Recording.h"
#include "src/gpu/graphite/CommandBuffer.h"
#include "src/gpu/graphite/RecordingPriv.h"
#include "src/gpu/graphite/Resource.h"
#include "src/gpu/graphite/ResourceProvider.h"
#include "src/gpu/graphite/TaskGraph.h"
namespace skgpu::graphite {
Recording::Recording(std::unique_ptr<TaskGraph> graph) : fGraph(std::move(graph)) {
}
Recording::~Recording() {}
////////////////////////////////////////////////////////////////////////////////
bool RecordingPriv::addCommands(ResourceProvider* resourceProvider, CommandBuffer* commandBuffer) {
if (!fRecording->fGraph->addCommands(resourceProvider, commandBuffer)) {
return false;
}
for (size_t i = 0; i < fRecording->fExtraResourceRefs.size(); ++i) {
commandBuffer->trackResource(fRecording->fExtraResourceRefs[i]);
}
return true;
}
void RecordingPriv::addResourceRef(sk_sp<Resource> resource) {
fRecording->fExtraResourceRefs.push_back(std::move(resource));
}
} // namespace skgpu::graphite