diff --git a/drivers/gles3/shaders/ssao_blur.glsl b/drivers/gles3/shaders/ssao_blur.glsl index ff852487c0bb..ce4154f50cc6 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 25ab767bedcd..33d271248cfb 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -256,6 +256,7 @@ static Ref _load_mem_png(const uint8_t *p_png, int p_size) { static Ref _lossless_unpack_png(const PoolVector &p_data) { int len = p_data.size(); + ERR_FAIL_COND_V(len < 4, Ref()); PoolVector::Read r = p_data.read(); ERR_FAIL_COND_V(r[0] != 'P' || r[1] != 'N' || r[2] != 'G' || r[3] != ' ', Ref()); 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 efed0b866535..e927f1ceaad4 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 3542b8b87615..2acbed3b4ea0 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -909,10 +909,11 @@ Vector GIProbe::_get_bake_texture(Ref 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 bc8deb501e54..68a11b821d33 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();