1 // Copyright 2018 The Dawn Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef DAWNNATIVE_METAL_FORWARD_H_
16 #define DAWNNATIVE_METAL_FORWARD_H_
17 
18 #include "dawn_native/ToBackend.h"
19 
20 namespace dawn_native { namespace metal {
21 
22     class Adapter;
23     class BindGroup;
24     class BindGroupLayout;
25     class Buffer;
26     class CommandBuffer;
27     class ComputePipeline;
28     class Device;
29     class Framebuffer;
30     class PipelineLayout;
31     class QuerySet;
32     class Queue;
33     class RenderPipeline;
34     class Sampler;
35     class ShaderModule;
36     class StagingBuffer;
37     class SwapChain;
38     class Texture;
39     class TextureView;
40 
41     struct MetalBackendTraits {
42         using AdapterType = Adapter;
43         using BindGroupType = BindGroup;
44         using BindGroupLayoutType = BindGroupLayout;
45         using BufferType = Buffer;
46         using CommandBufferType = CommandBuffer;
47         using ComputePipelineType = ComputePipeline;
48         using DeviceType = Device;
49         using PipelineLayoutType = PipelineLayout;
50         using QuerySetType = QuerySet;
51         using QueueType = Queue;
52         using RenderPipelineType = RenderPipeline;
53         using SamplerType = Sampler;
54         using ShaderModuleType = ShaderModule;
55         using StagingBufferType = StagingBuffer;
56         using SwapChainType = SwapChain;
57         using TextureType = Texture;
58         using TextureViewType = TextureView;
59     };
60 
61     template <typename T>
62     auto ToBackend(T&& common) -> decltype(ToBackendBase<MetalBackendTraits>(common)) {
63         return ToBackendBase<MetalBackendTraits>(common);
64     }
65 
66 }}  // namespace dawn_native::metal
67 
68 #endif  // DAWNNATIVE_METAL_FORWARD_H_
69