1 // Copyright 2021 The SwiftShader Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "HeadlessSurfaceKHR.hpp"
16
17 namespace vk {
18
HeadlessSurfaceKHR(const VkHeadlessSurfaceCreateInfoEXT * pCreateInfo,void * mem)19 HeadlessSurfaceKHR::HeadlessSurfaceKHR(const VkHeadlessSurfaceCreateInfoEXT *pCreateInfo, void *mem)
20 {
21 }
22
ComputeRequiredAllocationSize(const VkHeadlessSurfaceCreateInfoEXT * pCreateInfo)23 size_t HeadlessSurfaceKHR::ComputeRequiredAllocationSize(const VkHeadlessSurfaceCreateInfoEXT *pCreateInfo)
24 {
25 return 0;
26 }
27
destroySurface(const VkAllocationCallbacks * pAllocator)28 void HeadlessSurfaceKHR::destroySurface(const VkAllocationCallbacks *pAllocator)
29 {
30 }
31
getSurfaceCapabilities(VkSurfaceCapabilitiesKHR * pSurfaceCapabilities) const32 VkResult HeadlessSurfaceKHR::getSurfaceCapabilities(VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) const
33 {
34 setCommonSurfaceCapabilities(pSurfaceCapabilities);
35 // We could return {0,0} here, but as this type of surface is useful for testing, we return a more
36 // common size here so that buffers like Swapchain images get created with reasonable sizes, and
37 // so that drawing actually exercises common code paths.
38 VkExtent2D extent{ 1280, 720 };
39 pSurfaceCapabilities->currentExtent = extent;
40 pSurfaceCapabilities->minImageExtent = extent;
41 pSurfaceCapabilities->maxImageExtent = extent;
42 return VK_SUCCESS;
43 }
44
attachImage(PresentImage * image)45 void HeadlessSurfaceKHR::attachImage(PresentImage *image)
46 {
47 }
48
detachImage(PresentImage * image)49 void HeadlessSurfaceKHR::detachImage(PresentImage *image)
50 {
51 }
52
present(PresentImage * image)53 VkResult HeadlessSurfaceKHR::present(PresentImage *image)
54 {
55 return VK_SUCCESS;
56 }
57
58 } // namespace vk