From 87dd4ae72197539ac30aad5dd796223cd9f322c4 Mon Sep 17 00:00:00 2001 From: TheNumbat Date: Mon, 29 Jan 2024 19:07:24 -0500 Subject: [PATCH] fix imgui validation warning --- deps/rpp | 2 +- rvk/imgui_impl_vulkan.cpp | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/deps/rpp b/deps/rpp index bd558ca..10aa0a4 160000 --- a/deps/rpp +++ b/deps/rpp @@ -1 +1 @@ -Subproject commit bd558ca4da2bd22220944062ccaebf4d7a5f4292 +Subproject commit 10aa0a428d524bf916dca49f38a71973385caec1 diff --git a/rvk/imgui_impl_vulkan.cpp b/rvk/imgui_impl_vulkan.cpp index 16bedbb..40ac542 100644 --- a/rvk/imgui_impl_vulkan.cpp +++ b/rvk/imgui_impl_vulkan.cpp @@ -459,14 +459,12 @@ static void ImGui_ImplVulkan_SetupRenderState(ImDrawData* draw_data, VkPipeline // Setup scale and translation: // Our visible imgui space lies from draw_data->DisplayPps (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps. { - float scale[2]; - scale[0] = 2.0f / draw_data->DisplaySize.x; - scale[1] = 2.0f / draw_data->DisplaySize.y; - float translate[2]; - translate[0] = -1.0f - draw_data->DisplayPos.x * scale[0]; - translate[1] = -1.0f - draw_data->DisplayPos.y * scale[1]; - vkCmdPushConstants(command_buffer, bd->PipelineLayout, VK_SHADER_STAGE_VERTEX_BIT, sizeof(float) * 0, sizeof(float) * 2, scale); - vkCmdPushConstants(command_buffer, bd->PipelineLayout, VK_SHADER_STAGE_VERTEX_BIT, sizeof(float) * 2, sizeof(float) * 2, translate); + float constants[4]; + constants[0] = 2.0f / draw_data->DisplaySize.x; + constants[1] = 2.0f / draw_data->DisplaySize.y; + constants[2] = -1.0f - draw_data->DisplayPos.x * constants[0]; + constants[3] = -1.0f - draw_data->DisplayPos.y * constants[1]; + vkCmdPushConstants(command_buffer, bd->PipelineLayout, VK_SHADER_STAGE_VERTEX_BIT, sizeof(float) * 0, sizeof(float) * 4, constants); } }