1 /* 2 * Copyright 2023 Google Inc. 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 ContextType_DEFINED 9 #define ContextType_DEFINED 10 11 enum class GrBackendApi : unsigned; 12 13 namespace skgpu { 14 15 enum class BackendApi : unsigned; 16 17 // The availability of context types is subject to platform and build configuration 18 // restrictions. 19 enum class ContextType { 20 kGL, //! OpenGL context. 21 kGLES, //! OpenGL ES context. 22 kANGLE_D3D9_ES2, //! ANGLE on Direct3D9 OpenGL ES 2 context. 23 kANGLE_D3D11_ES2, //! ANGLE on Direct3D11 OpenGL ES 2 context. 24 kANGLE_D3D11_ES3, //! ANGLE on Direct3D11 OpenGL ES 3 context. 25 kANGLE_GL_ES2, //! ANGLE on OpenGL OpenGL ES 2 context. 26 kANGLE_GL_ES3, //! ANGLE on OpenGL OpenGL ES 3 context. 27 kANGLE_Metal_ES2, //! ANGLE on Metal ES 2 context. 28 kANGLE_Metal_ES3, //! ANGLE on Metal ES 3 context. 29 kVulkan, //! Vulkan 30 kMetal, //! Metal 31 kDirect3D, //! Direct3D 12 32 kDawn_D3D11, //! Dawn on Direct3D11 33 kDawn_D3D12, //! Dawn on Direct3D12 34 kDawn_Metal, //! Dawn on Metal 35 kDawn_Vulkan, //! Dawn on Vulkan 36 kDawn_OpenGL, //! Dawn on OpenGL 37 kDawn_OpenGLES, //! Dawn on OpenGL ES 38 kMock, //! Mock context that does not draw. 39 kLastContextType = kMock 40 }; 41 42 static const int kContextTypeCount = (int)ContextType::kLastContextType + 1; 43 44 const char* ContextTypeName(skgpu::ContextType type); 45 46 bool IsNativeBackend(skgpu::ContextType type); 47 48 bool IsDawnBackend(skgpu::ContextType type); 49 50 bool IsRenderingContext(skgpu::ContextType type); 51 52 namespace ganesh { 53 54 GrBackendApi ContextTypeBackend(skgpu::ContextType type); 55 56 } // namespace ganesh 57 58 namespace graphite { 59 60 skgpu::BackendApi ContextTypeBackend(skgpu::ContextType type); 61 62 } // namespace graphite 63 } // namespace skgpu 64 65 #endif 66