xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/vulkan/null/DisplayVkNull.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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 
12 #include "libANGLE/Display.h"
13 #include "libANGLE/renderer/vulkan/SurfaceVk.h"
14 #include "libANGLE/renderer/vulkan/vk_caps_utils.h"
15 #include "libANGLE/renderer/vulkan/vk_renderer.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 OffscreenSurfaceVk(state, mRenderer);
31 }
32 
getWSIExtension() const33 const char *DisplayVkNull::getWSIExtension() const
34 {
35     return nullptr;
36 }
37 
generateConfigs()38 egl::ConfigSet DisplayVkNull::generateConfigs()
39 {
40     constexpr GLenum kColorFormats[] = {GL_RGBA8, GL_BGRA8_EXT, GL_RGB565, GL_RGB8};
41 
42     return egl_vk::GenerateConfigs(kColorFormats, egl_vk::kConfigDepthStencilFormats, this);
43 }
44 
checkConfigSupport(egl::Config * config)45 void DisplayVkNull::checkConfigSupport(egl::Config *config) {}
46 
IsVulkanNullDisplayAvailable()47 bool IsVulkanNullDisplayAvailable()
48 {
49     return true;
50 }
51 
CreateVulkanNullDisplay(const egl::DisplayState & state)52 DisplayImpl *CreateVulkanNullDisplay(const egl::DisplayState &state)
53 {
54     return new DisplayVkNull(state);
55 }
56 
57 }  // namespace rx
58