mirror of https://git.citron-emu.org/citron/emu
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:
parent
66bdd6ed27
commit
2f57a35d2d
|
@ -171,7 +171,7 @@ void AsyncCompileShader(const Device& device, const std::string& shader_path,
|
|||
}
|
||||
|
||||
// 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();
|
||||
|
||||
try {
|
||||
|
@ -215,25 +215,25 @@ void AsyncCompileShader(const Device& device, const std::string& shader_path,
|
|||
VkShaderModule raw_module = *shader;
|
||||
|
||||
// Submit callback to main thread via command queue for thread safety
|
||||
SubmitCommandToQueue([callback = std::move(callback), raw_module]() {
|
||||
callback(raw_module);
|
||||
SubmitCommandToQueue([inner_callback = std::move(outer_callback), raw_module]() {
|
||||
inner_callback(raw_module);
|
||||
});
|
||||
} else {
|
||||
LOG_ERROR(Render_Vulkan, "Shader validation failed: {}", shader_path);
|
||||
SubmitCommandToQueue([callback = std::move(callback)]() {
|
||||
callback(VK_NULL_HANDLE);
|
||||
SubmitCommandToQueue([inner_callback = std::move(outer_callback)]() {
|
||||
inner_callback(VK_NULL_HANDLE);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR(Render_Vulkan, "Failed to read shader file: {}", shader_path);
|
||||
SubmitCommandToQueue([callback = std::move(callback)]() {
|
||||
callback(VK_NULL_HANDLE);
|
||||
SubmitCommandToQueue([inner_callback = std::move(outer_callback)]() {
|
||||
inner_callback(VK_NULL_HANDLE);
|
||||
});
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
LOG_ERROR(Render_Vulkan, "Error compiling shader: {}", e.what());
|
||||
SubmitCommandToQueue([callback = std::move(callback)]() {
|
||||
callback(VK_NULL_HANDLE);
|
||||
SubmitCommandToQueue([inner_callback = std::move(outer_callback)]() {
|
||||
inner_callback(VK_NULL_HANDLE);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue