Vulkan: Fixed a BestPractices warning for PushConstants & vkCreateCommandPool-command-buffer-reset#9183
Vulkan: Fixed a BestPractices warning for PushConstants & vkCreateCommandPool-command-buffer-reset#9183JoshBot-Debug wants to merge 1 commit intoocornut:dockingfrom
Conversation
I cannot seem to repro this when I enabled all best practices with latest VulkanSDK. Additionally I am failing to understand how 101f534 would relate to this, could you clarify for my understanding? Thank you |
|
@ocornut Sorry about that, I failed to mention anything remotely helpful! Here's my computer specs: GPU: Intel(R) Arc(tm) A750 Graphics (DG2) Under imgui/backends/vulkan/glsl_shader.vert there are two push constants that are used, scale & translate. layout(push_constant) uniform uPushConstant {
vec2 uScale;
vec2 uTranslate;
} pc;uPushConstant uses 4 floats (16 bytes). Original: 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);Updated: 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, 0, sizeof(float) * 4,
constants);In regards to 101f534, I got the following warning. It's unrelated to the issue above, I didn't mean to push it... Validation Performance Warning: [ UNASSIGNED-BestPractices-vkCreateCommandPool-command-buffer-reset ] | MessageID = 0x8728e724 | vkCreateCommandPool(): pCreateInfo->flags VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT is set. Consider resetting entire pool instead.I found a comment related to it and The comment (in the CHANGELOG comment at the top of the file): |
|
I just assumed that commit was the only one: I can't really read your PR as it modified the entire file, everything was unnecessarily reformatted/rewrapped. |
Alright, will do, my vscode automatically formats everything 🔥 |
…-command-buffer-reset
857ff9f to
138078f
Compare
|
@ocornut I removed both previous commits and made one clean one, let me know if there's anything else. |
I enabled vk best practice and got a warning on every frame, I fixed it and would like to have it pulled if it's right.
Here is the warning: