powervr-graphics / Native_SDK

C++ cross-platform 3D graphics SDK. Includes demos & helper code (resource loading etc.) to speed up development of Vulkan, OpenGL ES 2.0 & 3.x applications
https://docs.imgtec.com/sdk-documentation/html/introduction.html
MIT License
702 stars 197 forks source link

Vulkan's optimizations using recommendation for developers #64

Open Andreyogld3d opened 3 years ago

Andreyogld3d commented 3 years ago

Description

Improving performance using Vulkan recommendation:

1. Use VkResetCommantPool instead of vkResetCommandBuffer for each command buffer, see validation layers:

WARNING: VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT (VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) - ID: -2027362524, Name: "UNASSIGNED-BestPractices-vkCreateCommandPool-command-buffer-reset": MESSAGE: Validation Performance Warning: [ UNASSIGNED-BestPractices-vkCreateCommandPool-command-buffer-reset ] Object 0: handle = 0x2cd00196740, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x8728e724 | vkCreateCommandPool(): VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT is set. Consider resetting entire pool instead. Associated Objects - (1) Object[0] - Type VK_OBJECT_TYPE_DEVICE, Value 000002CD00196740, Name "unnamed-object"

2. Use VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT during recording command buffers.

3. Do not use VK_PIPELINE_STAGE_ALL_COMMANDS_BIT during calling vkCmdPipelineBarrier, use optimal stages:

WARNING: VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT (VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT) - ID: 1218486124, Name: "UNASSIGNED-BestPractices-pipeline-stage-flags": MESSAGE: Validation Warning: [ UNASSIGNED-BestPractices-pipeline-stage-flags ] Object 0: handle = 0x2cd00196740, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x48a09f6c | You are using VK_PIPELINE_STAGE_ALL_COMMANDS_BIT when vkCmdPipelineBarrier is called

https://github.com/KhronosGroup/Vulkan-Samples/blob/master/samples/performance/pipeline_barriers