Handle debug markers commands for compute pass encoder
This CL makes sure debug markers commands are handled not only for render pass encoder, but also compute pass encoder. Bug: dawn:44 Change-Id: Iad1865d7c20e36d580e1f3f16496e4b90cc1ff34 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9680 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
ae7e0026a5
commit
e58fbc48b8
|
@ -812,6 +812,42 @@ namespace dawn_native { namespace d3d12 {
|
|||
cmd->dynamicOffsetCount, dynamicOffsets);
|
||||
} break;
|
||||
|
||||
case Command::InsertDebugMarker: {
|
||||
InsertDebugMarkerCmd* cmd = mCommands.NextCommand<InsertDebugMarkerCmd>();
|
||||
const char* label = mCommands.NextData<char>(cmd->length + 1);
|
||||
|
||||
if (ToBackend(GetDevice())->GetFunctions()->isPIXEventRuntimeLoaded()) {
|
||||
// PIX color is 1 byte per channel in ARGB format
|
||||
constexpr uint64_t kPIXBlackColor = 0xff000000;
|
||||
ToBackend(GetDevice())
|
||||
->GetFunctions()
|
||||
->pixSetMarkerOnCommandList(commandList.Get(), kPIXBlackColor, label);
|
||||
}
|
||||
} break;
|
||||
|
||||
case Command::PopDebugGroup: {
|
||||
mCommands.NextCommand<PopDebugGroupCmd>();
|
||||
|
||||
if (ToBackend(GetDevice())->GetFunctions()->isPIXEventRuntimeLoaded()) {
|
||||
ToBackend(GetDevice())
|
||||
->GetFunctions()
|
||||
->pixEndEventOnCommandList(commandList.Get());
|
||||
}
|
||||
} break;
|
||||
|
||||
case Command::PushDebugGroup: {
|
||||
PushDebugGroupCmd* cmd = mCommands.NextCommand<PushDebugGroupCmd>();
|
||||
const char* label = mCommands.NextData<char>(cmd->length + 1);
|
||||
|
||||
if (ToBackend(GetDevice())->GetFunctions()->isPIXEventRuntimeLoaded()) {
|
||||
// PIX color is 1 byte per channel in ARGB format
|
||||
constexpr uint64_t kPIXBlackColor = 0xff000000;
|
||||
ToBackend(GetDevice())
|
||||
->GetFunctions()
|
||||
->pixBeginEventOnCommandList(commandList.Get(), kPIXBlackColor, label);
|
||||
}
|
||||
} break;
|
||||
|
||||
default: { UNREACHABLE(); } break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -660,6 +660,30 @@ namespace dawn_native { namespace metal {
|
|||
encoder);
|
||||
} break;
|
||||
|
||||
case Command::InsertDebugMarker: {
|
||||
InsertDebugMarkerCmd* cmd = mCommands.NextCommand<InsertDebugMarkerCmd>();
|
||||
char* label = mCommands.NextData<char>(cmd->length + 1);
|
||||
NSString* mtlLabel = [[NSString alloc] initWithUTF8String:label];
|
||||
|
||||
[encoder insertDebugSignpost:mtlLabel];
|
||||
[mtlLabel release];
|
||||
} break;
|
||||
|
||||
case Command::PopDebugGroup: {
|
||||
mCommands.NextCommand<PopDebugGroupCmd>();
|
||||
|
||||
[encoder popDebugGroup];
|
||||
} break;
|
||||
|
||||
case Command::PushDebugGroup: {
|
||||
PushDebugGroupCmd* cmd = mCommands.NextCommand<PushDebugGroupCmd>();
|
||||
char* label = mCommands.NextData<char>(cmd->length + 1);
|
||||
NSString* mtlLabel = [[NSString alloc] initWithUTF8String:label];
|
||||
|
||||
[encoder pushDebugGroup:mtlLabel];
|
||||
[mtlLabel release];
|
||||
} break;
|
||||
|
||||
default: { UNREACHABLE(); } break;
|
||||
}
|
||||
}
|
||||
|
@ -847,7 +871,7 @@ namespace dawn_native { namespace metal {
|
|||
|
||||
case Command::InsertDebugMarker: {
|
||||
InsertDebugMarkerCmd* cmd = mCommands.NextCommand<InsertDebugMarkerCmd>();
|
||||
auto label = mCommands.NextData<char>(cmd->length + 1);
|
||||
char* label = mCommands.NextData<char>(cmd->length + 1);
|
||||
NSString* mtlLabel = [[NSString alloc] initWithUTF8String:label];
|
||||
|
||||
[encoder insertDebugSignpost:mtlLabel];
|
||||
|
@ -862,7 +886,7 @@ namespace dawn_native { namespace metal {
|
|||
|
||||
case Command::PushDebugGroup: {
|
||||
PushDebugGroupCmd* cmd = mCommands.NextCommand<PushDebugGroupCmd>();
|
||||
auto label = mCommands.NextData<char>(cmd->length + 1);
|
||||
char* label = mCommands.NextData<char>(cmd->length + 1);
|
||||
NSString* mtlLabel = [[NSString alloc] initWithUTF8String:label];
|
||||
|
||||
[encoder pushDebugGroup:mtlLabel];
|
||||
|
|
|
@ -579,6 +579,14 @@ namespace dawn_native { namespace opengl {
|
|||
cmd->dynamicOffsetCount, dynamicOffsets);
|
||||
} break;
|
||||
|
||||
case Command::InsertDebugMarker:
|
||||
case Command::PopDebugGroup:
|
||||
case Command::PushDebugGroup: {
|
||||
// Due to lack of linux driver support for GL_EXT_debug_marker
|
||||
// extension these functions are skipped.
|
||||
SkipCommand(&mCommands, type);
|
||||
} break;
|
||||
|
||||
default: { UNREACHABLE(); } break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -560,6 +560,53 @@ namespace dawn_native { namespace vulkan {
|
|||
descriptorSets.OnPipelineLayoutChange(ToBackend(pipeline->GetLayout()));
|
||||
} break;
|
||||
|
||||
case Command::InsertDebugMarker: {
|
||||
if (device->GetDeviceInfo().debugMarker) {
|
||||
InsertDebugMarkerCmd* cmd = mCommands.NextCommand<InsertDebugMarkerCmd>();
|
||||
const char* label = mCommands.NextData<char>(cmd->length + 1);
|
||||
VkDebugMarkerMarkerInfoEXT markerInfo;
|
||||
markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT;
|
||||
markerInfo.pNext = nullptr;
|
||||
markerInfo.pMarkerName = label;
|
||||
// Default color to black
|
||||
markerInfo.color[0] = 0.0;
|
||||
markerInfo.color[1] = 0.0;
|
||||
markerInfo.color[2] = 0.0;
|
||||
markerInfo.color[3] = 1.0;
|
||||
device->fn.CmdDebugMarkerInsertEXT(commands, &markerInfo);
|
||||
} else {
|
||||
SkipCommand(&mCommands, Command::InsertDebugMarker);
|
||||
}
|
||||
} break;
|
||||
|
||||
case Command::PopDebugGroup: {
|
||||
if (device->GetDeviceInfo().debugMarker) {
|
||||
mCommands.NextCommand<PopDebugGroupCmd>();
|
||||
device->fn.CmdDebugMarkerEndEXT(commands);
|
||||
} else {
|
||||
SkipCommand(&mCommands, Command::PopDebugGroup);
|
||||
}
|
||||
} break;
|
||||
|
||||
case Command::PushDebugGroup: {
|
||||
if (device->GetDeviceInfo().debugMarker) {
|
||||
PushDebugGroupCmd* cmd = mCommands.NextCommand<PushDebugGroupCmd>();
|
||||
const char* label = mCommands.NextData<char>(cmd->length + 1);
|
||||
VkDebugMarkerMarkerInfoEXT markerInfo;
|
||||
markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT;
|
||||
markerInfo.pNext = nullptr;
|
||||
markerInfo.pMarkerName = label;
|
||||
// Default color to black
|
||||
markerInfo.color[0] = 0.0;
|
||||
markerInfo.color[1] = 0.0;
|
||||
markerInfo.color[2] = 0.0;
|
||||
markerInfo.color[3] = 1.0;
|
||||
device->fn.CmdDebugMarkerBeginEXT(commands, &markerInfo);
|
||||
} else {
|
||||
SkipCommand(&mCommands, Command::PushDebugGroup);
|
||||
}
|
||||
} break;
|
||||
|
||||
default: { UNREACHABLE(); } break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,13 @@ TEST_P(DebugMarkerTests, NoFailureWithoutDebugToolAttached) {
|
|||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
{
|
||||
dawn::ComputePassEncoder pass = encoder.BeginComputePass();
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
dawn::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
|
|
Loading…
Reference in New Issue