Skip to content

Commit 767e6ea

Browse files
griffinkhakien-mga
authored andcommitted
Fix build warning with memset value being too large
Should resolve issue godotengine#83342 (cherry picked from commits b97cb5e and 21ae69a)
1 parent 0d89d76 commit 767e6ea

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

drivers/gles3/storage/texture_storage.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ void TextureStorage::update_texture_atlas() {
13941394
//generate atlas
13951395
Vector<TextureAtlas::SortItem> itemsv;
13961396
itemsv.resize(texture_atlas.textures.size());
1397-
int base_size = 8;
1397+
uint32_t base_size = 8;
13981398

13991399
int idx = 0;
14001400

@@ -1407,7 +1407,7 @@ void TextureStorage::update_texture_atlas() {
14071407
si.size.height = (src_tex->height / border) + 1;
14081408
si.pixel_size = Size2i(src_tex->width, src_tex->height);
14091409

1410-
if (base_size < si.size.width) {
1410+
if (base_size < (uint32_t)si.size.width) {
14111411
base_size = nearest_power_of_2_templated(si.size.width);
14121412
}
14131413

@@ -1438,7 +1438,7 @@ void TextureStorage::update_texture_atlas() {
14381438
TextureAtlas::SortItem &si = items[i];
14391439
int best_idx = -1;
14401440
int best_height = 0x7FFFFFFF;
1441-
for (int j = 0; j <= base_size - si.size.width; j++) {
1441+
for (uint32_t j = 0; j <= base_size - si.size.width; j++) {
14421442
int height = 0;
14431443
for (int k = 0; k < si.size.width; k++) {
14441444
int h = v_offsets[k + j];
@@ -1469,7 +1469,7 @@ void TextureStorage::update_texture_atlas() {
14691469
}
14701470
}
14711471

1472-
if (max_height <= base_size * 2) {
1472+
if ((uint32_t)max_height <= base_size * 2) {
14731473
atlas_height = max_height;
14741474
break; //good ratio, break;
14751475
}

servers/rendering/renderer_rd/storage_rd/texture_storage.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,7 +2084,7 @@ void TextureStorage::update_decal_atlas() {
20842084
//generate atlas
20852085
Vector<DecalAtlas::SortItem> itemsv;
20862086
itemsv.resize(decal_atlas.textures.size());
2087-
int base_size = 8;
2087+
uint32_t base_size = 8;
20882088

20892089
int idx = 0;
20902090

@@ -2097,7 +2097,7 @@ void TextureStorage::update_decal_atlas() {
20972097
si.size.height = (src_tex->height / border) + 1;
20982098
si.pixel_size = Size2i(src_tex->width, src_tex->height);
20992099

2100-
if (base_size < si.size.width) {
2100+
if (base_size < (uint32_t)si.size.width) {
21012101
base_size = nearest_power_of_2_templated(si.size.width);
21022102
}
21032103

@@ -2128,7 +2128,7 @@ void TextureStorage::update_decal_atlas() {
21282128
DecalAtlas::SortItem &si = items[i];
21292129
int best_idx = -1;
21302130
int best_height = 0x7FFFFFFF;
2131-
for (int j = 0; j <= base_size - si.size.width; j++) {
2131+
for (uint32_t j = 0; j <= base_size - si.size.width; j++) {
21322132
int height = 0;
21332133
for (int k = 0; k < si.size.width; k++) {
21342134
int h = v_offsets[k + j];
@@ -2159,7 +2159,7 @@ void TextureStorage::update_decal_atlas() {
21592159
}
21602160
}
21612161

2162-
if (max_height <= base_size * 2) {
2162+
if ((uint32_t)max_height <= base_size * 2) {
21632163
atlas_height = max_height;
21642164
break; //good ratio, break;
21652165
}

0 commit comments

Comments
 (0)