vk_texture_runtime: Fix debug scope label lambda-capture (#7102)

`DebugScope` was capturing a `string_view` in a lambda which is only
valid during the scope of this ctor. When the lambda gets invoked at a
later time, it will read undefined garbage. The lambda needs to make a
deep copy of this `string_view` into a `string` so that it is valid by
the time the scheduler invokes this lambda.
This commit is contained in:
Wunk 2023-11-01 13:30:54 -07:00 committed by GitHub
parent d3ce43782d
commit ac9d72a95c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1562,7 +1562,7 @@ DebugScope::DebugScope(TextureRuntime& runtime, Common::Vec4f color, std::string
if (!has_debug_tool) {
return;
}
scheduler.Record([color, label](vk::CommandBuffer cmdbuf) {
scheduler.Record([color, label = std::string(label)](vk::CommandBuffer cmdbuf) {
const vk::DebugUtilsLabelEXT debug_label = {
.pLabelName = label.data(),
.color = std::array{color[0], color[1], color[2], color[3]},