1 //
2 // Copyright 2019 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 // DisplayVkGGP.cpp:
7 //    Implements the class methods for DisplayVkGGP.
8 //
9 
10 #include "libANGLE/renderer/vulkan/ggp/DisplayVkGGP.h"
11 
12 #include "libANGLE/renderer/vulkan/ggp/WindowSurfaceVkGGP.h"
13 #include "libANGLE/renderer/vulkan/vk_caps_utils.h"
14 
15 namespace rx
16 {
DisplayVkGGP(const egl::DisplayState & state)17 DisplayVkGGP::DisplayVkGGP(const egl::DisplayState &state) : DisplayVk(state) {}
18 
isValidNativeWindow(EGLNativeWindowType window) const19 bool DisplayVkGGP::isValidNativeWindow(EGLNativeWindowType window) const
20 {
21     // GGP doesn't use window handles.
22     return true;
23 }
24 
createWindowSurfaceVk(const egl::SurfaceState & state,EGLNativeWindowType window)25 SurfaceImpl *DisplayVkGGP::createWindowSurfaceVk(const egl::SurfaceState &state,
26                                                  EGLNativeWindowType window)
27 {
28     return new WindowSurfaceVkGGP(state, window);
29 }
30 
generateConfigs()31 egl::ConfigSet DisplayVkGGP::generateConfigs()
32 {
33     // Not entirely sure what backbuffer formats GGP supports.
34     constexpr GLenum kColorFormats[] = {GL_BGRA8_EXT, GL_BGRX8_ANGLEX};
35     return egl_vk::GenerateConfigs(kColorFormats, egl_vk::kConfigDepthStencilFormats, this);
36 }
37 
checkConfigSupport(egl::Config * config)38 void DisplayVkGGP::checkConfigSupport(egl::Config *config) {}
39 
getWSIExtension() const40 const char *DisplayVkGGP::getWSIExtension() const
41 {
42     return VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME;
43 }
44 
IsVulkanGGPDisplayAvailable()45 bool IsVulkanGGPDisplayAvailable()
46 {
47     return true;
48 }
49 
CreateVulkanGGPDisplay(const egl::DisplayState & state)50 DisplayImpl *CreateVulkanGGPDisplay(const egl::DisplayState &state)
51 {
52     return new DisplayVkGGP(state);
53 }
54 }  // namespace rx
55