swapchain.cpp revision b1352bce9cd82ceaef287b8b3cd7a5c39703a14c
1/*
2 * Copyright 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "loader.h"
18#define LOG_NDEBUG 0
19#include <log/log.h>
20
21namespace vulkan {
22
23VkResult GetPhysicalDeviceSurfaceSupportKHR(
24    VkPhysicalDevice /*pdev*/,
25    uint32_t /*queue_family*/,
26    const VkSurfaceDescriptionKHR* surface_desc,
27    VkBool32* supported) {
28// TODO(jessehall): Fix the header, preferrably upstream, so values added to
29// existing enums don't trigger warnings like this.
30#pragma clang diagnostic push
31#pragma clang diagnostic ignored "-Wold-style-cast"
32#pragma clang diagnostic ignored "-Wsign-conversion"
33    if (surface_desc->sType != VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_KHR)
34        return VK_ERROR_INVALID_VALUE;
35#pragma clang diagnostic pop
36
37    const VkSurfaceDescriptionWindowKHR* window_desc =
38        reinterpret_cast<const VkSurfaceDescriptionWindowKHR*>(surface_desc);
39
40    // TODO(jessehall): Also check whether the physical device exports the
41    // VK_EXT_ANDROID_native_buffer extension. For now, assume it does.
42    *supported = (window_desc->platform == VK_PLATFORM_ANDROID_KHR &&
43                  !window_desc->pPlatformHandle &&
44                  static_cast<ANativeWindow*>(window_desc->pPlatformWindow)
45                          ->common.magic == ANDROID_NATIVE_WINDOW_MAGIC);
46
47    return VK_SUCCESS;
48}
49
50#pragma clang diagnostic push
51#pragma clang diagnostic ignored "-Wunused-parameter"
52VkResult GetSurfacePropertiesKHR(VkDevice device,
53                                 const VkSurfaceDescriptionKHR* surface_desc,
54                                 VkSurfacePropertiesKHR* properties) {
55    ALOGV("TODO: %s", __FUNCTION__);
56    return VK_SUCCESS;
57}
58
59VkResult GetSurfaceFormatsKHR(VkDevice device,
60                              const VkSurfaceDescriptionKHR* surface_desc,
61                              uint32_t* count,
62                              VkSurfaceFormatKHR* formats) {
63    ALOGV("TODO: %s", __FUNCTION__);
64    return VK_SUCCESS;
65}
66
67VkResult GetSurfacePresentModesKHR(VkDevice device,
68                                   const VkSurfaceDescriptionKHR* surface_desc,
69                                   uint32_t* count,
70                                   VkPresentModeKHR* modes) {
71    ALOGV("TODO: %s", __FUNCTION__);
72    return VK_SUCCESS;
73}
74
75VkResult CreateSwapchainKHR(VkDevice device,
76                            const VkSwapchainCreateInfoKHR* create_info,
77                            VkSwapchainKHR* swapchain) {
78    ALOGV("TODO: %s", __FUNCTION__);
79    return VK_SUCCESS;
80}
81
82VkResult DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain) {
83    ALOGV("TODO: %s", __FUNCTION__);
84    return VK_SUCCESS;
85}
86
87VkResult GetSwapchainImagesKHR(VkDevice device,
88                               VkSwapchainKHR swapchain,
89                               uint32_t* count,
90                               VkImage* image) {
91    ALOGV("TODO: %s", __FUNCTION__);
92    return VK_SUCCESS;
93}
94
95VkResult AcquireNextImageKHR(VkDevice device,
96                             VkSwapchainKHR swapchain,
97                             uint64_t timeout,
98                             VkSemaphore semaphore,
99                             uint32_t* image_index) {
100    ALOGV("TODO: %s", __FUNCTION__);
101    return VK_SUCCESS;
102}
103
104VkResult QueuePresentKHR(VkQueue queue, VkPresentInfoKHR* present_info) {
105    ALOGV("TODO: %s", __FUNCTION__);
106    return VK_SUCCESS;
107}
108#pragma clang diagnostic pop
109
110}  // namespace vulkan
111