summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp')
-rw-r--r--3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp
index 87d2c4c089f..e9b8087489c 100644
--- a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp
+++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp
@@ -27,7 +27,6 @@ namespace {
const uint32_t kExtractCompositeIdInIdx = 0;
const uint32_t kVariableStorageClassInIdx = 0;
const uint32_t kLoadPointerInIdx = 0;
-const double kThreshold = 0.9;
} // namespace
@@ -151,6 +150,8 @@ bool ReduceLoadSize::ShouldReplaceExtract(Instruction* inst) {
bool should_replace = false;
if (all_elements_used) {
should_replace = false;
+ } else if (1.0 <= replacement_threshold_) {
+ should_replace = true;
} else {
analysis::ConstantManager* const_mgr = context()->get_constant_mgr();
analysis::TypeManager* type_mgr = context()->get_type_mgr();
@@ -172,7 +173,7 @@ bool ReduceLoadSize::ShouldReplaceExtract(Instruction* inst) {
}
double percent_used = static_cast<double>(elements_used.size()) /
static_cast<double>(total_size);
- should_replace = (percent_used < kThreshold);
+ should_replace = (percent_used < replacement_threshold_);
}
should_replace_cache_[op_inst->result_id()] = should_replace;