1 /* 2 * Copyright 2018 Google Inc. 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 GrMtlResourceProvider_DEFINED 9 #define GrMtlResourceProvider_DEFINED 10 11 #include "GrMtlCopyPipelineState.h" 12 #include "SkTArray.h" 13 14 #import <metal/metal.h> 15 16 class GrMtlGpu; 17 18 class GrMtlResourceProvider { 19 public: GrMtlResourceProvider(GrMtlGpu * gpu)20 GrMtlResourceProvider(GrMtlGpu* gpu) : fGpu(gpu) {} 21 22 GrMtlCopyPipelineState* findOrCreateCopyPipelineState(MTLPixelFormat dstPixelFormat, 23 id<MTLFunction> vertexFunction, 24 id<MTLFunction> fragmentFunction, 25 MTLVertexDescriptor* vertexDescriptor); 26 27 private: 28 SkTArray<std::unique_ptr<GrMtlCopyPipelineState>> fCopyPipelineStateCache; 29 30 GrMtlGpu* fGpu; 31 }; 32 33 #endif 34