1/* 2 * Copyright 2021 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#ifndef skgpu_Recorder_DEFINED 9#define skgpu_Recorder_DEFINED 10 11#include "experimental/graphite/src/TaskGraph.h" 12#include "include/core/SkRefCnt.h" 13 14namespace skgpu { 15 16class Context; 17class DrawBufferManager; 18class ProgramCache; 19class Recording; 20class UniformCache; 21 22class Recorder final : public SkRefCnt { 23public: 24 Recorder(sk_sp<Context>); 25 ~Recorder() override; 26 27 void add(sk_sp<Task>); 28 29 Context* context() const; 30 ProgramCache* programCache(); 31 UniformCache* uniformCache(); 32 DrawBufferManager* drawBufferManager(); 33 34 std::unique_ptr<Recording> snap(); 35 36protected: 37private: 38 sk_sp<Context> fContext; 39 TaskGraph fGraph; 40 std::unique_ptr<ProgramCache> fProgramCache; 41 std::unique_ptr<UniformCache> fUniformCache; 42 std::unique_ptr<DrawBufferManager> fDrawBufferManager; 43}; 44 45} // namespace skgpu 46 47#endif // skgpu_Recorder_DEFINED 48