From: Mikko Rasa Date: Tue, 11 Oct 2022 08:36:12 +0000 (+0300) Subject: Improve consistency of debug names X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=d6e8251bc39debb1566eede74338fb175f7e33ce;p=libs%2Fgl.git Improve consistency of debug names Hierarchies are now always denoted with a colon. Square brackets are used to add indexing-like details to child objects. --- diff --git a/source/animation/animation.cpp b/source/animation/animation.cpp index a79e1f8d..ea86f9a4 100644 --- a/source/animation/animation.cpp +++ b/source/animation/animation.cpp @@ -540,7 +540,7 @@ void Animation::Loader::load_kf_inline(bool c) if(coll) { KeyFrame::Loader ldr(*kf, get_collection()); - ldr.set_inline_base_name(format("%s/%d.kframe", FS::basename(get_source()), obj.keyframes.size())); + ldr.set_inline_base_name(format("%s: %d.kframe", FS::basename(get_source()), obj.keyframes.size())); load_sub_with(ldr); } else diff --git a/source/backends/opengl/framebuffer_backend.cpp b/source/backends/opengl/framebuffer_backend.cpp index 8ba947df..a81566b5 100644 --- a/source/backends/opengl/framebuffer_backend.cpp +++ b/source/backends/opengl/framebuffer_backend.cpp @@ -208,7 +208,7 @@ void OpenGLFramebuffer::set_debug_name(const string &name) glObjectLabel(GL_FRAMEBUFFER, id, name.size(), name.c_str()); if(resolve_id) { - string resolve_name = name+" [resolve]"; + string resolve_name = name+": resolve"; glObjectLabel(GL_FRAMEBUFFER, resolve_id, resolve_name.size(), resolve_name.c_str()); } } diff --git a/source/backends/opengl/program_backend.cpp b/source/backends/opengl/program_backend.cpp index 3ebb7da1..a4e2958b 100644 --- a/source/backends/opengl/program_backend.cpp +++ b/source/backends/opengl/program_backend.cpp @@ -550,7 +550,7 @@ void OpenGLProgram::set_debug_name(const string &name) void OpenGLProgram::set_stage_debug_name(unsigned stage_id, Stage type) { #ifdef DEBUG - static const char *const suffixes[] = { " [VS]", " [TCS]", " [TES]", " [GS]", " [FS]", " [CS]" }; + static const char *const suffixes[] = { ": VS", ": TCS", ": TES", ": GS", ": FS", ": CS" }; string name = debug_name+suffixes[type]; glObjectLabel(GL_SHADER, stage_id, name.size(), name.c_str()); #else diff --git a/source/backends/vulkan/program_backend.cpp b/source/backends/vulkan/program_backend.cpp index 10c04d83..52f49c49 100644 --- a/source/backends/vulkan/program_backend.cpp +++ b/source/backends/vulkan/program_backend.cpp @@ -203,7 +203,7 @@ void VulkanProgram::set_vulkan_object_name() const #ifdef DEBUG const VulkanFunctions &vk = device.get_functions(); - string layout_name = debug_name+" [layout]"; + string layout_name = debug_name+": layout"; VkDebugUtilsObjectNameInfoEXT name_info = { }; name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; @@ -215,7 +215,7 @@ void VulkanProgram::set_vulkan_object_name() const name_info.objectType = VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; for(unsigned i=0; i(desc_set_layout_handles[i]); name_info.pObjectName = layout_name.c_str(); vk.SetDebugUtilsObjectName(name_info); diff --git a/source/backends/vulkan/texture_backend.cpp b/source/backends/vulkan/texture_backend.cpp index db420991..b0ddb2ee 100644 --- a/source/backends/vulkan/texture_backend.cpp +++ b/source/backends/vulkan/texture_backend.cpp @@ -206,7 +206,7 @@ void VulkanTexture::set_vulkan_object_names() const name_info.pObjectName = debug_name.c_str(); vk.SetDebugUtilsObjectName(name_info); - string view_name = debug_name+"/view"; + string view_name = debug_name+": view"; name_info.objectType = VK_OBJECT_TYPE_IMAGE_VIEW; name_info.objectHandle = reinterpret_cast(view_handle); name_info.pObjectName = view_name.c_str(); @@ -216,7 +216,7 @@ void VulkanTexture::set_vulkan_object_names() const { for(unsigned i=0; i(mip_view_handles[i]); name_info.pObjectName = view_name.c_str(); vk.SetDebugUtilsObjectName(name_info); diff --git a/source/builders/sequencebuilder.cpp b/source/builders/sequencebuilder.cpp index 01208cf4..4a2c6f63 100644 --- a/source/builders/sequencebuilder.cpp +++ b/source/builders/sequencebuilder.cpp @@ -61,7 +61,7 @@ void SequenceBuilder::build(Sequence &sequence) const Effect *effect = r.effect_template->create(final_renderables); #ifdef DEBUG if(!debug_name.empty()) - effect->set_debug_name(format("%s/%s", debug_name, r.slot_name)); + effect->set_debug_name(format("%s: %s", debug_name, r.slot_name)); #endif ptr = effect; } @@ -70,7 +70,7 @@ void SequenceBuilder::build(Sequence &sequence) const Sequence *seq = new Sequence; #ifdef DEBUG if(!debug_name.empty()) - seq->set_debug_name(format("%s/%s", debug_name, r.slot_name)); + seq->set_debug_name(format("%s: %s", debug_name, r.slot_name)); #endif ptr = seq; sequences.push_back(&r); @@ -124,7 +124,7 @@ void SequenceBuilder::build(Sequence &sequence) const proc = p.postprocessor_template->create(sequence.get_width(), sequence.get_height()); #ifdef DEBUG if(!debug_name.empty()) - proc->set_debug_name(format("%s/%d.pproc", debug_name, index++)); + proc->set_debug_name(format("%s: pproc[%d]", debug_name, index++)); #endif } else diff --git a/source/builders/sequencetemplate.cpp b/source/builders/sequencetemplate.cpp index 2886e0a8..67948b8a 100644 --- a/source/builders/sequencetemplate.cpp +++ b/source/builders/sequencetemplate.cpp @@ -161,7 +161,7 @@ void SequenceTemplate::Loader::step(const string &tag, const string &rend) stp.tag = tag; stp.renderable_name = rend; Step::Loader ldr(stp, get_collection()); - ldr.set_inline_base_name(format("%s/%d.step", get_source(), obj.steps.size())); + ldr.set_inline_base_name(format("%s: step[%d]", get_source(), obj.steps.size())); load_sub_with(ldr); obj.steps.push_back(stp); diff --git a/source/core/mesh.cpp b/source/core/mesh.cpp index 360d588f..6218601e 100644 --- a/source/core/mesh.cpp +++ b/source/core/mesh.cpp @@ -71,7 +71,7 @@ void Mesh::check_buffers(unsigned mask) #ifdef DEBUG if(!debug_name.empty()) - vbuf->set_debug_name(debug_name+" [VBO]"); + vbuf->set_debug_name(debug_name+": VBO"); #endif } } @@ -89,7 +89,7 @@ void Mesh::check_buffers(unsigned mask) #ifdef DEBUG if(!debug_name.empty()) - vbuf->set_debug_name(debug_name+" [IBO]"); + vbuf->set_debug_name(debug_name+": IBO"); #endif } @@ -249,10 +249,10 @@ void Mesh::set_debug_name(const string &name) #ifdef DEBUG debug_name = name; if(vbuf) - vbuf->set_debug_name(name+" [VBO]"); + vbuf->set_debug_name(name+": VBO"); if(ibuf) - ibuf->set_debug_name(name+" [IBO]"); - vtx_setup.set_debug_name(name+" [VAO]"); + ibuf->set_debug_name(name+": IBO"); + vtx_setup.set_debug_name(name+": VAO"); #else (void)name; #endif diff --git a/source/effects/ambientocclusion.cpp b/source/effects/ambientocclusion.cpp index c7fff846..287dacf1 100644 --- a/source/effects/ambientocclusion.cpp +++ b/source/effects/ambientocclusion.cpp @@ -124,8 +124,8 @@ void AmbientOcclusion::render(Renderer &renderer, const Texture2D &color, const void AmbientOcclusion::set_debug_name(const string &name) { #ifdef DEBUG - occlude_target.set_debug_name(name+" [RT]"); - shdata.set_debug_name(name+" [UBO]"); + occlude_target.set_debug_name(name+": RT"); + shdata.set_debug_name(name+": UBO"); #else (void)name; #endif diff --git a/source/effects/bloom.cpp b/source/effects/bloom.cpp index b9b63bcb..fba608e7 100644 --- a/source/effects/bloom.cpp +++ b/source/effects/bloom.cpp @@ -87,10 +87,10 @@ void Bloom::set_debug_name(const string &name) { #ifdef DEBUG for(unsigned i=0; i<2; ++i) - target[i]->set_debug_name(format("%s [RT:%d]", name, i)); - common_shdata.set_debug_name(name+" [UBO:common]"); - blur_shdata[0].set_debug_name(name+" [UBO:blur_x]"); - blur_shdata[1].set_debug_name(name+" [UBO:blur_y]"); + target[i]->set_debug_name(format("%s: RT[%d]", name, i)); + common_shdata.set_debug_name(name+": UBO[common]"); + blur_shdata[0].set_debug_name(name+": UBO[blur_x]"); + blur_shdata[1].set_debug_name(name+": UBO[blur_y]"); #else (void)name; #endif diff --git a/source/effects/colorcurve.cpp b/source/effects/colorcurve.cpp index ac1ed9aa..ffc5497a 100644 --- a/source/effects/colorcurve.cpp +++ b/source/effects/colorcurve.cpp @@ -80,8 +80,8 @@ void ColorCurve::render(Renderer &renderer, const Texture2D &color_buf, const Te void ColorCurve::set_debug_name(const string &name) { #ifdef DEBUG - shdata.set_debug_name(name+" [UBO]"); - curve.set_debug_name(name+"/curve.tex"); + shdata.set_debug_name(name+": UBO"); + curve.set_debug_name(name+": curve.tex"); #else (void)name; #endif diff --git a/source/effects/environmentmap.cpp b/source/effects/environmentmap.cpp index a6cb6a36..c0bfc8a2 100644 --- a/source/effects/environmentmap.cpp +++ b/source/effects/environmentmap.cpp @@ -195,21 +195,21 @@ void EnvironmentMap::render(Renderer &renderer, Tag tag) const void EnvironmentMap::set_debug_name(const string &name) { #ifdef DEBUG - env_tex.set_debug_name(name+"/environment.tex"); - depth_buf.set_debug_name(name+"/environment_depth.rbuf"); + env_tex.set_debug_name(name+": environment.tex"); + depth_buf.set_debug_name(name+": environment_depth.tex"); static const char *const face_names[] = { "X+", "X-", "Y+", "Y-", "Z+", "Z-" }; for(unsigned i=0; i<6; ++i) { - faces[i].fbo.set_debug_name(format("%s [FBO:%s]", name, face_names[i])); - faces[i].camera.set_debug_name(format("%s/%s.camera", name, face_names[i])); + faces[i].fbo.set_debug_name(format("%s: FBO[%s]", name, face_names[i])); + faces[i].camera.set_debug_name(format("%s: %s.camera", name, face_names[i])); } - irradiance.set_debug_name(name+"/irradiance.tex"); - irradiance_fbo.set_debug_name(name+" [FBO:irradiance]"); + irradiance.set_debug_name(name+": irradiance.tex"); + irradiance_fbo.set_debug_name(name+": FBO[irradiance]"); for(unsigned i=0; iset_debug_name(name+" [UBO]"); + shdata->set_debug_name(name+": UBO"); #else (void)name; #endif diff --git a/source/materials/technique.cpp b/source/materials/technique.cpp index 163cbec6..92ccde46 100644 --- a/source/materials/technique.cpp +++ b/source/materials/technique.cpp @@ -99,7 +99,10 @@ void Technique::set_debug_name(const string &name) { #ifdef DEBUG for(auto &kvp: methods) - kvp.second.set_debug_name(format("%s [method:%s]", name, kvp.first.str())); + { + string n = kvp.first.str(); + kvp.second.set_debug_name(format("%s: method[%s]", name, (n.empty() ? "\"\"" : n.c_str()))); + } #else (void)name; #endif @@ -136,7 +139,8 @@ void Technique::Loader::method(const string &n) { RenderMethod p; RenderMethod::Loader ldr(p, get_collection()); - ldr.set_inline_base_name(format("%s/%s.method", (inline_base_name.empty() ? FS::basename(get_source()) : inline_base_name), n)); + ldr.set_inline_base_name(format("%s: method[%s]", + (inline_base_name.empty() ? FS::basename(get_source()) : inline_base_name), (n.empty() ? "\"\"" : n.c_str()))); load_sub_with(ldr); if(!p.get_shader_program()) diff --git a/source/render/camera.cpp b/source/render/camera.cpp index bc8de57e..67fa4f51 100644 --- a/source/render/camera.cpp +++ b/source/render/camera.cpp @@ -221,7 +221,7 @@ void Camera::update_frustum_planes() void Camera::set_debug_name(const string &name) { #ifdef DEBUG - shdata.set_debug_name(name+" [UBO]"); + shdata.set_debug_name(name+": UBO"); #else (void)name; #endif diff --git a/source/render/rendertarget.cpp b/source/render/rendertarget.cpp index 7eba2b2b..28fd5669 100644 --- a/source/render/rendertarget.cpp +++ b/source/render/rendertarget.cpp @@ -69,7 +69,7 @@ const Texture2D &RenderTarget::get_target_texture(FrameAttachment fa) const void RenderTarget::set_debug_name(const string &name) { #ifdef DEBUG - fbo.set_debug_name(name+" [FBO]"); + fbo.set_debug_name(name+": FBO"); bool multisample = (fbo.get_format().get_samples()>1); unsigned i = 0; for(FrameAttachment a: fbo.get_format()) @@ -78,11 +78,11 @@ void RenderTarget::set_debug_name(const string &name) string tex_name; if(attach_pt==get_attach_point(DEPTH_ATTACHMENT)) - tex_name = name+"/depth"; + tex_name = name+": depth"; else if(attach_pt==get_attach_point(STENCIL_ATTACHMENT)) - tex_name = name+"/stencil"; + tex_name = name+": stencil"; else - tex_name = Msp::format("%s/color%d", name, attach_pt); + tex_name = Msp::format("%s: color[%d]", name, attach_pt); textures[i++]->set_debug_name(tex_name+".tex"); if(multisample) diff --git a/source/render/sequence.cpp b/source/render/sequence.cpp index 4f10026a..a98ed508 100644 --- a/source/render/sequence.cpp +++ b/source/render/sequence.cpp @@ -171,9 +171,9 @@ void Sequence::set_debug_name(const string &name) #ifdef DEBUG for(unsigned i=0; i<2; ++i) if(target[i]) - target[i]->set_debug_name(format("%s [RT:%d]", name, i)); + target[i]->set_debug_name(format("%s: RT[%d]", name, i)); if(target_ms) - target_ms->set_debug_name(name+" [RT:ms]"); + target_ms->set_debug_name(name+": RT[ms]"); #else (void)name; #endif