diff --git a/dawn.json b/dawn.json index 53431ee58e..09b76bd810 100644 --- a/dawn.json +++ b/dawn.json @@ -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"} ] }, diff --git a/src/dawn_native/QuerySet.cpp b/src/dawn_native/QuerySet.cpp index 3eb18ff7e4..bd65ed05ba 100644 --- a/src/dawn_native/QuerySet.cpp +++ b/src/dawn_native/QuerySet.cpp @@ -65,11 +65,11 @@ namespace dawn_native { "PipelineStatistics"); } - std::set pipelineStatisticsSet; + std::set pipelineStatisticsSet; for (uint32_t i = 0; i < descriptor->pipelineStatisticsCount; i++) { - DAWN_TRY(ValidatePipelineStatisticsName(descriptor->pipelineStatistics[i])); + DAWN_TRY(ValidatePipelineStatisticName(descriptor->pipelineStatistics[i])); - std::pair::iterator, bool> res = + std::pair::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& QuerySetBase::GetPipelineStatistics() const { + const std::vector& QuerySetBase::GetPipelineStatistics() const { return mPipelineStatistics; } diff --git a/src/dawn_native/QuerySet.h b/src/dawn_native/QuerySet.h index a0698875b1..a8f4deace6 100644 --- a/src/dawn_native/QuerySet.h +++ b/src/dawn_native/QuerySet.h @@ -33,7 +33,7 @@ namespace dawn_native { wgpu::QueryType GetQueryType() const; uint32_t GetQueryCount() const; - const std::vector& GetPipelineStatistics() const; + const std::vector& GetPipelineStatistics() const; MaybeError ValidateCanUseInSubmitNow() const; @@ -52,7 +52,7 @@ namespace dawn_native { wgpu::QueryType mQueryType; uint32_t mQueryCount; - std::vector mPipelineStatistics; + std::vector mPipelineStatistics; enum class QuerySetState { Unavailable, Available, Destroyed }; QuerySetState mState = QuerySetState::Unavailable; diff --git a/src/tests/unittests/validation/QuerySetValidationTests.cpp b/src/tests/unittests/validation/QuerySetValidationTests.cpp index 3039718868..185c047879 100644 --- a/src/tests/unittests/validation/QuerySetValidationTests.cpp +++ b/src/tests/unittests/validation/QuerySetValidationTests.cpp @@ -31,7 +31,7 @@ class QuerySetValidationTest : public ValidationTest { wgpu::Device cDevice, wgpu::QueryType queryType, uint32_t queryCount, - std::vector pipelineStatistics = {}) { + std::vector 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(0xFFFFFFFF)})); + ASSERT_DEVICE_ERROR(CreateQuerySet(deviceWithPipelineStatistics, + wgpu::QueryType::PipelineStatistics, 1, + {static_cast(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})); } }