aboutsummaryrefslogtreecommitdiff
path: root/src/shader_recompiler/ir_opt/texture_pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/ir_opt/texture_pass.cpp')
-rw-r--r--src/shader_recompiler/ir_opt/texture_pass.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp
index db8f1ac716..b33700cabd 100644
--- a/src/shader_recompiler/ir_opt/texture_pass.cpp
+++ b/src/shader_recompiler/ir_opt/texture_pass.cpp
@@ -16,6 +16,7 @@
#include <limits>
#include <boost/container/small_vector.hpp>
+#include "common/scope_exit.h"
#include "common/settings.h"
#include "shader_recompiler/environment.h"
#include "shader_recompiler/frontend/ir/basic_block.h"
@@ -455,6 +456,12 @@ bool BuildHandleProgram(const IR::Value& value, std::vector<u32>& code, int& bud
if (outermost) {
g_handle_slots.clear();
}
+ SCOPE_EXIT {
+ --g_handle_depth;
+ if (outermost) {
+ g_handle_slots.clear();
+ }
+ };
const IR::Inst* const inst{value.InstRecursive()};
bool result;
if (const auto it = g_handle_slots.find(inst); it != g_handle_slots.end()) {
@@ -484,10 +491,6 @@ bool BuildHandleProgram(const IR::Value& value, std::vector<u32>& code, int& bud
code.push_back(slot);
}
}
- --g_handle_depth;
- if (outermost) {
- g_handle_slots.clear();
- }
return result;
}