Mesa (staging/22.0): vulkan: explicitly cast object-type enum

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 21 22:22:06 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: d33531664059d76f7821cdd1e4b6409545691be7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d33531664059d76f7821cdd1e4b6409545691be7

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Thu Mar 24 09:57:10 2022 +0100

vulkan: explicitly cast object-type enum

VkObjectType and VkDebugReportObjectTypeEXT has the same enum-values.
Why the Vulkan WG thought this was a good idea, beats me. But it's what
we have to live with now.

Anyway, instead of having a statement that implicitly casts two
different values from the former to the latter, let's fully relsove the
type as the former, and cast the value when using it instead.

Fixes: 41318a58196 ("vulkan: Use vk_object_base::type for debug_report")
Acked-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15547>
(cherry picked from commit b27a2ba4fcb07d0d55e237f6d62c8dd69e0f1380)

---

 .pick_status.json                    | 2 +-
 src/vulkan/runtime/vk_debug_report.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 41e1b31a9ec..84cad103963 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1164,7 +1164,7 @@
         "description": "vulkan: explicitly cast object-type enum",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "because_sha": "41318a58196d385ce97041e16a055baf892e38cb"
     },
     {
diff --git a/src/vulkan/runtime/vk_debug_report.c b/src/vulkan/runtime/vk_debug_report.c
index db89e3d6f5d..ea9aebf5930 100644
--- a/src/vulkan/runtime/vk_debug_report.c
+++ b/src/vulkan/runtime/vk_debug_report.c
@@ -150,8 +150,9 @@ vk_debug_report(struct vk_instance *instance,
                 const char* pLayerPrefix,
                 const char *pMessage)
 {
-   VkDebugReportObjectTypeEXT object_type =
+   VkObjectType object_type =
       object ? object->type : VK_OBJECT_TYPE_UNKNOWN;
-   debug_report(instance, flags, object_type, (uint64_t)(uintptr_t)object,
-                location, messageCode, pLayerPrefix, pMessage);
+   debug_report(instance, flags, (VkDebugReportObjectTypeEXT)object_type,
+                (uint64_t)(uintptr_t)object, location, messageCode,
+                pLayerPrefix, pMessage);
 }



More information about the mesa-commit mailing list