Add trace events on the creation of shader module and pipeline
This patch adds trace events on the creation of shader module, render pipeline and compute pipeline so that we can measure how expensive these tasks are in chrome://tracing BUG=dawn:1167 Change-Id: Iffc37adea49d7e04b9f757bc8b3679769085a428 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67880 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
parent
0040f77f0b
commit
b78e8fb8f6
|
@ -18,6 +18,8 @@
|
|||
#include "dawn_native/ComputePipeline.h"
|
||||
#include "dawn_native/Device.h"
|
||||
#include "dawn_native/RenderPipeline.h"
|
||||
#include "dawn_platform/DawnPlatform.h"
|
||||
#include "dawn_platform/tracing/TraceEvent.h"
|
||||
|
||||
namespace dawn_native {
|
||||
|
||||
|
@ -112,6 +114,10 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
void CreateComputePipelineAsyncTask::Run() {
|
||||
TRACE_EVENT_FLOW_END0(mComputePipeline->GetDevice()->GetPlatform(), General,
|
||||
"CreateComputePipelineAsyncTask::RunAsync", this);
|
||||
TRACE_EVENT0(mComputePipeline->GetDevice()->GetPlatform(), General,
|
||||
"CreateComputePipelineAsyncTask::Run");
|
||||
MaybeError maybeError = mComputePipeline->Initialize();
|
||||
std::string errorMessage;
|
||||
if (maybeError.IsError()) {
|
||||
|
@ -134,6 +140,8 @@ namespace dawn_native {
|
|||
std::unique_ptr<CreateComputePipelineAsyncTask> innnerTaskPtr(taskPtr);
|
||||
innnerTaskPtr->Run();
|
||||
};
|
||||
TRACE_EVENT_FLOW_BEGIN0(device->GetPlatform(), General,
|
||||
"CreateComputePipelineAsyncTask::RunAsync", task.get());
|
||||
device->GetAsyncTaskManager()->PostTask(std::move(asyncTask));
|
||||
}
|
||||
|
||||
|
@ -148,6 +156,10 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
void CreateRenderPipelineAsyncTask::Run() {
|
||||
TRACE_EVENT_FLOW_END0(mRenderPipeline->GetDevice()->GetPlatform(), General,
|
||||
"CreateRenderPipelineAsyncTask::RunAsync", this);
|
||||
TRACE_EVENT0(mRenderPipeline->GetDevice()->GetPlatform(), General,
|
||||
"CreateRenderPipelineAsyncTask::Run");
|
||||
MaybeError maybeError = mRenderPipeline->Initialize();
|
||||
std::string errorMessage;
|
||||
if (maybeError.IsError()) {
|
||||
|
@ -170,6 +182,8 @@ namespace dawn_native {
|
|||
std::unique_ptr<CreateRenderPipelineAsyncTask> innerTaskPtr(taskPtr);
|
||||
innerTaskPtr->Run();
|
||||
};
|
||||
TRACE_EVENT_FLOW_BEGIN0(device->GetPlatform(), General,
|
||||
"CreateRenderPipelineAsyncTask::RunAsync", task.get());
|
||||
device->GetAsyncTaskManager()->PostTask(std::move(asyncTask));
|
||||
}
|
||||
} // namespace dawn_native
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "dawn_native/Texture.h"
|
||||
#include "dawn_native/ValidationUtils_autogen.h"
|
||||
#include "dawn_platform/DawnPlatform.h"
|
||||
#include "dawn_platform/tracing/TraceEvent.h"
|
||||
|
||||
#include <array>
|
||||
#include <mutex>
|
||||
|
@ -897,6 +898,7 @@ namespace dawn_native {
|
|||
}
|
||||
ComputePipelineBase* DeviceBase::APICreateComputePipeline(
|
||||
const ComputePipelineDescriptor* descriptor) {
|
||||
TRACE_EVENT0(GetPlatform(), General, "DeviceBase::APICreateComputePipeline");
|
||||
Ref<ComputePipelineBase> result;
|
||||
if (ConsumedError(CreateComputePipeline(descriptor), &result,
|
||||
"calling CreateComputePipeline(%s).", descriptor)) {
|
||||
|
@ -907,6 +909,7 @@ namespace dawn_native {
|
|||
void DeviceBase::APICreateComputePipelineAsync(const ComputePipelineDescriptor* descriptor,
|
||||
WGPUCreateComputePipelineAsyncCallback callback,
|
||||
void* userdata) {
|
||||
TRACE_EVENT0(GetPlatform(), General, "DeviceBase::APICreateComputePipelineAsync");
|
||||
MaybeError maybeResult = CreateComputePipelineAsync(descriptor, callback, userdata);
|
||||
|
||||
// Call the callback directly when a validation error has been found in the front-end
|
||||
|
@ -946,6 +949,7 @@ namespace dawn_native {
|
|||
void DeviceBase::APICreateRenderPipelineAsync(const RenderPipelineDescriptor* descriptor,
|
||||
WGPUCreateRenderPipelineAsyncCallback callback,
|
||||
void* userdata) {
|
||||
TRACE_EVENT0(GetPlatform(), General, "DeviceBase::APICreateRenderPipelineAsync");
|
||||
// TODO(dawn:563): Add validation error context.
|
||||
MaybeError maybeResult = CreateRenderPipelineAsync(descriptor, callback, userdata);
|
||||
|
||||
|
@ -969,6 +973,7 @@ namespace dawn_native {
|
|||
}
|
||||
RenderPipelineBase* DeviceBase::APICreateRenderPipeline(
|
||||
const RenderPipelineDescriptor* descriptor) {
|
||||
TRACE_EVENT0(GetPlatform(), General, "DeviceBase::APICreateRenderPipeline");
|
||||
Ref<RenderPipelineBase> result;
|
||||
if (ConsumedError(CreateRenderPipeline(descriptor), &result,
|
||||
"calling CreateRenderPipeline(%s).", descriptor)) {
|
||||
|
@ -977,6 +982,7 @@ namespace dawn_native {
|
|||
return result.Detach();
|
||||
}
|
||||
ShaderModuleBase* DeviceBase::APICreateShaderModule(const ShaderModuleDescriptor* descriptor) {
|
||||
TRACE_EVENT0(GetPlatform(), General, "DeviceBase::APICreateShaderModule");
|
||||
Ref<ShaderModuleBase> result;
|
||||
std::unique_ptr<OwnedCompilationMessages> compilationMessages(
|
||||
std::make_unique<OwnedCompilationMessages>());
|
||||
|
|
Loading…
Reference in New Issue