1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "src/gpu/graphite/task/ClearBuffersTask.h" 9 10 #include "src/gpu/graphite/CommandBuffer.h" 11 12 namespace skgpu::graphite { 13 Make(skia_private::TArray<BindBufferInfo> clearList)14sk_sp<ClearBuffersTask> ClearBuffersTask::Make(skia_private::TArray<BindBufferInfo> clearList) { 15 return sk_sp<ClearBuffersTask>(new ClearBuffersTask(std::move(clearList))); 16 } 17 ~ClearBuffersTask()18ClearBuffersTask::~ClearBuffersTask(){}; 19 addCommands(Context *,CommandBuffer * commandBuffer,ReplayTargetData)20Task::Status ClearBuffersTask::addCommands(Context*, 21 CommandBuffer* commandBuffer, 22 ReplayTargetData) { 23 bool result = true; 24 for (const auto& c : fClearList) { 25 result &= commandBuffer->clearBuffer(c.fBuffer, c.fOffset, c.fSize); 26 } 27 return result ? Status::kSuccess : Status::kFail; 28 } 29 30 } // namespace skgpu::graphite 31