mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 17:05:31 +00:00
Implement debug markers and groups for CommandEncoder
BUG=dawn:22 Change-Id: I1fc6ac3dec936268a043753169ed1d4a405881bd Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10962 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
57354037bd
commit
b8ea84cbb8
@@ -114,4 +114,95 @@ TEST_F(DebugMarkerValidationTest, ComputeUnbalancedPop) {
|
||||
}
|
||||
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
}
|
||||
|
||||
// Correct usage of debug markers should succeed in command encoder.
|
||||
TEST_F(DebugMarkerValidationTest, CommandEncoderSuccess) {
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.PushDebugGroup("Event Start");
|
||||
encoder.PushDebugGroup("Event Start");
|
||||
encoder.InsertDebugMarker("Marker");
|
||||
encoder.PopDebugGroup();
|
||||
encoder.PopDebugGroup();
|
||||
encoder.Finish();
|
||||
}
|
||||
|
||||
// A PushDebugGroup call without a following PopDebugGroup produces an error in command encoder.
|
||||
TEST_F(DebugMarkerValidationTest, CommandEncoderUnbalancedPush) {
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.PushDebugGroup("Event Start");
|
||||
encoder.PushDebugGroup("Event Start");
|
||||
encoder.InsertDebugMarker("Marker");
|
||||
encoder.PopDebugGroup();
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
// A PopDebugGroup call without a preceding PushDebugGroup produces an error in command encoder.
|
||||
TEST_F(DebugMarkerValidationTest, CommandEncoderUnbalancedPop) {
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.PushDebugGroup("Event Start");
|
||||
encoder.InsertDebugMarker("Marker");
|
||||
encoder.PopDebugGroup();
|
||||
encoder.PopDebugGroup();
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
// It is possible to nested pushes in a compute pass in a command encoder.
|
||||
TEST_F(DebugMarkerValidationTest, NestedComputeInCommandEncoder) {
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.PushDebugGroup("Event Start");
|
||||
{
|
||||
dawn::ComputePassEncoder pass = encoder.BeginComputePass();
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
encoder.PopDebugGroup();
|
||||
encoder.Finish();
|
||||
}
|
||||
|
||||
// Command encoder and compute pass pushes must be balanced independently.
|
||||
TEST_F(DebugMarkerValidationTest, NestedComputeInCommandEncoderIndependent) {
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.PushDebugGroup("Event Start");
|
||||
{
|
||||
dawn::ComputePassEncoder pass = encoder.BeginComputePass();
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
// It is possible to nested pushes in a render pass in a command encoder.
|
||||
TEST_F(DebugMarkerValidationTest, NestedRenderInCommandEncoder) {
|
||||
DummyRenderPass renderPass(device);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.PushDebugGroup("Event Start");
|
||||
{
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
encoder.PopDebugGroup();
|
||||
encoder.Finish();
|
||||
}
|
||||
|
||||
// Command encoder and render pass pushes must be balanced independently.
|
||||
TEST_F(DebugMarkerValidationTest, NestedRenderInCommandEncoderIndependent) {
|
||||
DummyRenderPass renderPass(device);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.PushDebugGroup("Event Start");
|
||||
{
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user