Merge pull request #46904 from lawnjelly/ewok_diagnose_more

Batching - more frame diagnose information
This commit is contained in:
Rémi Verschelde 2021-03-11 21:13:09 +01:00 committed by GitHub
commit 80d75b966c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 10 deletions

View file

@ -1942,12 +1942,9 @@ void RasterizerCanvasGLES2::render_joined_item(const BItemJoined &p_bij, RenderI
storage->info.render._2d_item_count++;
#ifdef DEBUG_ENABLED
#if defined(TOOLS_ENABLED) && defined(DEBUG_ENABLED)
if (bdata.diagnose_frame) {
bdata.frame_string += "\tjoined_item " + itos(p_bij.num_item_refs) + " refs\n";
if (p_bij.z_index != 0) {
bdata.frame_string += "\t\t(z " + itos(p_bij.z_index) + ")\n";
}
bdata.frame_string += _diagnose_make_item_joined_string(p_bij);
}
#endif

View file

@ -1194,12 +1194,9 @@ void RasterizerCanvasGLES3::render_batches(Item::Command *const *p_commands, Ite
void RasterizerCanvasGLES3::render_joined_item(const BItemJoined &p_bij, RenderItemState &r_ris) {
storage->info.render._2d_item_count++;
#ifdef DEBUG_ENABLED
#if defined(TOOLS_ENABLED) && defined(DEBUG_ENABLED)
if (bdata.diagnose_frame) {
bdata.frame_string += "\tjoined_item " + itos(p_bij.num_item_refs) + " refs\n";
if (p_bij.z_index != 0) {
bdata.frame_string += "\t\t(z " + itos(p_bij.z_index) + ")\n";
}
bdata.frame_string += _diagnose_make_item_joined_string(p_bij);
}
#endif

View file

@ -41,6 +41,54 @@ void _debug_write_garbage() {
#endif
}
String _diagnose_make_item_joined_string(const BItemJoined &p_bij) const {
String sz;
if (p_bij.use_hardware_transform()) {
sz = "hxform";
} else {
sz = "sxform";
}
sz += _diagnose_batch_flags_to_string(p_bij.flags);
String sz_long;
sz_long = "\tjoined_item " + itos(p_bij.num_item_refs) + " refs, " + sz + "\n";
if (p_bij.z_index != 0) {
sz_long += "\t\t(z " + itos(p_bij.z_index) + ")\n";
}
return sz_long;
}
String _diagnose_batch_flags_to_string(uint32_t p_flags) const {
String sz;
if (p_flags) {
sz += " ( ";
}
if (p_flags & RasterizerStorageCommon::PREVENT_COLOR_BAKING) {
sz += "prevent_color_baking, ";
}
if (p_flags & RasterizerStorageCommon::PREVENT_VERTEX_BAKING) {
sz += "prevent_vertex_baking, ";
}
if (p_flags & RasterizerStorageCommon::PREVENT_ITEM_JOINING) {
sz += "prevent_item_joining, ";
}
if (p_flags & RasterizerStorageCommon::USE_MODULATE_FVF) {
sz += "use_modulate_fvf, ";
}
if (p_flags & RasterizerStorageCommon::USE_LARGE_FVF) {
sz += "use_large_fvf, ";
}
if (p_flags) {
sz += " )";
}
return sz;
}
String get_command_type_string(const RasterizerCanvas::Item::Command &p_command) const {
String sz = "";
@ -86,6 +134,8 @@ String get_command_type_string(const RasterizerCanvas::Item::Command &p_command)
sz += " ";
sz += String(Variant(mat.elements[2]));
sz += String(Variant(mat.elements[0]));
sz += String(Variant(mat.elements[1]));
sz += " ";
} break;
case RasterizerCanvas::Item::Command::TYPE_CLIP_IGNORE: {