Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 1 | // you may not use this file except in compliance with the License. |
| 2 | // You may obtain a copy of the License at |
| 3 | // |
| 4 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 5 | // |
| 6 | // Unless required by applicable law or agreed to in writing, software |
| 7 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 8 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 9 | // See the License for the specific language governing permissions and |
| 10 | // limitations under the License. |
| 11 | |
| 12 | #include "XlibSurfaceKHR.hpp" |
| 13 | |
| 14 | namespace vk { |
| 15 | |
| 16 | XlibSurfaceKHR::XlibSurfaceKHR(const VkXlibSurfaceCreateInfoKHR *pCreateInfo, void *mem) : |
| 17 | pDisplay(pCreateInfo->dpy), |
| 18 | window(pCreateInfo->window) { |
| 19 | |
| 20 | } |
| 21 | |
| 22 | void XlibSurfaceKHR::destroySurface(const VkAllocationCallbacks *pAllocator) { |
| 23 | |
| 24 | } |
| 25 | |
| 26 | size_t XlibSurfaceKHR::ComputeRequiredAllocationSize(const VkXlibSurfaceCreateInfoKHR *pCreateInfo) { |
| 27 | return 0; |
| 28 | } |
| 29 | |
| 30 | void XlibSurfaceKHR::getSurfaceCapabilities(VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) const { |
| 31 | SurfaceKHR::getSurfaceCapabilities(pSurfaceCapabilities); |
| 32 | |
| 33 | XWindowAttributes attr; |
| 34 | libX11->XGetWindowAttributes(pDisplay, window, &attr); |
| 35 | VkExtent2D extent = {static_cast<uint32_t>(attr.width), static_cast<uint32_t>(attr.height)}; |
| 36 | |
| 37 | pSurfaceCapabilities->currentExtent = extent; |
| 38 | pSurfaceCapabilities->minImageExtent = extent; |
| 39 | pSurfaceCapabilities->maxImageExtent = extent; |
| 40 | } |
| 41 | |
| 42 | } |