From 956a2fc7802b36a9bcac770c03191a091f65a16c Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Fri, 19 May 2023 23:21:44 +0000 Subject: [PATCH] d3d11: fix ASSERT() crash in d3d11::BindGroupTracker::unApplyNindGroup() Bug: dawn:1705 Change-Id: I87d464c5321375a96aa4926a0968e6acab7194e4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133760 Reviewed-by: Austin Eng Kokoro: Kokoro Commit-Queue: Peng Huang --- src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp b/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp index a33897ced5..d7be5c0dc2 100644 --- a/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp +++ b/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp @@ -101,10 +101,11 @@ MaybeError BindGroupTracker::Apply() { // conflict, we need to unbind groups which are not used by the new pipeline. and unbind groups // which are not inherited by the new pipeline. if (mLastAppliedPipelineLayout) { - BindGroupLayoutMask unusedGroups = mLastAppliedPipelineLayout->GetBindGroupLayoutsMask() & - ~mPipelineLayout->GetBindGroupLayoutsMask(); + BindGroupLayoutMask lastGroups = mLastAppliedPipelineLayout->GetBindGroupLayoutsMask(); + BindGroupLayoutMask currentGroups = mPipelineLayout->GetBindGroupLayoutsMask(); + BindGroupLayoutMask unApplyGroups = (mDirtyBindGroups | ~currentGroups) & lastGroups; // Unset bind groups which are not used by the new pipeline and are not inherited. - for (BindGroupIndex index : IterateBitSet(mDirtyBindGroups | unusedGroups)) { + for (BindGroupIndex index : IterateBitSet(unApplyGroups)) { UnApplyBindGroup(index); } }