Query API: QuerySet on D3D12

- Implement QuerySet object creation on D3D12 backend.
- Add end2end tests for the creation on D3D12 backend.

Bug: dawn:434
Change-Id: I9657792ca5cba8f156471783a7c13f6d36b7a19e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25225
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This commit is contained in:
Hao Li
2020-07-25 14:48:12 +00:00
committed by Commit Bot service account
parent 0d158ac681
commit d5a4775cfc
7 changed files with 221 additions and 1 deletions

View File

@@ -294,6 +294,7 @@ source_set("dawn_end2end_tests_sources") {
"end2end/OpArrayLengthTests.cpp",
"end2end/PipelineLayoutTests.cpp",
"end2end/PrimitiveTopologyTests.cpp",
"end2end/QueryTests.cpp",
"end2end/QueueTests.cpp",
"end2end/RenderBundleTests.cpp",
"end2end/RenderPassLoadOpTests.cpp",

View File

@@ -0,0 +1,103 @@
// Copyright 2020 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.
// This file contains test for deprecated parts of Dawn's API while following WebGPU's evolution.
// It contains test for the "old" behavior that will be deleted once users are migrated, tests that
// a deprecation warning is emitted when the "old" behavior is used, and tests that an error is
// emitted when both the old and the new behavior are used (when applicable).
#include "tests/DawnTest.h"
class OcclusionQueryTests : public DawnTest {};
// Test creating query set with the type of Occlusion
TEST_P(OcclusionQueryTests, QuerySetCreation) {
wgpu::QuerySetDescriptor descriptor;
descriptor.count = 1;
descriptor.type = wgpu::QueryType::Occlusion;
device.CreateQuerySet(&descriptor);
}
// Test destroying query set
TEST_P(OcclusionQueryTests, QuerySetDestroy) {
wgpu::QuerySetDescriptor descriptor;
descriptor.count = 1;
descriptor.type = wgpu::QueryType::Occlusion;
wgpu::QuerySet querySet = device.CreateQuerySet(&descriptor);
querySet.Destroy();
}
DAWN_INSTANTIATE_TEST(OcclusionQueryTests, D3D12Backend());
class PipelineStatisticsQueryTests : public DawnTest {
protected:
void SetUp() override {
DawnTest::SetUp();
// Skip all tests if pipeline statistics extension is not supported
DAWN_SKIP_TEST_IF(!SupportsExtensions({"pipeline_statistics_query"}));
}
std::vector<const char*> GetRequiredExtensions() override {
std::vector<const char*> requiredExtensions = {};
if (SupportsExtensions({"pipeline_statistics_query"})) {
requiredExtensions.push_back("pipeline_statistics_query");
}
return requiredExtensions;
}
};
// Test creating query set with the type of PipelineStatistics
TEST_P(PipelineStatisticsQueryTests, QuerySetCreation) {
wgpu::QuerySetDescriptor descriptor;
descriptor.count = 1;
descriptor.type = wgpu::QueryType::PipelineStatistics;
wgpu::PipelineStatisticName pipelineStatistics[2] = {
wgpu::PipelineStatisticName::ClipperInvocations,
wgpu::PipelineStatisticName::VertexShaderInvocations};
descriptor.pipelineStatistics = pipelineStatistics;
descriptor.pipelineStatisticsCount = 2;
device.CreateQuerySet(&descriptor);
}
DAWN_INSTANTIATE_TEST(PipelineStatisticsQueryTests, D3D12Backend());
class TimestampQueryTests : public DawnTest {
protected:
void SetUp() override {
DawnTest::SetUp();
// Skip all tests if timestamp extension is not supported
DAWN_SKIP_TEST_IF(!SupportsExtensions({"timestamp_query"}));
}
std::vector<const char*> GetRequiredExtensions() override {
std::vector<const char*> requiredExtensions = {};
if (SupportsExtensions({"timestamp_query"})) {
requiredExtensions.push_back("timestamp_query");
}
return requiredExtensions;
}
};
// Test creating query set with the type of Timestamp
TEST_P(TimestampQueryTests, QuerySetCreation) {
wgpu::QuerySetDescriptor descriptor;
descriptor.count = 1;
descriptor.type = wgpu::QueryType::Timestamp;
device.CreateQuerySet(&descriptor);
}
DAWN_INSTANTIATE_TEST(TimestampQueryTests, D3D12Backend());