summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gles3/shaders/ssao_blur.glsl2
-rw-r--r--drivers/png/image_loader_png.cpp1
-rw-r--r--modules/squish/image_compress_squish.cpp4
-rw-r--r--scene/3d/gi_probe.cpp7
-rw-r--r--scene/resources/texture.cpp4
5 files changed, 10 insertions, 8 deletions
diff --git a/drivers/gles3/shaders/ssao_blur.glsl b/drivers/gles3/shaders/ssao_blur.glsl
index ff852487c0..ce4154f50c 100644
--- a/drivers/gles3/shaders/ssao_blur.glsl
+++ b/drivers/gles3/shaders/ssao_blur.glsl
@@ -24,7 +24,7 @@ layout(location = 0) out float visibility;
// Tunable Parameters:
/** Increase to make depth edges crisper. Decrease to reduce flicker. */
-#define EDGE_SHARPNESS (1.0)
+#define EDGE_SHARPNESS (4.0)
/** Step in 2-pixel intervals since we already blurred against neighbors in the
first AO pass. This constant can be increased while R decreases to improve
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index 25ab767bed..33d271248c 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -256,6 +256,7 @@ static Ref<Image> _load_mem_png(const uint8_t *p_png, int p_size) {
static Ref<Image> _lossless_unpack_png(const PoolVector<uint8_t> &p_data) {
int len = p_data.size();
+ ERR_FAIL_COND_V(len < 4, Ref<Image>());
PoolVector<uint8_t>::Read r = p_data.read();
ERR_FAIL_COND_V(r[0] != 'P' || r[1] != 'N' || r[2] != 'G' || r[3] != ' ', Ref<Image>());
return _load_mem_png(&r[4], len - 4);
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index efed0b8665..e927f1ceaa 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -153,8 +153,8 @@ void image_compress_squish(Image *p_image, bool p_srgb) {
int bh = h % 4 != 0 ? h + (4 - h % 4) : h;
int src_ofs = p_image->get_mipmap_offset(i);
- squish::CompressImage(&rb[src_ofs], bw, bh, &wb[dst_ofs], squish_comp);
- dst_ofs += (MAX(4, w) * MAX(4, h)) >> shift;
+ squish::CompressImage(&rb[src_ofs], w, h, &wb[dst_ofs], squish_comp);
+ dst_ofs += (MAX(4, bw) * MAX(4, bh)) >> shift;
w >>= 1;
h >>= 1;
}
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index 3542b8b876..2acbed3b4e 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -909,10 +909,11 @@ Vector<Color> GIProbe::_get_bake_texture(Ref<Image> p_image, const Color &p_colo
for (int i = 0; i < bake_texture_size * bake_texture_size; i++) {
Color c;
- c.r = r[i * 4 + 0] / 255.0;
- c.g = r[i * 4 + 1] / 255.0;
- c.b = r[i * 4 + 2] / 255.0;
+ c.r = (r[i * 4 + 0] / 255.0) * p_color.r;
+ c.g = (r[i * 4 + 1] / 255.0) * p_color.g;
+ c.b = (r[i * 4 + 2] / 255.0) * p_color.b;
c.a = r[i * 4 + 3] / 255.0;
+
ret[i] = c;
}
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index bc8deb501e..68a11b821d 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -494,9 +494,9 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
img = Image::lossy_unpacker(pv);
}
- if (img.is_null()) {
+ if (img.is_null() || img->empty()) {
memdelete(f);
- ERR_FAIL_COND_V(img->empty(), ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V(img.is_null() || img->empty(), ERR_FILE_CORRUPT);
}
total_size += img->get_data().size();