From b877eb8537c43413d886b42d7669e568ecef93c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 14 Nov 2020 20:44:01 +0100 Subject: [PATCH] Vk: treat DeviceProperties as a *view* on the VkPhysicalDevice. Originally I needed this change for something, but not anymore. It seems like a good idea nevertheless. --- src/Magnum/Vk/DeviceProperties.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Magnum/Vk/DeviceProperties.h b/src/Magnum/Vk/DeviceProperties.h index 29b5ba869..2fcb09f42 100644 --- a/src/Magnum/Vk/DeviceProperties.h +++ b/src/Magnum/Vk/DeviceProperties.h @@ -221,10 +221,17 @@ class MAGNUM_VK_EXPORT DeviceProperties { /** @brief Move assignment */ DeviceProperties& operator=(DeviceProperties&&) noexcept; - /** @brief Underlying @type_vk{PhysicalDevice} handle */ - VkPhysicalDevice handle() { return _handle; } + /** + * @brief Underlying @type_vk{PhysicalDevice} handle + * + * Unlike most handle getters, this one is marked as @cpp const @ce + * because the @ref DeviceProperties class is treated as a *view* on + * the physical device --- it doesn't change the device state in any + * way, only queries its properties. + */ + VkPhysicalDevice handle() const { return _handle; } /** @overload */ - operator VkPhysicalDevice() { return _handle; } + operator VkPhysicalDevice() const { return _handle; } /** * @brief Raw device properties