Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / src / gpu / graphite / mtl / MtlResourceProvider.h
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_graphite_MtlResourceProvider_DEFINED
9 #define skgpu_graphite_MtlResourceProvider_DEFINED
10
11 #include "include/private/SkTHash.h"
12 #include "src/gpu/graphite/DrawTypes.h"
13 #include "src/gpu/graphite/ResourceProvider.h"
14
15 #import <Metal/Metal.h>
16
17 namespace skgpu::graphite {
18
19 class CommandBuffer;
20 class MtlGpu;
21
22 class MtlResourceProvider final : public ResourceProvider {
23 public:
24     MtlResourceProvider(const Gpu* gpu, sk_sp<GlobalCache>, SingleOwner*);
25     ~MtlResourceProvider() override {}
26
27     sk_sp<Texture> createWrappedTexture(const BackendTexture&) override;
28
29     // Finds or creates a compatible DepthStencilState based on the enum
30     sk_cfp<id<MTLDepthStencilState>> findOrCreateCompatibleDepthStencilState(
31             const DepthStencilSettings&);
32
33 private:
34     const MtlGpu* mtlGpu();
35
36     sk_sp<CommandBuffer> createCommandBuffer() override;
37     sk_sp<GraphicsPipeline> onCreateGraphicsPipeline(const GraphicsPipelineDesc&,
38                                                             const RenderPassDesc&) override;
39     sk_sp<Texture> createTexture(SkISize, const TextureInfo&, SkBudgeted) override;
40     sk_sp<Buffer> createBuffer(size_t size, BufferType type, PrioritizeGpuReads) override;
41
42     sk_sp<Sampler> createSampler(const SkSamplingOptions&,
43                                         SkTileMode xTileMode,
44                                         SkTileMode yTileMode) override;
45
46     SkTHashMap<DepthStencilSettings, sk_cfp<id<MTLDepthStencilState>>> fDepthStencilStates;
47 };
48
49 } // namespace skgpu::graphite
50
51 #endif // skgpu_graphite_MtlResourceProvider_DEFINED