Use IterateBitSet in AddVertexPullingPass

BUG=dawn:529
Change-Id: Ibc05ee56f79c967b6dc8e08303ad726aff83c7a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64300
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2021-09-15 15:35:43 +00:00 committed by Dawn LUCI CQ
parent c4a462a2ff
commit 49d794fbcc
1 changed files with 17 additions and 18 deletions

View File

@ -1043,29 +1043,28 @@ namespace dawn_native {
cfg.entry_point_name = entryPoint; cfg.entry_point_name = entryPoint;
cfg.pulling_group = static_cast<uint32_t>(pullingBufferBindingSet); cfg.pulling_group = static_cast<uint32_t>(pullingBufferBindingSet);
const auto& vertexBufferSlotUsed = renderPipeline.GetVertexBufferSlotsUsed();
cfg.vertex_state.resize(renderPipeline.GetVertexBufferCount()); cfg.vertex_state.resize(renderPipeline.GetVertexBufferCount());
for (uint8_t vertexBufferSlot = 0; for (VertexBufferSlot slot : IterateBitSet(renderPipeline.GetVertexBufferSlotsUsed())) {
vertexBufferSlot < static_cast<uint8_t>(cfg.vertex_state.size()); ++vertexBufferSlot) { const VertexBufferInfo& dawnInfo = renderPipeline.GetVertexBuffer(slot);
if (vertexBufferSlotUsed[static_cast<VertexBufferSlot>(vertexBufferSlot)]) { tint::transform::VertexBufferLayoutDescriptor* tintInfo =
const auto& vertexBuffer = &cfg.vertex_state[static_cast<uint8_t>(slot)];
renderPipeline.GetVertexBuffer(static_cast<VertexBufferSlot>(vertexBufferSlot));
cfg.vertex_state[vertexBufferSlot].array_stride = vertexBuffer.arrayStride; tintInfo->array_stride = dawnInfo.arrayStride;
cfg.vertex_state[vertexBufferSlot].step_mode = tintInfo->step_mode = ToTintVertexStepMode(dawnInfo.stepMode);
ToTintVertexStepMode(vertexBuffer.stepMode);
}
} }
for (VertexAttributeLocation location : for (VertexAttributeLocation location :
IterateBitSet(renderPipeline.GetAttributeLocationsUsed())) { IterateBitSet(renderPipeline.GetAttributeLocationsUsed())) {
const auto& attribute = renderPipeline.GetAttribute(location); const VertexAttributeInfo& dawnInfo = renderPipeline.GetAttribute(location);
tint::transform::VertexAttributeDescriptor attr; tint::transform::VertexAttributeDescriptor tintInfo;
attr.format = ToTintVertexFormat(attribute.format); tintInfo.format = ToTintVertexFormat(dawnInfo.format);
attr.offset = attribute.offset; tintInfo.offset = dawnInfo.offset;
attr.shader_location = static_cast<uint32_t>(static_cast<uint8_t>(location)); tintInfo.shader_location = static_cast<uint32_t>(static_cast<uint8_t>(location));
ASSERT(vertexBufferSlotUsed[attribute.vertexBufferSlot]);
uint8_t vertexBufferSlot = static_cast<uint8_t>(attribute.vertexBufferSlot); uint8_t vertexBufferSlot = static_cast<uint8_t>(dawnInfo.vertexBufferSlot);
cfg.vertex_state[vertexBufferSlot].attributes.push_back(attr); cfg.vertex_state[vertexBufferSlot].attributes.push_back(tintInfo);
} }
transformInputs->Add<tint::transform::VertexPulling::Config>(cfg); transformInputs->Add<tint::transform::VertexPulling::Config>(cfg);
} }