• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // DisplayVkFuchsia.cpp:
7 //    Implements methods from DisplayVkFuchsia
8 //
9 
10 #include "libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.h"
11 
12 #include "libANGLE/renderer/vulkan/fuchsia/WindowSurfaceVkFuchsia.h"
13 #include "libANGLE/renderer/vulkan/vk_caps_utils.h"
14 
15 namespace rx
16 {
17 
DisplayVkFuchsia(const egl::DisplayState & state)18 DisplayVkFuchsia::DisplayVkFuchsia(const egl::DisplayState &state) : DisplayVk(state) {}
19 
isValidNativeWindow(EGLNativeWindowType window) const20 bool DisplayVkFuchsia::isValidNativeWindow(EGLNativeWindowType window) const
21 {
22     return WindowSurfaceVkFuchsia::isValidNativeWindow(window);
23 }
24 
createWindowSurfaceVk(const egl::SurfaceState & state,EGLNativeWindowType window)25 SurfaceImpl *DisplayVkFuchsia::createWindowSurfaceVk(const egl::SurfaceState &state,
26                                                      EGLNativeWindowType window)
27 {
28     ASSERT(isValidNativeWindow(window));
29     return new WindowSurfaceVkFuchsia(state, window);
30 }
31 
generateConfigs()32 egl::ConfigSet DisplayVkFuchsia::generateConfigs()
33 {
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 bool DisplayVkFuchsia::checkConfigSupport(egl::Config *config)
39 {
40     // TODO(geofflang): Test for native support and modify the config accordingly.
41     // anglebug.com/2692
42     return true;
43 }
44 
getWSIExtension() const45 const char *DisplayVkFuchsia::getWSIExtension() const
46 {
47     return VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME;
48 }
49 
getWSILayer() const50 const char *DisplayVkFuchsia::getWSILayer() const
51 {
52     return "VK_LAYER_FUCHSIA_imagepipe_swapchain";
53 }
54 
IsVulkanFuchsiaDisplayAvailable()55 bool IsVulkanFuchsiaDisplayAvailable()
56 {
57     return true;
58 }
59 
CreateVulkanFuchsiaDisplay(const egl::DisplayState & state)60 DisplayImpl *CreateVulkanFuchsiaDisplay(const egl::DisplayState &state)
61 {
62     return new DisplayVkFuchsia(state);
63 }
64 }  // namespace rx
65