/* * Copyright 2021 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef skgpu_graphite_PipelineDataCache_DEFINED #define skgpu_graphite_PipelineDataCache_DEFINED #include "src/base/SkArenaAlloc.h" #include "src/core/SkTHash.h" #include "src/gpu/graphite/PipelineData.h" namespace skgpu::graphite { // Add a block of data to the cache and return a stable pointer to the contents (assuming that a // resettable gatherer had accumulated the input data pointer). // // If an identical block of data is already in the cache, that existing pointer is returned, making // pointer comparison suitable when comparing data blocks retrieved from the cache. // // T must define a hash() function, an operator==, and a static Make(const T&, SkArenaAlloc*) // factory that's used to copy the data into an arena allocation owned by the PipelineDataCache. template<typename T> class PipelineDataCache { … }; // A UniformDataCache only lives for a single Recording. It's used to deduplicate uniform data // blocks uploaded to uniform/storage buffers for a DrawPass pipeline. UniformDataCache; // A TextureDataCache only lives for a single Recording. When a Recording is snapped it is pulled // off of the Recorder and goes with the Recording as a record of the required Textures and // Samplers. TextureDataCache; } // namespace skgpu::graphite #endif // skgpu_graphite_PipelineDataCache_DEFINED