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_VULKAN_FORWARD_H_
16 #define DAWNNATIVE_VULKAN_FORWARD_H_
17 
18 #include "dawn_native/ToBackend.h"
19 
20 namespace dawn_native { namespace vulkan {
21 
22     class Adapter;
23     class BindGroup;
24     class BindGroupLayout;
25     class Buffer;
26     class CommandBuffer;
27     class ComputePipeline;
28     class Device;
29     class PipelineLayout;
30     class Queue;
31     class RenderPipeline;
32     class ResourceHeap;
33     class Sampler;
34     class ShaderModule;
35     class StagingBuffer;
36     class SwapChain;
37     class Texture;
38     class TextureView;
39 
40     struct VulkanBackendTraits {
41         using AdapterType = Adapter;
42         using BindGroupType = BindGroup;
43         using BindGroupLayoutType = BindGroupLayout;
44         using BufferType = Buffer;
45         using CommandBufferType = CommandBuffer;
46         using ComputePipelineType = ComputePipeline;
47         using DeviceType = Device;
48         using PipelineLayoutType = PipelineLayout;
49         using QueueType = Queue;
50         using RenderPipelineType = RenderPipeline;
51         using ResourceHeapType = ResourceHeap;
52         using SamplerType = Sampler;
53         using ShaderModuleType = ShaderModule;
54         using StagingBufferType = StagingBuffer;
55         using SwapChainType = SwapChain;
56         using TextureType = Texture;
57         using TextureViewType = TextureView;
58     };
59 
60     template <typename T>
61     auto ToBackend(T&& common) -> decltype(ToBackendBase<VulkanBackendTraits>(common)) {
62         return ToBackendBase<VulkanBackendTraits>(common);
63     }
64 
65 }}  // namespace dawn_native::vulkan
66 
67 #endif  // DAWNNATIVE_VULKAN_FORWARD_H_
68