• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2021 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 // DisplayVkNull.cpp:
7 //    Implements the class methods for DisplayVkNull.
8 //
9 
10 #include "DisplayVkNull.h"
11 #include "WindowSurfaceVkNull.h"
12 
13 #include "libANGLE/Display.h"
14 #include "libANGLE/renderer/vulkan/RendererVk.h"
15 #include "libANGLE/renderer/vulkan/vk_caps_utils.h"
16 
17 namespace rx
18 {
19 
DisplayVkNull(const egl::DisplayState & state)20 DisplayVkNull::DisplayVkNull(const egl::DisplayState &state) : DisplayVk(state) {}
21 
isValidNativeWindow(EGLNativeWindowType window) const22 bool DisplayVkNull::isValidNativeWindow(EGLNativeWindowType window) const
23 {
24     return false;
25 }
26 
createWindowSurfaceVk(const egl::SurfaceState & state,EGLNativeWindowType window)27 SurfaceImpl *DisplayVkNull::createWindowSurfaceVk(const egl::SurfaceState &state,
28                                                   EGLNativeWindowType window)
29 {
30     return new WindowSurfaceVkNull(state, window);
31 }
32 
getWSIExtension() const33 const char *DisplayVkNull::getWSIExtension() const
34 {
35     return nullptr;
36 }
37 
isUsingSwapchain() const38 bool DisplayVkNull::isUsingSwapchain() const
39 {
40     return false;
41 }
42 
generateConfigs()43 egl::ConfigSet DisplayVkNull::generateConfigs()
44 {
45     constexpr GLenum kColorFormats[] = {GL_RGBA8, GL_BGRA8_EXT, GL_RGB565, GL_RGB8};
46 
47     return egl_vk::GenerateConfigs(kColorFormats, egl_vk::kConfigDepthStencilFormats, this);
48 }
49 
checkConfigSupport(egl::Config * config)50 void DisplayVkNull::checkConfigSupport(egl::Config *config)
51 {
52     config->surfaceType &= ~EGL_WINDOW_BIT;
53 }
54 
IsVulkanNullDisplayAvailable()55 bool IsVulkanNullDisplayAvailable()
56 {
57     return true;
58 }
59 
CreateVulkanNullDisplay(const egl::DisplayState & state)60 DisplayImpl *CreateVulkanNullDisplay(const egl::DisplayState &state)
61 {
62     return new DisplayVkNull(state);
63 }
64 
65 }  // namespace rx
66