Skip to content

Commit 5708a3a

Browse files
committed
Merge pull request #92000 from clayjohn/vram-debugger
Increase coverage of VRAM debugger and add support to RD backends
2 parents 8663f27 + c84616c commit 5708a3a

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

drivers/gles3/storage/texture_storage.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ void TextureStorage::texture_debug_usage(List<RS::TextureInfo> *r_info) {
13911391
tinfo.format = t->format;
13921392
tinfo.width = t->alloc_width;
13931393
tinfo.height = t->alloc_height;
1394-
tinfo.depth = 0;
1394+
tinfo.depth = t->depth;
13951395
tinfo.bytes = t->total_data_size;
13961396
r_info->push_back(tinfo);
13971397
}

modules/noise/noise_texture_2d.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ void NoiseTexture2D::_set_texture_image(const Ref<Image> &p_image) {
119119
} else {
120120
texture = RS::get_singleton()->texture_2d_create(p_image);
121121
}
122+
RS::get_singleton()->texture_set_path(texture, get_path());
122123
}
123124
emit_changed();
124125
}

scene/resources/gradient_texture.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ void GradientTexture1D::_update() {
136136
texture = RS::get_singleton()->texture_2d_create(image);
137137
}
138138
}
139+
RS::get_singleton()->texture_set_path(texture, get_path());
139140
}
140141

141142
void GradientTexture1D::set_width(int p_width) {
@@ -275,6 +276,7 @@ void GradientTexture2D::_update() {
275276
} else {
276277
texture = RS::get_singleton()->texture_2d_create(image);
277278
}
279+
RS::get_singleton()->texture_set_path(texture, get_path());
278280
}
279281

280282
float GradientTexture2D::_get_gradient_offset_at(int x, int y) const {

servers/rendering/renderer_rd/storage_rd/texture_storage.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,23 @@ void TextureStorage::texture_set_detect_roughness_callback(RID p_texture, RS::Te
14571457
}
14581458

14591459
void TextureStorage::texture_debug_usage(List<RS::TextureInfo> *r_info) {
1460+
List<RID> textures;
1461+
texture_owner.get_owned_list(&textures);
1462+
1463+
for (List<RID>::Element *E = textures.front(); E; E = E->next()) {
1464+
Texture *t = texture_owner.get_or_null(E->get());
1465+
if (!t) {
1466+
continue;
1467+
}
1468+
RS::TextureInfo tinfo;
1469+
tinfo.path = t->path;
1470+
tinfo.format = t->format;
1471+
tinfo.width = t->width;
1472+
tinfo.height = t->height;
1473+
tinfo.depth = t->depth;
1474+
tinfo.bytes = Image::get_image_data_size(t->width, t->height, t->format, t->mipmaps);
1475+
r_info->push_back(tinfo);
1476+
}
14601477
}
14611478

14621479
void TextureStorage::texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) {
@@ -3042,6 +3059,7 @@ void TextureStorage::_update_render_target(RenderTarget *rt) {
30423059
texture_2d_placeholder_initialize(rt->texture);
30433060
Texture *tex = get_texture(rt->texture);
30443061
tex->is_render_target = true;
3062+
tex->path = "Render Target (Internal)";
30453063
}
30463064

30473065
_clear_render_target(rt);

0 commit comments

Comments
 (0)