[dawn][headers] Cleans up subgroup limits and uses constants.

- Follow up to the following comment now that the usages are updated:
  https://dawn-review.googlesource.com/c/dawn/+/241874/comments/161882c6_06c16fdf

Change-Id: I5f972873b648fa2499f8e141275a38a802119077
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/244514
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Loko Kung <lokokung@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
diff --git a/src/dawn/common/Constants.h b/src/dawn/common/Constants.h
index bcc5773..edfe485 100644
--- a/src/dawn/common/Constants.h
+++ b/src/dawn/common/Constants.h
@@ -64,6 +64,10 @@
 // Device Default limitation for user immediate constants is 16 bytes.
 static constexpr uint32_t kDefaultMaxImmediateDataBytes = 16u;
 
+// Default subgroup sizes.
+static constexpr uint32_t kDefaultSubgroupMinSize = 4u;
+static constexpr uint32_t kDefaultSubgroupMaxSize = 128u;
+
 // Per stage maximum limits used to optimized Dawn internals.
 static constexpr uint32_t kMaxSampledTexturesPerShaderStage = 16;
 static constexpr uint32_t kMaxSamplersPerShaderStage = 16;
diff --git a/src/dawn/native/PhysicalDevice.h b/src/dawn/native/PhysicalDevice.h
index c68d7ff..6a888e1 100644
--- a/src/dawn/native/PhysicalDevice.h
+++ b/src/dawn/native/PhysicalDevice.h
@@ -143,8 +143,8 @@
     std::string mDriverDescription;
     // When the feature is *not* supported, these must be 4 and 128. Set those defaults now, but a
     // backend may override this.
-    uint32_t mSubgroupMinSize = 4;
-    uint32_t mSubgroupMaxSize = 128;
+    uint32_t mSubgroupMinSize = kDefaultSubgroupMinSize;
+    uint32_t mSubgroupMaxSize = kDefaultSubgroupMaxSize;
 
     // Juat a wrapper of ValidateFeatureSupportedWithToggles, return true if a feature is supported
     // by this adapter AND suitable with given toggles.
diff --git a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
index 0c07c81..e54c7f7 100644
--- a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
+++ b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
@@ -473,7 +473,8 @@
         (mDeviceInfo.shaderSubgroupExtendedTypes.shaderSubgroupExtendedTypes == VK_TRUE);
 
     // Some devices (PowerVR GE8320) can apparently report subgroup size of 1.
-    const bool allowSubgroupSizeRanges = mSubgroupMinSize >= 4u && mSubgroupMaxSize <= 128u;
+    const bool allowSubgroupSizeRanges =
+        mSubgroupMinSize >= kDefaultSubgroupMinSize && mSubgroupMaxSize <= kDefaultSubgroupMaxSize;
     if (!kForceDisableSubgroups && hasBaseSubgroupSupport && hasRequiredF16Support &&
         allowSubgroupSizeRanges) {
         EnableFeature(Feature::Subgroups);
diff --git a/src/dawn/tests/end2end/SubgroupsTests.cpp b/src/dawn/tests/end2end/SubgroupsTests.cpp
index b7db8c6..89e8c59 100644
--- a/src/dawn/tests/end2end/SubgroupsTests.cpp
+++ b/src/dawn/tests/end2end/SubgroupsTests.cpp
@@ -74,10 +74,10 @@
 
     // Checks valid values for min and max subgroup sizes, per spec.
     void CheckValidSizes(uint32_t subgroupMinSize, uint32_t subgroupMaxSize) {
-        EXPECT_GE(subgroupMinSize, 4u) << subgroupMinSize;
+        EXPECT_GE(subgroupMinSize, kDefaultSubgroupMinSize) << subgroupMinSize;
         EXPECT_TRUE(IsPowerOfTwo(subgroupMinSize)) << subgroupMinSize;
 
-        EXPECT_LE(subgroupMaxSize, 128u) << subgroupMaxSize;
+        EXPECT_LE(subgroupMaxSize, kDefaultSubgroupMaxSize) << subgroupMaxSize;
         EXPECT_TRUE(IsPowerOfTwo(subgroupMaxSize));
 
         EXPECT_LE(subgroupMinSize, subgroupMaxSize)
@@ -237,7 +237,7 @@
                     // subgroup_size should be at least 1
                     (1 <= outputSubgroupSizeAt0) &&
                     // subgroup_size should be no larger than 128
-                    (outputSubgroupSizeAt0 <= 128) &&
+                    (outputSubgroupSizeAt0 <= kDefaultSubgroupMaxSize) &&
                     // subgroup_size should be a power of 2
                     ((outputSubgroupSizeAt0 & (outputSubgroupSizeAt0 - 1)) == 0))) {
                 testing::AssertionResult result = testing::AssertionFailure()
@@ -369,7 +369,7 @@
                     // subgroup_size should be at least 1
                     (1 <= outputSubgroupSizeAt0) &&
                     // subgroup_size should be no larger than 128
-                    (outputSubgroupSizeAt0 <= 128) &&
+                    (outputSubgroupSizeAt0 <= kDefaultSubgroupMaxSize) &&
                     // subgroup_size should be a power of 2
                     (IsPowerOfTwo(outputSubgroupSizeAt0)))) {
                 testing::AssertionResult result = testing::AssertionFailure()
diff --git a/src/dawn/tests/unittests/wire/WireInstanceTests.cpp b/src/dawn/tests/unittests/wire/WireInstanceTests.cpp
index bcb37b1..369bc89 100644
--- a/src/dawn/tests/unittests/wire/WireInstanceTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireInstanceTests.cpp
@@ -29,6 +29,7 @@
 #include <unordered_set>
 #include <vector>
 
+#include "dawn/common/Constants.h"
 #include "dawn/common/StringViewUtils.h"
 #include "dawn/tests/MockCallback.h"
 #include "dawn/tests/StringViewMatchers.h"
@@ -127,8 +128,8 @@
     fakeInfo.adapterType = WGPUAdapterType_IntegratedGPU;
     fakeInfo.vendorID = 0x134;
     fakeInfo.deviceID = 0x918;
-    fakeInfo.subgroupMinSize = 4;
-    fakeInfo.subgroupMaxSize = 128;
+    fakeInfo.subgroupMinSize = kDefaultSubgroupMinSize;
+    fakeInfo.subgroupMaxSize = kDefaultSubgroupMaxSize;
 
     wgpu::Limits fakeLimits = {};
     fakeLimits.maxTextureDimension1D = 433;