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