xref: /aosp_15_r20/external/skia/src/gpu/graphite/dawn/DawnComputePipeline.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2023 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_DawnComputePipeline_DEFINED
9 #define skgpu_graphite_DawnComputePipeline_DEFINED
10 
11 #include "include/core/SkRefCnt.h"
12 #include "src/gpu/graphite/ComputePipeline.h"
13 
14 #include "webgpu/webgpu_cpp.h"  // NO_G3_REWRITE
15 
16 namespace skgpu::graphite {
17 
18 class ComputePipelineDesc;
19 class DawnComputePipelineDesc;
20 class DawnSharedContext;
21 
22 class DawnComputePipeline final : public ComputePipeline {
23 public:
24     static sk_sp<DawnComputePipeline> Make(const DawnSharedContext*, const ComputePipelineDesc&);
25     ~DawnComputePipeline() override = default;
26 
dawnComputePipeline()27     const wgpu::ComputePipeline& dawnComputePipeline() const { return fPipeline; }
dawnGroupLayout()28     const wgpu::BindGroupLayout& dawnGroupLayout() const { return fGroupLayout; }
29 
30 private:
31     DawnComputePipeline(const SharedContext*, wgpu::ComputePipeline, wgpu::BindGroupLayout);
32 
33     void freeGpuData() override;
34 
35     wgpu::ComputePipeline fPipeline;
36     wgpu::BindGroupLayout fGroupLayout;
37 };
38 
39 }  // namespace skgpu::graphite
40 
41 #endif  // skgpu_graphite_DawnComputePipeline_DEFINED
42