mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-13 10:03:41 +00:00
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>
117 lines
4.1 KiB
C++
117 lines
4.1 KiB
C++
// 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());
|
|
} |