Debian Codegraph @

src/gpu/graphite/mtl/MtlResourceProvider.h

raw
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 "src/core/SkTHash.h"
12 #include "src/gpu/graphite/DrawTypes.h"
13 #include "src/gpu/graphite/ResourceProvider.h"
14 #include "src/gpu/graphite/mtl/MtlGraphicsPipeline.h"
15
16 #import <Metal/Metal.h>
17
18 namespace skgpu::graphite {
19
20 class CommandBuffer;
21 class MtlSharedContext;
22
23 class MtlResourceProvider final : public ResourceProvider {
24 public:
25 MtlResourceProvider(SharedContext* sharedContext,
26 SingleOwner*,
27 uint32_t recorderID,
28 size_t resourceBudget);
29 ~MtlResourceProvider() override {}
30
31 sk_sp<MtlGraphicsPipeline> findOrCreateLoadMSAAPipeline(const RenderPassDesc&);
32
33 private:
34 const MtlSharedContext* mtlSharedContext();
35
36 sk_sp<ComputePipeline> createComputePipeline(const ComputePipelineDesc&) override;
37
38 sk_sp<Texture> createTexture(SkISize, const TextureInfo&) override;
39 sk_sp<Texture> onCreateWrappedTexture(const BackendTexture&) override;
40 sk_sp<Buffer> createBuffer(size_t size, BufferType type, AccessPattern) override;
41 sk_sp<Sampler> createSampler(const SamplerDesc&) override;
42
43 BackendTexture onCreateBackendTexture(SkISize dimensions, const TextureInfo&) override;
44 void onDeleteBackendTexture(const BackendTexture&) override;
45
46 skia_private::THashMap<uint32_t, sk_sp<MtlGraphicsPipeline>> fLoadMSAAPipelines;
47 };
48
49 } // namespace skgpu::graphite
50
51 #endif // skgpu_graphite_MtlResourceProvider_DEFINED