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