• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2016 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // DeviceVk.h:
7 //    Defines the class interface for DeviceVk, implementing DeviceImpl.
8 //
9 
10 #ifndef LIBANGLE_RENDERER_VULKAN_DEVICEVK_H_
11 #define LIBANGLE_RENDERER_VULKAN_DEVICEVK_H_
12 
13 #include "libANGLE/renderer/DeviceImpl.h"
14 
15 #include "common/vulkan/vk_headers.h"
16 
17 namespace rx
18 {
19 
20 class RendererVk;
21 
22 class DeviceVk : public DeviceImpl
23 {
24   public:
25     DeviceVk();
26     ~DeviceVk() override;
27 
28     egl::Error initialize() override;
29     egl::Error getAttribute(const egl::Display *display,
30                             EGLint attribute,
31                             void **outValue) override;
32     EGLint getType() override;
33     void generateExtensions(egl::DeviceExtensions *outExtensions) const override;
getRenderer()34     RendererVk *getRenderer() const { return mRenderer; }
35 
36   private:
37     // Wrappers for some global vulkan methods which need to read env variables.
38     // The wrappers will set those env variables before calling those global methods.
39     static VKAPI_ATTR VkResult VKAPI_CALL
40     WrappedCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
41                           const VkAllocationCallbacks *pAllocator,
42                           VkInstance *pInstance);
43     static VKAPI_ATTR VkResult VKAPI_CALL
44     WrappedEnumerateInstanceExtensionProperties(const char *pLayerName,
45                                                 uint32_t *pPropertyCount,
46                                                 VkExtensionProperties *pProperties);
47     static VKAPI_ATTR VkResult VKAPI_CALL
48     WrappedEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
49                                             VkLayerProperties *pProperties);
50     static VKAPI_ATTR VkResult VKAPI_CALL WrappedEnumerateInstanceVersion(uint32_t *pApiVersion);
51     static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL WrappedGetInstanceProcAddr(VkInstance instance,
52                                                                                const char *pName);
53 
54     RendererVk *mRenderer = nullptr;
55 };
56 
57 }  // namespace rx
58 
59 #endif  // LIBANGLE_RENDERER_VULKAN_DEVICEVK_H_
60