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_MtlResourceProvider_DEFINED 9 #define skgpu_MtlResourceProvider_DEFINED 10 11 #include "experimental/graphite/src/ResourceProvider.h" 12 13 #import <Metal/Metal.h> 14 15 namespace skgpu { 16 class CommandBuffer; 17 } 18 19 namespace skgpu::mtl { 20 21 class Gpu; 22 23 class ResourceProvider final : public skgpu::ResourceProvider { 24 public: 25 ResourceProvider(const skgpu::Gpu* gpu); ~ResourceProvider()26 ~ResourceProvider() override {} 27 28 private: 29 const Gpu* mtlGpu(); 30 31 sk_sp<skgpu::CommandBuffer> createCommandBuffer() override; 32 sk_sp<skgpu::GraphicsPipeline> onCreateGraphicsPipeline(const GraphicsPipelineDesc&) override; 33 sk_sp<skgpu::Texture> createTexture(SkISize, const skgpu::TextureInfo&) override; 34 sk_sp<skgpu::Buffer> createBuffer(size_t size, BufferType type, PrioritizeGpuReads) override; 35 }; 36 37 } // namespace skgpu::mtl 38 39 #endif // skgpu_MtlResourceProvider_DEFINED 40