Capture: Remove Implicit resource code Bug: 451338754 Change-Id: I6a6a69649b470fa2c85b6eeb35052c2d17ddf677 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/275634 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org> Auto-Submit: Gregg Tavares <gman@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn/native/webgpu/CaptureContext.h b/src/dawn/native/webgpu/CaptureContext.h index ab3cae2..6040ff5 100644 --- a/src/dawn/native/webgpu/CaptureContext.h +++ b/src/dawn/native/webgpu/CaptureContext.h
@@ -97,25 +97,6 @@ return {}; } - // This is for resources that are not explicitly created on Replay. - // For example, bindGroupLayouts created by a pipeline using auto layout. - // We need to give them an id but not generate any creation commands. - template <typename T> - schema::ObjectId AddAndGetIdForImplicitResource(T* object) { - assert(object != nullptr); - schema::ObjectId id; - Ref<ApiObjectBase> ref(object); - auto it = mObjectIds.find(ref); - bool newResource = it == mObjectIds.end(); - if (newResource) { - id = mNextObjectId++; - mObjectIds[std::move(ref)] = id; - } else { - id = it->second; - } - return id; - } - // You must have called AddResource at some point before calling GetId. template <typename T> schema::ObjectId GetId(T ref) {
diff --git a/src/dawn/native/webgpu/CommandBufferWGPU.cpp b/src/dawn/native/webgpu/CommandBufferWGPU.cpp index f1bf8e4..4ad1707 100644 --- a/src/dawn/native/webgpu/CommandBufferWGPU.cpp +++ b/src/dawn/native/webgpu/CommandBufferWGPU.cpp
@@ -615,35 +615,6 @@ DAWN_TRY(AddReferencedPassResourceUsages(captureContext, pass.dispatchUsages)); } - // We need to process all pipelines (setPipeline calls) before we deal with - // any bindGroups (setBindGroup calls). The reason is, bindGroups reference - // a bindGroupLayout but that bindGroupLayout might have been implicitly - // created from a `layout: 'auto'` pipeline. That means, in order to create - // the bindGroup we need to have first created the correct pipeline. - // Unfortunately there is no association from an implicitly created - // bindGroupLayout to the pipeline that created it. - // - // So, we gather all the pipelines and all the bindGroups referenced in the - // command buffer. We then serialize all the pipelines. Pipelines that - // create implicit bindGroupLayouts will make schema::ObjectIds for those - // implicit bindGroupLayouts which means we can then serialize bindGroups - // from the calls to `setBindGroup`. - // - // This has one issue though, the user can call `setBindGroup` that - // references an implicit bindGroupLayout that is never used. Example: - // - // setBindGroup(0, bindGroupWithImplicitBGLForPipelineThatIsNotInCommandBuffer); - // setBindGroup(0, otherBindGroup); - // - // That first call is effectively a no-op as it's replaced. Even if it - // wasn't replaced it's a no-op because it could not have been used, - // otherwise an error would have been generated during encoding. - // - // So, our solution is to not serialize both the bindGroup and the call to - // setBindGroup. To skip serializing the unused bindGroup and unused call, - // we check if the implicit bindGroupLayout been assigned an id because we - // previously serialized the pipeline that created it. If there is no id - // then don't serialize either as they weren't used. CommandBufferResourceUsages usedResources; CommandIterator& commands = mCommands;
diff --git a/src/dawn/replay/Replay.h b/src/dawn/replay/Replay.h index 113943d..b114ef8 100644 --- a/src/dawn/replay/Replay.h +++ b/src/dawn/replay/Replay.h
@@ -101,8 +101,6 @@ Replay(wgpu::Device device, const Capture* capture); MaybeError CreateResource(wgpu::Device device, ReadHead& readHead); - void RegisterImplicitBindGroupLayouts(wgpu::ComputePipeline pipeline, - const std::vector<uint32_t> groupIndicies); wgpu::Device mDevice; const Capture* mCapture;