metal: Add shader module labels to trace events
Add label to ShaderModuleMTL CreateFunction and fix the trace event for
CreatePipelineAsyncEvent.
Bug: chromium:335052790
Change-Id: I75cefb685ebd067242fb9d84d4c3d8307982c4cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/185960
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/native/CreatePipelineAsyncEvent.cpp b/src/dawn/native/CreatePipelineAsyncEvent.cpp
index e781d83..6dcb621 100644
--- a/src/dawn/native/CreatePipelineAsyncEvent.cpp
+++ b/src/dawn/native/CreatePipelineAsyncEvent.cpp
@@ -132,14 +132,14 @@
void CreatePipelineAsyncEvent<PipelineType, CreatePipelineAsyncCallbackInfo>::InitializeImpl(
bool isAsync) {
DeviceBase* device = mPipeline->GetDevice();
+ const char* eventLabel = utils::GetLabelForTrace(mPipeline->GetLabel().c_str());
if (isAsync) {
- const char* eventLabel = utils::GetLabelForTrace(mPipeline->GetLabel().c_str());
TRACE_EVENT_FLOW_END1(device->GetPlatform(), General,
"CreatePipelineAsyncEvent::InitializeAsync", this, "label",
eventLabel);
- TRACE_EVENT1(device->GetPlatform(), General, "CreatePipelineAsyncEvent::Initialize",
- "label", eventLabel);
}
+ TRACE_EVENT1(device->GetPlatform(), General, "CreatePipelineAsyncEvent::InitializeImpl",
+ "label", eventLabel);
MaybeError maybeError;
{
diff --git a/src/dawn/native/metal/ShaderModuleMTL.mm b/src/dawn/native/metal/ShaderModuleMTL.mm
index f6e6890..1727257 100644
--- a/src/dawn/native/metal/ShaderModuleMTL.mm
+++ b/src/dawn/native/metal/ShaderModuleMTL.mm
@@ -39,6 +39,7 @@
#include "dawn/native/metal/UtilsMetal.h"
#include "dawn/native/stream/BlobSource.h"
#include "dawn/native/stream/ByteVectorSink.h"
+#include "dawn/native/utils/WGPUHelpers.h"
#include "dawn/platform/DawnPlatform.h"
#include "dawn/platform/metrics/HistogramMacros.h"
#include "dawn/platform/tracing/TraceEvent.h"
@@ -392,7 +393,8 @@
uint32_t sampleMask,
const RenderPipeline* renderPipeline,
std::optional<uint32_t> maxSubgroupSizeForFullSubgroups) {
- TRACE_EVENT0(GetDevice()->GetPlatform(), General, "ShaderModuleMTL::CreateFunction");
+ TRACE_EVENT1(GetDevice()->GetPlatform(), General, "metal::ShaderModule::CreateFunction",
+ "label", utils::GetLabelForTrace(GetLabel().c_str()));
DAWN_ASSERT(!IsError());
DAWN_ASSERT(out);