| 1 |
/* |
| 2 |
* Copyright 2022 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_MtlComputePipeline_DEFINED |
| 9 |
#define skgpu_graphite_MtlComputePipeline_DEFINED |
| 10 |
|
| 11 |
#include "include/core/SkRefCnt.h" |
| 12 |
#include "include/ports/SkCFObject.h" |
| 13 |
#include "src/gpu/graphite/ComputePipeline.h" |
| 14 |
|
| 15 |
#import <Metal/Metal.h> |
| 16 |
|
| 17 |
namespace skgpu::graphite { |
| 18 |
|
| 19 |
class ComputePipelineDesc; |
| 20 |
class ResourceProvider; |
| 21 |
class MtlSharedContext; |
| 22 |
|
| 23 |
class MtlComputePipeline final : public ComputePipeline { |
| 24 |
public: |
| 25 |
static sk_sp<MtlComputePipeline> Make(const MtlSharedContext*, const ComputePipelineDesc&); |
| 26 |
|
| 27 |
~MtlComputePipeline() override = default; |
| 28 |
|
| 29 |
id<MTLComputePipelineState> mtlPipelineState() const { return fPipelineState.get(); } |
| 30 |
|
| 31 |
private: |
| 32 |
MtlComputePipeline(const SharedContext* sharedContext, sk_cfp<id<MTLComputePipelineState>> pso) |
| 33 |
: ComputePipeline(sharedContext) |
| 34 |
, fPipelineState(std::move(pso)) {} |
| 35 |
|
| 36 |
void freeGpuData() override; |
| 37 |
|
| 38 |
sk_cfp<id<MTLComputePipelineState>> fPipelineState; |
| 39 |
}; |
| 40 |
|
| 41 |
} // namespace skgpu::graphite |
| 42 |
|
| 43 |
#endif // skgpu_graphite_MtlComputePipeline_DEFINED |