rendervulkan: address several warnings from GCC's new -Wnrvo warning #1500
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(note that -Wnrvo isn't enabled by default anywhere, I just decided to use it to look for simple optimization opportunities)
Three functions edited to enable complete (n)rvo
I checked the differences this PR made to the codegen when building w/ gcc &
--buildtype=release -Db_lto=on
For
CVulkanDevice::commandBuffer()
, this removes one or more conditional deletion checks on a temporary empty unique_ptr (which I'm pretty sure is unreachable, but the compiler is not aware of that fact)For
CVulkanDevice::CreateTimelineSemaphore
andCVulkanDevice::ImportTimelineSemaphore
this PR removes one or more atomic adds from said functions (when building w/ lto for gcc, the two functions are inlined, but in the places that they were inlined into, there's still a reduction in the amount of atomic adds compared to before this PR)There are still some remaining warnings from -Wnrvo, but they either don't seem to be worth the effort, at least for now...