Skip to content

Commit

Permalink
Merge pull request #92000 from clayjohn/vram-debugger
Browse files Browse the repository at this point in the history
Increase coverage of VRAM debugger and add support to RD backends
  • Loading branch information
akien-mga committed May 16, 2024
2 parents 8663f27 + c84616c commit 5708a3a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gles3/storage/texture_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ 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 = 0;
tinfo.depth = t->depth;
tinfo.bytes = t->total_data_size;
r_info->push_back(tinfo);
}
Expand Down
1 change: 1 addition & 0 deletions modules/noise/noise_texture_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ void NoiseTexture2D::_set_texture_image(const Ref<Image> &p_image) {
} else {
texture = RS::get_singleton()->texture_2d_create(p_image);
}
RS::get_singleton()->texture_set_path(texture, get_path());
}
emit_changed();
}
Expand Down
2 changes: 2 additions & 0 deletions scene/resources/gradient_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void GradientTexture1D::_update() {
texture = RS::get_singleton()->texture_2d_create(image);
}
}
RS::get_singleton()->texture_set_path(texture, get_path());
}

void GradientTexture1D::set_width(int p_width) {
Expand Down Expand Up @@ -275,6 +276,7 @@ void GradientTexture2D::_update() {
} else {
texture = RS::get_singleton()->texture_2d_create(image);
}
RS::get_singleton()->texture_set_path(texture, get_path());
}

float GradientTexture2D::_get_gradient_offset_at(int x, int y) const {
Expand Down
18 changes: 18 additions & 0 deletions servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,23 @@ void TextureStorage::texture_set_detect_roughness_callback(RID p_texture, RS::Te
}

void TextureStorage::texture_debug_usage(List<RS::TextureInfo> *r_info) {
List<RID> textures;
texture_owner.get_owned_list(&textures);

for (List<RID>::Element *E = textures.front(); E; E = E->next()) {
Texture *t = texture_owner.get_or_null(E->get());
if (!t) {
continue;
}
RS::TextureInfo tinfo;
tinfo.path = t->path;
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);
r_info->push_back(tinfo);
}
}

void TextureStorage::texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) {
Expand Down Expand Up @@ -3042,6 +3059,7 @@ void TextureStorage::_update_render_target(RenderTarget *rt) {
texture_2d_placeholder_initialize(rt->texture);
Texture *tex = get_texture(rt->texture);
tex->is_render_target = true;
tex->path = "Render Target (Internal)";
}

_clear_render_target(rt);
Expand Down

0 comments on commit 5708a3a

Please sign in to comment.