vulkan/overlay: add new options to display device/swapchain-format
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 14 Dec 2020 08:53:42 +0000 (10:53 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 15 Dec 2020 08:05:38 +0000 (08:05 +0000)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3973
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8080>

src/vulkan/overlay-layer/overlay.cpp
src/vulkan/overlay-layer/overlay_params.c
src/vulkan/overlay-layer/overlay_params.h

index 960a5433e0a1c508774b2bada21cff1de2f07a10..2882bad73d4fe132b56ca4a0c6ba53817339de32 100644 (file)
@@ -928,11 +928,14 @@ static void compute_swapchain_display(struct swapchain_data *data)
    ImGui::NewFrame();
    position_layer(data);
    ImGui::Begin("Mesa overlay");
-   ImGui::Text("Device: %s", device_data->properties.deviceName);
+   if (instance_data->params.enabled[OVERLAY_PARAM_ENABLED_device])
+      ImGui::Text("Device: %s", device_data->properties.deviceName);
 
-   const char *format_name = vk_Format_to_str(data->format);
-   format_name = format_name ? (format_name + strlen("VK_FORMAT_")) : "unknown";
-   ImGui::Text("Swapchain format: %s", format_name);
+   if (instance_data->params.enabled[OVERLAY_PARAM_ENABLED_format]) {
+      const char *format_name = vk_Format_to_str(data->format);
+      format_name = format_name ? (format_name + strlen("VK_FORMAT_")) : "unknown";
+      ImGui::Text("Swapchain format: %s", format_name);
+   }
    if (instance_data->params.enabled[OVERLAY_PARAM_ENABLED_frame])
       ImGui::Text("Frames: %" PRIu64, data->n_frames);
    if (instance_data->params.enabled[OVERLAY_PARAM_ENABLED_fps])
@@ -1327,7 +1330,7 @@ static struct overlay_draw *render_swapchain_display(struct swapchain_data *data
    if (device_data->graphic_queue->family_index != present_queue->family_index)
    {
       /* Transfer the image back to the present queue family
-       * image layout was already changed to present by the render pass 
+       * image layout was already changed to present by the render pass
        */
       imb.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
       imb.pNext = nullptr;
index afc17ec07a92451b4a9d23eff9741ce51815d180..48a9f7e3b5a32c53014fd354fdce4696dd1c34b6 100644 (file)
@@ -165,6 +165,8 @@ parse_overlay_env(struct overlay_params *params,
    /* Visible by default */
    params->enabled[OVERLAY_PARAM_ENABLED_fps] = true;
    params->enabled[OVERLAY_PARAM_ENABLED_frame_timing] = true;
+   params->enabled[OVERLAY_PARAM_ENABLED_device] = true;
+   params->enabled[OVERLAY_PARAM_ENABLED_format] = true;
    params->fps_sampling_period = 500000; /* 500ms */
    params->width = params->height = 300;
    params->control = -1;
index 7ff092daeff18c251caf3aeb83e8c99bd157a9e0..e919f74ff6cb5d17465ce6f435d67a77cfbeb1bf 100644 (file)
@@ -33,6 +33,8 @@ extern "C" {
 #include <stdbool.h>
 
 #define OVERLAY_PARAMS                               \
+   OVERLAY_PARAM_BOOL(device)                        \
+   OVERLAY_PARAM_BOOL(format)                        \
    OVERLAY_PARAM_BOOL(fps)                           \
    OVERLAY_PARAM_BOOL(frame)                         \
    OVERLAY_PARAM_BOOL(frame_timing)                  \