Adds pass labels into the commands and plumbs through for Metal.

Bug: dawn:1784
Change-Id: Ie71360d83c4f3c47821916ebf8a187662e3f286f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131100
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Loko Kung 2023-05-03 07:33:18 +00:00 committed by Dawn LUCI CQ
parent 2552dd3c9f
commit 2966d3ad08
3 changed files with 7 additions and 0 deletions

View File

@ -764,6 +764,7 @@ Ref<ComputePassEncoder> CommandEncoder::BeginComputePass(const ComputePassDescri
if (descriptor == nullptr) {
return {};
}
cmd->label = std::string(descriptor->label ? descriptor->label : "");
// Record timestamp writes at the beginning and end of compute pass. The timestamp write
// at the end also be needed in BeginComputePassCmd because it's required by compute
@ -839,6 +840,7 @@ Ref<RenderPassEncoder> CommandEncoder::BeginRenderPass(const RenderPassDescripto
mEncodingContext.WillBeginRenderPass();
BeginRenderPassCmd* cmd =
allocator->Allocate<BeginRenderPassCmd>(Command::BeginRenderPass);
cmd->label = std::string(descriptor->label ? descriptor->label : "");
cmd->attachmentState = device->GetOrCreateAttachmentState(descriptor);
attachmentState = cmd->attachmentState;

View File

@ -17,6 +17,7 @@
#include <array>
#include <bitset>
#include <string>
#include <vector>
#include "dawn/common/Constants.h"
@ -83,6 +84,7 @@ struct BeginComputePassCmd {
TimestampWrite beginTimestamp;
TimestampWrite endTimestamp;
std::string label;
};
struct BeginOcclusionQueryCmd {
@ -135,6 +137,7 @@ struct BeginRenderPassCmd {
Ref<QuerySetBase> occlusionQuerySet;
TimestampWrite beginTimestamp;
TimestampWrite endTimestamp;
std::string label;
};
struct BufferCopy {

View File

@ -1227,6 +1227,7 @@ MaybeError CommandBuffer::EncodeComputePass(CommandRecordingContext* commandCont
}
}
}
SetDebugName(GetDevice(), encoder, "Dawn_ComputePassEncoder", computePassCmd->label);
Command type;
while (mCommands.NextCommandId(&type)) {
@ -1388,6 +1389,7 @@ MaybeError CommandBuffer::EncodeRenderPass(id<MTLRenderCommandEncoder> encoder,
withBarrier:YES];
}
}
SetDebugName(GetDevice(), encoder, "Dawn_RenderPassEncoder", renderPassCmd->label);
auto EncodeRenderBundleCommand = [&](CommandIterator* iter, Command type) {
switch (type) {