mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
Merge pull request #96128 from BlueCube3310/vram-profiler-texture-mem
Fix incorrect parameters for layered textures in VRAM texture memory profiler
This commit is contained in:
commit
f50ead48b0
@ -1389,8 +1389,22 @@ void TextureStorage::texture_debug_usage(List<RS::TextureInfo> *r_info) {
|
||||
tinfo.format = t->format;
|
||||
tinfo.width = t->alloc_width;
|
||||
tinfo.height = t->alloc_height;
|
||||
tinfo.depth = t->depth;
|
||||
tinfo.bytes = t->total_data_size;
|
||||
|
||||
switch (t->type) {
|
||||
case Texture::TYPE_3D:
|
||||
tinfo.depth = t->depth;
|
||||
break;
|
||||
|
||||
case Texture::TYPE_LAYERED:
|
||||
tinfo.depth = t->layers;
|
||||
break;
|
||||
|
||||
default:
|
||||
tinfo.depth = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
r_info->push_back(tinfo);
|
||||
}
|
||||
}
|
||||
@ -1521,7 +1535,11 @@ void TextureStorage::_texture_set_data(RID p_texture, const Ref<Image> &p_image,
|
||||
h = MAX(1, h >> 1);
|
||||
}
|
||||
|
||||
texture->total_data_size = tsize;
|
||||
if (texture->target == GL_TEXTURE_CUBE_MAP || texture->target == GL_TEXTURE_2D_ARRAY) {
|
||||
texture->total_data_size = tsize * texture->layers;
|
||||
} else {
|
||||
texture->total_data_size = tsize;
|
||||
}
|
||||
|
||||
texture->stored_cube_sides |= (1 << p_layer);
|
||||
|
||||
|
@ -1470,8 +1470,24 @@ void TextureStorage::texture_debug_usage(List<RS::TextureInfo> *r_info) {
|
||||
tinfo.format = t->format;
|
||||
tinfo.width = t->width;
|
||||
tinfo.height = t->height;
|
||||
tinfo.depth = t->depth;
|
||||
tinfo.bytes = Image::get_image_data_size(t->width, t->height, t->format, t->mipmaps);
|
||||
tinfo.bytes = Image::get_image_data_size(t->width, t->height, t->format, t->mipmaps > 1);
|
||||
|
||||
switch (t->type) {
|
||||
case TextureType::TYPE_3D:
|
||||
tinfo.depth = t->depth;
|
||||
tinfo.bytes *= t->depth;
|
||||
break;
|
||||
|
||||
case TextureType::TYPE_LAYERED:
|
||||
tinfo.depth = t->layers;
|
||||
tinfo.bytes *= t->layers;
|
||||
break;
|
||||
|
||||
default:
|
||||
tinfo.depth = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
r_info->push_back(tinfo);
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public:
|
||||
uint32_t height;
|
||||
uint32_t depth;
|
||||
Image::Format format;
|
||||
int bytes;
|
||||
int64_t bytes;
|
||||
String path;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user