aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/mtl/GrMtlResourceProvider.h
blob: d5b66ede66e8d2d20d6e2fb2e3b8f4a4ccd3bbb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * Copyright 2018 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
*/

#ifndef GrMtlResourceProvider_DEFINED
#define GrMtlResourceProvider_DEFINED

#include "GrMtlCopyPipelineState.h"
#include "SkTArray.h"

#import <metal/metal.h>

class GrMtlGpu;

class GrMtlResourceProvider {
public:
    GrMtlResourceProvider(GrMtlGpu* gpu) : fGpu(gpu) {}

    GrMtlCopyPipelineState* findOrCreateCopyPipelineState(MTLPixelFormat dstPixelFormat,
                                                          id<MTLFunction> vertexFunction,
                                                          id<MTLFunction> fragmentFunction,
                                                          MTLVertexDescriptor* vertexDescriptor);

private:
    SkTArray<std::unique_ptr<GrMtlCopyPipelineState>> fCopyPipelineStateCache;

    GrMtlGpu* fGpu;
};

#endif