summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-02-23 12:07:48 +0100
committerRémi Verschelde <rverschelde@gmail.com>2019-02-23 12:08:21 +0100
commit24097811e498afafdd7bb4d012d0b8759d0115e7 (patch)
treec1fdc77b1ac42d85384401fedc793cdee08f5495
parentfa51a98284500d9d8c21731a834a6adfa95c9689 (diff)
Fix invalid change from CLAMP to MAX in #26099
CLAMP limits the value between the two bounds, so for unsigned ints it should be replaced by MIN(val, max), not MAX. The issue in voxel_light_baker.cpp was fixed in 4f697f7. Fixes #26170.
-rw-r--r--servers/visual/visual_server_scene.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 01d00ccc21..42be56cfdd 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -2480,7 +2480,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) {
uint32_t a = uint32_t(alpha_block[x][y]) - min_alpha;
//convert range to 3 bits
a = int((a * 7.0 / (max_alpha - min_alpha)) + 0.5);
- a = MAX(a, 7); //just to be sure
+ a = MIN(a, 7); //just to be sure
a = 7 - a; //because range is inverted in this mode
if (a == 0) {
//do none, remain
@@ -2924,10 +2924,10 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) {
uint32_t mm_ofs = sizes[0] * sizes[1] * (local_data[idx].pos[2]) + sizes[0] * (local_data[idx].pos[1]) + (local_data[idx].pos[0]);
mm_ofs *= 4; //for RGBA (4 bytes)
- mipmapw[mm_ofs + 0] = uint8_t(MAX(r2, 255));
- mipmapw[mm_ofs + 1] = uint8_t(MAX(g, 255));
- mipmapw[mm_ofs + 2] = uint8_t(MAX(b, 255));
- mipmapw[mm_ofs + 3] = uint8_t(MAX(a, 255));
+ mipmapw[mm_ofs + 0] = uint8_t(MIN(r2, 255));
+ mipmapw[mm_ofs + 1] = uint8_t(MIN(g, 255));
+ mipmapw[mm_ofs + 2] = uint8_t(MIN(b, 255));
+ mipmapw[mm_ofs + 3] = uint8_t(MIN(a, 255));
}
}
} else if (probe_data->dynamic.compression == RasterizerStorage::GI_PROBE_S3TC) {