Skip to content

Commit 44fc9da

Browse files
lokokungDawn LUCI CQ
authored andcommitted
[webgpu-headers] Rename "count" fields and update usages.
Needs to wait for the following CLs to land before it can be submitted: https://chromium-review.googlesource.com/c/chromium/src/+/4767426 https://skia-review.googlesource.com/c/skia/+/739596 github.com/webgpu-native/webgpu-headers/issues/193 Change-Id: Icae688352aa14d537819071ecca5d9c87197c5e5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/146040 Reviewed-by: Austin Eng <[email protected]> Commit-Queue: Loko Kung <[email protected]> Reviewed-by: Kai Ninomiya <[email protected]> Kokoro: Kokoro <[email protected]>
1 parent f651e35 commit 44fc9da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+167
-165
lines changed

dawn.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@
161161
"extensible": "in",
162162
"members": [
163163
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
164-
{"name": "required features count", "type": "size_t", "default": 0},
165-
{"name": "required features", "type": "feature name", "annotation": "const*", "length": "required features count", "default": "nullptr"},
164+
{"name": "required feature count", "type": "size_t", "default": 0},
165+
{"name": "required features", "type": "feature name", "annotation": "const*", "length": "required feature count", "default": "nullptr"},
166166
{"name": "required limits", "type": "required limits", "annotation": "const*", "optional": true},
167167
{"name": "default queue", "type": "queue descriptor"},
168168
{"name": "device lost callback", "type": "device lost callback", "default": "nullptr"},
@@ -175,10 +175,10 @@
175175
"chained": "in",
176176
"chain roots": ["instance descriptor", "request adapter options", "device descriptor"],
177177
"members": [
178-
{"name": "enabled toggles count", "type": "size_t", "default": 0},
179-
{"name": "enabled toggles", "type": "char", "annotation": "const*const*", "length": "enabled toggles count"},
180-
{"name": "disabled toggles count", "type": "size_t", "default": 0},
181-
{"name": "disabled toggles", "type": "char", "annotation": "const*const*", "length": "disabled toggles count"}
178+
{"name": "enabled toggle count", "type": "size_t", "default": 0},
179+
{"name": "enabled toggles", "type": "char", "annotation": "const*const*", "length": "enabled toggle count"},
180+
{"name": "disabled toggle count", "type": "size_t", "default": 0},
181+
{"name": "disabled toggles", "type": "char", "annotation": "const*const*", "length": "disabled toggle count"}
182182
]
183183
},
184184
"dawn cache device descriptor" : {
@@ -2105,8 +2105,8 @@
21052105
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
21062106
{"name": "type", "type": "query type"},
21072107
{"name": "count", "type": "uint32_t"},
2108-
{"name": "pipeline statistics", "type": "pipeline statistic name", "annotation": "const*", "length": "pipeline statistics count"},
2109-
{"name": "pipeline statistics count", "type": "size_t", "default": "0"}
2108+
{"name": "pipeline statistics", "type": "pipeline statistic name", "annotation": "const*", "length": "pipeline statistic count"},
2109+
{"name": "pipeline statistic count", "type": "size_t", "default": "0"}
21102110
]
21112111
},
21122112
"query type": {
@@ -2348,8 +2348,8 @@
23482348
"extensible": "in",
23492349
"members": [
23502350
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
2351-
{"name": "color formats count", "type": "size_t"},
2352-
{"name": "color formats", "type": "texture format", "annotation": "const*", "length": "color formats count"},
2351+
{"name": "color format count", "type": "size_t"},
2352+
{"name": "color formats", "type": "texture format", "annotation": "const*", "length": "color format count"},
23532353
{"name": "depth stencil format", "type": "texture format", "default": "undefined"},
23542354
{"name": "sample count", "type": "uint32_t", "default": "1"},
23552355
{"name": "depth read only", "type": "bool", "default": "false"},

generator/templates/api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
#define {{API}}_NULLABLE
6868
#endif
6969

70+
#define WGPU_BREAKING_CHANGE_COUNT_RENAME
71+
7072
#include <stdint.h>
7173
#include <stddef.h>
7274

src/dawn/native/Adapter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ ResultOrError<Ref<DeviceBase>> AdapterBase::CreateDevice(const DeviceDescriptor*
175175
// that not supported by the adapter. We allow such toggles overriding for the convinience e.g.
176176
// creating a deivce for internal usage with AllowUnsafeAPI enabled from an adapter that
177177
// disabled AllowUnsafeAPIS.
178-
for (uint32_t i = 0; i < descriptor->requiredFeaturesCount; ++i) {
178+
for (uint32_t i = 0; i < descriptor->requiredFeatureCount; ++i) {
179179
wgpu::FeatureName feature = descriptor->requiredFeatures[i];
180180
DAWN_TRY(mPhysicalDevice->ValidateFeatureSupportedWithToggles(feature, deviceToggles));
181181
}

src/dawn/native/AttachmentState.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ namespace dawn::native {
2525
AttachmentState::AttachmentState(DeviceBase* device,
2626
const RenderBundleEncoderDescriptor* descriptor)
2727
: ObjectBase(device), mSampleCount(descriptor->sampleCount) {
28-
ASSERT(descriptor->colorFormatsCount <= kMaxColorAttachments);
28+
ASSERT(descriptor->colorFormatCount <= kMaxColorAttachments);
2929
for (ColorAttachmentIndex i(uint8_t(0));
30-
i < ColorAttachmentIndex(static_cast<uint8_t>(descriptor->colorFormatsCount)); ++i) {
30+
i < ColorAttachmentIndex(static_cast<uint8_t>(descriptor->colorFormatCount)); ++i) {
3131
wgpu::TextureFormat format = descriptor->colorFormats[static_cast<uint8_t>(i)];
3232
if (format != wgpu::TextureFormat::Undefined) {
3333
mColorAttachmentsSet.set(i);

src/dawn/native/Device.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,9 +1392,9 @@ void DeviceBase::ApplyFeatures(const DeviceDescriptor* deviceDescriptor) {
13921392
ASSERT(deviceDescriptor);
13931393
// Validate all required features with device toggles.
13941394
ASSERT(GetPhysicalDevice()->SupportsAllRequiredFeatures(
1395-
{deviceDescriptor->requiredFeatures, deviceDescriptor->requiredFeaturesCount}, mToggles));
1395+
{deviceDescriptor->requiredFeatures, deviceDescriptor->requiredFeatureCount}, mToggles));
13961396

1397-
for (uint32_t i = 0; i < deviceDescriptor->requiredFeaturesCount; ++i) {
1397+
for (uint32_t i = 0; i < deviceDescriptor->requiredFeatureCount; ++i) {
13981398
mEnabledFeatures.EnableFeature(deviceDescriptor->requiredFeatures[i]);
13991399
}
14001400
}

src/dawn/native/QuerySet.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ MaybeError ValidateQuerySetDescriptor(DeviceBase* device, const QuerySetDescript
4747

4848
switch (descriptor->type) {
4949
case wgpu::QueryType::Occlusion:
50-
DAWN_INVALID_IF(descriptor->pipelineStatisticsCount != 0,
50+
DAWN_INVALID_IF(descriptor->pipelineStatisticCount != 0,
5151
"Pipeline statistics specified for a query of type %s.",
5252
descriptor->type);
5353
break;
@@ -63,11 +63,11 @@ MaybeError ValidateQuerySetDescriptor(DeviceBase* device, const QuerySetDescript
6363
!device->HasFeature(Feature::PipelineStatisticsQuery),
6464
"Pipeline statistics query set created without the feature being enabled.");
6565

66-
DAWN_INVALID_IF(descriptor->pipelineStatisticsCount == 0,
66+
DAWN_INVALID_IF(descriptor->pipelineStatisticCount == 0,
6767
"Pipeline statistics query set created with 0 statistics.");
6868

6969
std::set<wgpu::PipelineStatisticName> pipelineStatisticsSet;
70-
for (uint32_t i = 0; i < descriptor->pipelineStatisticsCount; i++) {
70+
for (uint32_t i = 0; i < descriptor->pipelineStatisticCount; i++) {
7171
DAWN_TRY(ValidatePipelineStatisticName(descriptor->pipelineStatistics[i]));
7272

7373
auto [_, inserted] =
@@ -86,7 +86,7 @@ MaybeError ValidateQuerySetDescriptor(DeviceBase* device, const QuerySetDescript
8686
!device->HasFeature(Feature::TimestampQueryInsidePasses),
8787
"Timestamp query set created without the feature being enabled.");
8888

89-
DAWN_INVALID_IF(descriptor->pipelineStatisticsCount != 0,
89+
DAWN_INVALID_IF(descriptor->pipelineStatisticCount != 0,
9090
"Pipeline statistics specified for a query of type %s.",
9191
descriptor->type);
9292
break;
@@ -103,7 +103,7 @@ QuerySetBase::QuerySetBase(DeviceBase* device, const QuerySetDescriptor* descrip
103103
mQueryType(descriptor->type),
104104
mQueryCount(descriptor->count),
105105
mState(QuerySetState::Available) {
106-
for (uint32_t i = 0; i < descriptor->pipelineStatisticsCount; i++) {
106+
for (uint32_t i = 0; i < descriptor->pipelineStatisticCount; i++) {
107107
mPipelineStatistics.push_back(descriptor->pipelineStatistics[i]);
108108
}
109109

src/dawn/native/RenderBundleEncoder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ MaybeError ValidateRenderBundleEncoderDescriptor(DeviceBase* device,
6464
"Sample count (%u) is not supported.", descriptor->sampleCount);
6565

6666
uint32_t maxColorAttachments = device->GetLimits().v1.maxColorAttachments;
67-
DAWN_INVALID_IF(descriptor->colorFormatsCount > maxColorAttachments,
67+
DAWN_INVALID_IF(descriptor->colorFormatCount > maxColorAttachments,
6868
"Color formats count (%u) exceeds maximum number of color attachements (%u).",
69-
descriptor->colorFormatsCount, maxColorAttachments);
69+
descriptor->colorFormatCount, maxColorAttachments);
7070

7171
bool allColorFormatsUndefined = true;
7272
ColorAttachmentFormats colorAttachmentFormats;
73-
for (uint32_t i = 0; i < descriptor->colorFormatsCount; ++i) {
73+
for (uint32_t i = 0; i < descriptor->colorFormatCount; ++i) {
7474
wgpu::TextureFormat format = descriptor->colorFormats[i];
7575
if (format != wgpu::TextureFormat::Undefined) {
7676
DAWN_TRY_CONTEXT(ValidateColorAttachmentFormat(device, format),

src/dawn/native/Toggles.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ TogglesState TogglesState::CreateFromTogglesDescriptor(const DawnTogglesDescript
500500
}
501501

502502
TogglesInfo togglesInfo;
503-
for (uint32_t i = 0; i < togglesDesc->enabledTogglesCount; ++i) {
503+
for (uint32_t i = 0; i < togglesDesc->enabledToggleCount; ++i) {
504504
Toggle toggle = togglesInfo.ToggleNameToEnum(togglesDesc->enabledToggles[i]);
505505
if (toggle != Toggle::InvalidEnum) {
506506
const ToggleInfo* toggleInfo = togglesInfo.GetToggleInfo(toggle);
@@ -512,7 +512,7 @@ TogglesState TogglesState::CreateFromTogglesDescriptor(const DawnTogglesDescript
512512
}
513513
}
514514
}
515-
for (uint32_t i = 0; i < togglesDesc->disabledTogglesCount; ++i) {
515+
for (uint32_t i = 0; i < togglesDesc->disabledToggleCount; ++i) {
516516
Toggle toggle = togglesInfo.ToggleNameToEnum(togglesDesc->disabledToggles[i]);
517517
if (toggle != Toggle::InvalidEnum) {
518518
const ToggleInfo* toggleInfo = togglesInfo.GetToggleInfo(toggle);

src/dawn/native/opengl/PhysicalDeviceGL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ ResultOrError<Ref<DeviceBase>> PhysicalDevice::CreateDeviceImpl(AdapterBase* ada
344344
GetBackendType() == wgpu::BackendType::OpenGL ? EGL_OPENGL_API : EGL_OPENGL_ES_API;
345345
std::unique_ptr<Device::Context> context;
346346
bool useANGLETextureSharing = false;
347-
for (size_t i = 0; i < descriptor->requiredFeaturesCount; ++i) {
347+
for (size_t i = 0; i < descriptor->requiredFeatureCount; ++i) {
348348
if (descriptor->requiredFeatures[i] == wgpu::FeatureName::ANGLETextureSharing) {
349349
useANGLETextureSharing = true;
350350
}

src/dawn/node/binding/GPUAdapter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ interop::Promise<interop::Interface<interop::GPUDevice>> GPUAdapter::requestDevi
134134
return promise;
135135
}
136136

137-
desc.requiredFeaturesCount = requiredFeatures.size();
137+
desc.requiredFeatureCount = requiredFeatures.size();
138138
desc.requiredFeatures = requiredFeatures.data();
139139
desc.requiredLimits = &limits;
140140

0 commit comments

Comments
 (0)