PipelineStatisticsName -> PipelineStatisticName

To match upstream WebGPU (and be grammatically more correct).

Upstream webgpu.h change:
https://github.com/webgpu-native/webgpu-headers/pull/60

Bug: dawn:22
Change-Id: Id665e883259b9297a90c13b43187461c64fdc3da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24702
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Kai Ninomiya 2020-07-13 18:21:03 +00:00 committed by Commit Bot service account
parent 3e6db22fa8
commit 261b05d3dd
4 changed files with 28 additions and 31 deletions

View File

@ -891,7 +891,7 @@
{"name": "bind group layouts", "type": "bind group layout", "annotation": "const*", "length": "bind group layout count"}
]
},
"pipeline statistics name": {
"pipeline statistic name": {
"category": "enum",
"values": [
{"value": 0, "name": "vertex shader invocations"},
@ -942,7 +942,7 @@
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "type", "type": "query type"},
{"name": "count", "type": "uint32_t"},
{"name": "pipeline statistics", "type": "pipeline statistics name", "annotation": "const*", "length": "pipeline statistics count"},
{"name": "pipeline statistics", "type": "pipeline statistic name", "annotation": "const*", "length": "pipeline statistics count"},
{"name": "pipeline statistics count", "type": "uint32_t", "default": "0"}
]
},

View File

@ -65,11 +65,11 @@ namespace dawn_native {
"PipelineStatistics");
}
std::set<wgpu::PipelineStatisticsName> pipelineStatisticsSet;
std::set<wgpu::PipelineStatisticName> pipelineStatisticsSet;
for (uint32_t i = 0; i < descriptor->pipelineStatisticsCount; i++) {
DAWN_TRY(ValidatePipelineStatisticsName(descriptor->pipelineStatistics[i]));
DAWN_TRY(ValidatePipelineStatisticName(descriptor->pipelineStatistics[i]));
std::pair<std::set<wgpu::PipelineStatisticsName>::iterator, bool> res =
std::pair<std::set<wgpu::PipelineStatisticName>::iterator, bool> res =
pipelineStatisticsSet.insert((descriptor->pipelineStatistics[i]));
if (!res.second) {
return DAWN_VALIDATION_ERROR("Duplicate pipeline statistics found");
@ -127,7 +127,7 @@ namespace dawn_native {
return mQueryCount;
}
const std::vector<wgpu::PipelineStatisticsName>& QuerySetBase::GetPipelineStatistics() const {
const std::vector<wgpu::PipelineStatisticName>& QuerySetBase::GetPipelineStatistics() const {
return mPipelineStatistics;
}

View File

@ -33,7 +33,7 @@ namespace dawn_native {
wgpu::QueryType GetQueryType() const;
uint32_t GetQueryCount() const;
const std::vector<wgpu::PipelineStatisticsName>& GetPipelineStatistics() const;
const std::vector<wgpu::PipelineStatisticName>& GetPipelineStatistics() const;
MaybeError ValidateCanUseInSubmitNow() const;
@ -52,7 +52,7 @@ namespace dawn_native {
wgpu::QueryType mQueryType;
uint32_t mQueryCount;
std::vector<wgpu::PipelineStatisticsName> mPipelineStatistics;
std::vector<wgpu::PipelineStatisticName> mPipelineStatistics;
enum class QuerySetState { Unavailable, Available, Destroyed };
QuerySetState mState = QuerySetState::Unavailable;

View File

@ -31,7 +31,7 @@ class QuerySetValidationTest : public ValidationTest {
wgpu::Device cDevice,
wgpu::QueryType queryType,
uint32_t queryCount,
std::vector<wgpu::PipelineStatisticsName> pipelineStatistics = {}) {
std::vector<wgpu::PipelineStatisticName> pipelineStatistics = {}) {
wgpu::QuerySetDescriptor descriptor;
descriptor.type = queryType;
descriptor.count = queryCount;
@ -64,13 +64,12 @@ TEST_F(QuerySetValidationTest, Creation) {
// Create query set for PipelineStatistics query
{
// Fail on default device without any extension enabled
ASSERT_DEVICE_ERROR(
CreateQuerySet(device, wgpu::QueryType::PipelineStatistics, 1,
{wgpu::PipelineStatisticsName::VertexShaderInvocations}));
ASSERT_DEVICE_ERROR(CreateQuerySet(device, wgpu::QueryType::PipelineStatistics, 1,
{wgpu::PipelineStatisticName::VertexShaderInvocations}));
// Success on the device if the extension is enabled.
CreateQuerySet(deviceWithPipelineStatistics, wgpu::QueryType::PipelineStatistics, 1,
{wgpu::PipelineStatisticsName::VertexShaderInvocations});
{wgpu::PipelineStatisticName::VertexShaderInvocations});
}
// Create query set for Timestamp query
@ -92,16 +91,14 @@ TEST_F(QuerySetValidationTest, InvalidQueryType) {
TEST_F(QuerySetValidationTest, UnnecessaryPipelineStatistics) {
// Fail to create with pipeline statistics for Occlusion query
{
ASSERT_DEVICE_ERROR(
CreateQuerySet(device, wgpu::QueryType::Occlusion, 1,
{wgpu::PipelineStatisticsName::VertexShaderInvocations}));
ASSERT_DEVICE_ERROR(CreateQuerySet(device, wgpu::QueryType::Occlusion, 1,
{wgpu::PipelineStatisticName::VertexShaderInvocations}));
}
// Fail to create with pipeline statistics for Timestamp query
{
ASSERT_DEVICE_ERROR(
CreateQuerySet(deviceWithTimestamp, wgpu::QueryType::Timestamp, 1,
{wgpu::PipelineStatisticsName::VertexShaderInvocations}));
ASSERT_DEVICE_ERROR(CreateQuerySet(deviceWithTimestamp, wgpu::QueryType::Timestamp, 1,
{wgpu::PipelineStatisticName::VertexShaderInvocations}));
}
}
@ -111,11 +108,11 @@ TEST_F(QuerySetValidationTest, InvalidPipelineStatistics) {
// defined in webgpu header file
{
CreateQuerySet(deviceWithPipelineStatistics, wgpu::QueryType::PipelineStatistics, 1,
{wgpu::PipelineStatisticsName::ClipperInvocations,
wgpu::PipelineStatisticsName::ClipperPrimitivesOut,
wgpu::PipelineStatisticsName::ComputeShaderInvocations,
wgpu::PipelineStatisticsName::FragmentShaderInvocations,
wgpu::PipelineStatisticsName::VertexShaderInvocations});
{wgpu::PipelineStatisticName::ClipperInvocations,
wgpu::PipelineStatisticName::ClipperPrimitivesOut,
wgpu::PipelineStatisticName::ComputeShaderInvocations,
wgpu::PipelineStatisticName::FragmentShaderInvocations,
wgpu::PipelineStatisticName::VertexShaderInvocations});
}
// Fail to create with empty pipeline statistics
@ -126,17 +123,17 @@ TEST_F(QuerySetValidationTest, InvalidPipelineStatistics) {
// Fail to create with invalid pipeline statistics
{
ASSERT_DEVICE_ERROR(
CreateQuerySet(deviceWithPipelineStatistics, wgpu::QueryType::PipelineStatistics, 1,
{static_cast<wgpu::PipelineStatisticsName>(0xFFFFFFFF)}));
ASSERT_DEVICE_ERROR(CreateQuerySet(deviceWithPipelineStatistics,
wgpu::QueryType::PipelineStatistics, 1,
{static_cast<wgpu::PipelineStatisticName>(0xFFFFFFFF)}));
}
// Fail to create with duplicate pipeline statistics
{
ASSERT_DEVICE_ERROR(
CreateQuerySet(deviceWithPipelineStatistics, wgpu::QueryType::PipelineStatistics, 1,
{wgpu::PipelineStatisticsName::VertexShaderInvocations,
wgpu::PipelineStatisticsName::VertexShaderInvocations}));
ASSERT_DEVICE_ERROR(CreateQuerySet(deviceWithPipelineStatistics,
wgpu::QueryType::PipelineStatistics, 1,
{wgpu::PipelineStatisticName::VertexShaderInvocations,
wgpu::PipelineStatisticName::VertexShaderInvocations}));
}
}