video_core/vulkan: Fix callback variable shadowing in async shader compilation

Resolves a variable shadowing issue in AsyncCompileShader where the callback
lambda parameter was shadowing the outer callback variable. This was causing
compilation warnings/errors in Android Studio. The fix:

- Renames the outer callback variable to 'outer_callback'
- Renames the inner lambda callback parameters to 'inner_callback'
- Maintains consistent naming across all error handling paths

This change improves code clarity and eliminates compiler warnings while
maintaining the same functionality for async shader compilation.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron 2025-04-22 16:57:57 +10:00
parent 66bdd6ed27
commit 2f57a35d2d
1 changed files with 9 additions and 9 deletions

View File

@ -171,7 +171,7 @@ void AsyncCompileShader(const Device& device, const std::string& shader_path,
} }
// Use actual threading for async compilation // Use actual threading for async compilation
std::thread([device_ptr = &device, shader_path, callback = std::move(callback)]() mutable { std::thread([device_ptr = &device, shader_path, outer_callback = std::move(callback)]() mutable {
auto startTime = std::chrono::high_resolution_clock::now(); auto startTime = std::chrono::high_resolution_clock::now();
try { try {
@ -215,25 +215,25 @@ void AsyncCompileShader(const Device& device, const std::string& shader_path,
VkShaderModule raw_module = *shader; VkShaderModule raw_module = *shader;
// Submit callback to main thread via command queue for thread safety // Submit callback to main thread via command queue for thread safety
SubmitCommandToQueue([callback = std::move(callback), raw_module]() { SubmitCommandToQueue([inner_callback = std::move(outer_callback), raw_module]() {
callback(raw_module); inner_callback(raw_module);
}); });
} else { } else {
LOG_ERROR(Render_Vulkan, "Shader validation failed: {}", shader_path); LOG_ERROR(Render_Vulkan, "Shader validation failed: {}", shader_path);
SubmitCommandToQueue([callback = std::move(callback)]() { SubmitCommandToQueue([inner_callback = std::move(outer_callback)]() {
callback(VK_NULL_HANDLE); inner_callback(VK_NULL_HANDLE);
}); });
} }
} else { } else {
LOG_ERROR(Render_Vulkan, "Failed to read shader file: {}", shader_path); LOG_ERROR(Render_Vulkan, "Failed to read shader file: {}", shader_path);
SubmitCommandToQueue([callback = std::move(callback)]() { SubmitCommandToQueue([inner_callback = std::move(outer_callback)]() {
callback(VK_NULL_HANDLE); inner_callback(VK_NULL_HANDLE);
}); });
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
LOG_ERROR(Render_Vulkan, "Error compiling shader: {}", e.what()); LOG_ERROR(Render_Vulkan, "Error compiling shader: {}", e.what());
SubmitCommandToQueue([callback = std::move(callback)]() { SubmitCommandToQueue([inner_callback = std::move(outer_callback)]() {
callback(VK_NULL_HANDLE); inner_callback(VK_NULL_HANDLE);
}); });
} }