mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 16:37:08 +00:00
Implementation of Debug Marker APIs
Introduces pushDebugGroup, popDebugGroup, and insertDebugMarker implementations for Vulkan and Metal using VK_EXT_debug_marker and XCode, respectively. Bug: dawn:44 Change-Id: I0ae56c4d67aa832123f27a1fcdddf65746261e57 Reviewed-on: https://dawn-review.googlesource.com/c/4241 Commit-Queue: Brandon Jones <brandon1.jones@intel.com> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
938811eef9
commit
11d32c8095
38
src/tests/end2end/DebugMarkerTests.cpp
Normal file
38
src/tests/end2end/DebugMarkerTests.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright 2019 The Dawn Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "tests/DawnTest.h"
|
||||
|
||||
#include "utils/DawnHelpers.h"
|
||||
|
||||
class DebugMarkerTests : public DawnTest {};
|
||||
|
||||
// Make sure that calling a marker API without a debugging tool attached doesn't cause a failure.
|
||||
TEST_P(DebugMarkerTests, NoFailureWithoutDebugToolAttached) {
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 4, 4);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(renderPass.renderPassInfo);
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
dawn::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(DebugMarkerTests, D3D12Backend, MetalBackend, OpenGLBackend, VulkanBackend)
|
||||
117
src/tests/unittests/validation/DebugMarkerValidationTests.cpp
Normal file
117
src/tests/unittests/validation/DebugMarkerValidationTests.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
// Copyright 2019 The Dawn Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "tests/unittests/validation/ValidationTest.h"
|
||||
|
||||
#include "utils/DawnHelpers.h"
|
||||
|
||||
class DebugMarkerValidationTest : public ValidationTest {};
|
||||
|
||||
// Correct usage of debug markers should succeed in render pass.
|
||||
TEST_F(DebugMarkerValidationTest, RenderSuccess) {
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 4, 4);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(renderPass.renderPassInfo);
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
encoder.Finish();
|
||||
}
|
||||
|
||||
// A PushDebugGroup call without a following PopDebugGroup produces an error in render pass.
|
||||
TEST_F(DebugMarkerValidationTest, RenderUnbalancedPush) {
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 4, 4);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(renderPass.renderPassInfo);
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
// A PopDebugGroup call without a preceding PushDebugGroup produces an error in render pass.
|
||||
TEST_F(DebugMarkerValidationTest, RenderUnbalancedPop) {
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 4, 4);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(renderPass.renderPassInfo);
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
// Correct usage of debug markers should succeed in compute pass.
|
||||
TEST_F(DebugMarkerValidationTest, ComputeSuccess) {
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
dawn::ComputePassEncoder pass = encoder.BeginComputePass();
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
encoder.Finish();
|
||||
}
|
||||
|
||||
// A PushDebugGroup call without a following PopDebugGroup produces an error in compute pass.
|
||||
TEST_F(DebugMarkerValidationTest, ComputeUnbalancedPush) {
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
dawn::ComputePassEncoder pass = encoder.BeginComputePass();
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
// A PopDebugGroup call without a preceding PushDebugGroup produces an error in compute pass.
|
||||
TEST_F(DebugMarkerValidationTest, ComputeUnbalancedPop) {
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
dawn::ComputePassEncoder pass = encoder.BeginComputePass();
|
||||
pass.PushDebugGroup("Event Start");
|
||||
pass.InsertDebugMarker("Marker");
|
||||
pass.PopDebugGroup();
|
||||
pass.PopDebugGroup();
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
Reference in New Issue
Block a user