Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Impeller] Add debug names to additional VK objects
  • Loading branch information
iskakaushik committed Nov 14, 2022
commit 507245d8c2bec44463b75c5e0d95e49a8243101f
15 changes: 10 additions & 5 deletions impeller/renderer/backend/vulkan/context_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,21 @@ class ContextVK final : public Context, public BackendCast<ContextVK, Context> {

template <typename T>
bool SetDebugName(T handle, std::string_view label) const {
return SetDebugName(*device_, handle, label);
}

template <typename T>
static bool SetDebugName(vk::Device dev, T handle, std::string_view label) {
uint64_t handle_ptr =
reinterpret_cast<uint64_t>(static_cast<typename T::NativeType>(handle));

std::string label_str = std::string(label);

auto ret = device_->setDebugUtilsObjectNameEXT(
vk::DebugUtilsObjectNameInfoEXT()
.setObjectType(T::objectType)
.setObjectHandle(handle_ptr)
.setPObjectName(label_str.c_str()));
auto ret =
dev.setDebugUtilsObjectNameEXT(vk::DebugUtilsObjectNameInfoEXT()
.setObjectType(T::objectType)
.setObjectHandle(handle_ptr)
.setPObjectName(label_str.c_str()));

if (ret != vk::Result::eSuccess) {
VALIDATION_LOG << "unable to set debug name";
Expand Down
8 changes: 8 additions & 0 deletions impeller/renderer/backend/vulkan/pipeline_library_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "flutter/fml/trace_event.h"
#include "impeller/base/promise.h"
#include "impeller/base/validation.h"
#include "impeller/renderer/backend/vulkan/context_vk.h"
#include "impeller/renderer/backend/vulkan/formats_vk.h"
#include "impeller/renderer/backend/vulkan/pipeline_vk.h"
#include "impeller/renderer/backend/vulkan/shader_function_vk.h"
Expand Down Expand Up @@ -372,6 +373,8 @@ std::unique_ptr<PipelineCreateInfoVK> PipelineLibraryVK::CreatePipeline(

vk::UniqueDescriptorSetLayout descriptor_set_layout =
std::move(descriptor_set_create_res.value);
ContextVK::SetDebugName(device_, descriptor_set_layout.get(),
"descriptor_set_layout_" + desc.GetLabel());

vk::PipelineLayoutCreateInfo pipeline_layout_info;
pipeline_layout_info.setSetLayouts(descriptor_set_layout.get());
Expand Down Expand Up @@ -403,6 +406,11 @@ std::unique_ptr<PipelineCreateInfoVK> PipelineLibraryVK::CreatePipeline(
return nullptr;
}

ContextVK::SetDebugName(device_, *pipeline_layout.value,
"pipeline_layout_" + desc.GetLabel());
ContextVK::SetDebugName(device_, *pipeline.value,
"pipeline_" + desc.GetLabel());

return std::make_unique<PipelineCreateInfoVK>(
std::move(pipeline.value), std::move(render_pass.value()),
std::move(pipeline_layout.value), std::move(descriptor_set_layout));
Expand Down
13 changes: 9 additions & 4 deletions impeller/renderer/backend/vulkan/shader_library_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "flutter/fml/logging.h"
#include "flutter/fml/trace_event.h"
#include "impeller/blobcat/blob_library.h"
#include "impeller/renderer/backend/vulkan/context_vk.h"
#include "impeller/renderer/backend/vulkan/shader_function_vk.h"

namespace impeller {
Expand Down Expand Up @@ -80,11 +81,15 @@ ShaderLibraryVK::ShaderLibraryVK(
const auto stage = ToShaderStage(type);
const auto key_name = VKShaderNameToShaderKeyName(name, stage);

vk::UniqueShaderModule shader_module = std::move(module.value);
ContextVK::SetDebugName(device, *shader_module,
"shader_module_" + key_name);

functions[ShaderKey{key_name, stage}] = std::shared_ptr<ShaderFunctionVK>(
new ShaderFunctionVK(library_id, //
key_name, //
stage, //
std::move(module.value) //
new ShaderFunctionVK(library_id, //
key_name, //
stage, //
std::move(shader_module) //
));

return true;
Expand Down