Support D3D12RelaxMinSubgroupSizeTo8 toggle in new subgroup size API

Bug: 354751907
Change-Id: I686a1c94083f35aab0fd9ab0cd4163b59efd2d64
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/219154
Reviewed-by: Loko Kung <lokokung@google.com>
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
diff --git a/src/dawn/native/Adapter.cpp b/src/dawn/native/Adapter.cpp
index 4b45b96..f958918 100644
--- a/src/dawn/native/Adapter.cpp
+++ b/src/dawn/native/Adapter.cpp
@@ -203,6 +203,14 @@
 
     mPhysicalDevice->PopulateBackendProperties(unpacked);
 
+    if (auto* subgroupsProperties = unpacked.Get<AdapterPropertiesSubgroups>()) {
+        if (mPhysicalDevice->GetBackendType() == wgpu::BackendType::D3D12 &&
+            mTogglesState.IsEnabled(Toggle::D3D12RelaxMinSubgroupSizeTo8)) {
+            subgroupsProperties->subgroupMinSize =
+                std::min(subgroupsProperties->subgroupMinSize, 8u);
+        }
+    }
+
     // Allocate space for all strings.
     size_t allocSize = mPhysicalDevice->GetVendorName().length() +
                        mPhysicalDevice->GetArchitectureName().length() +
diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp
index c996700..48f29e6 100644
--- a/src/dawn/native/Device.cpp
+++ b/src/dawn/native/Device.cpp
@@ -374,6 +374,8 @@
         GetDefaultLimits(&mLimits.v1, adapter->GetFeatureLevel());
     }
     // Get experimentalSubgroupLimits from physical device
+    // TODO(crbug.com/382520104): Remove this since these are now exposed as
+    // properties on AdapterInfo.
     mLimits.experimentalSubgroupLimits =
         GetPhysicalDevice()->GetLimits().experimentalSubgroupLimits;
     if (GetPhysicalDevice()->GetBackendType() == wgpu::BackendType::D3D12 &&