D3D12: Bucket CPU descriptor allocators on the device.

Move the CPU descriptor allocators to the device and bucket them to
ensure only kMaxBindingsPerGroup exist rather than create them per BGL.

Also, renames NonShaderVisible => Staging.

BUG=dawn:155

Change-Id: If6dae368e7e2a2b349343bdf898041a049159038
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19001
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/white_box/D3D12DescriptorHeapTests.cpp b/src/tests/white_box/D3D12DescriptorHeapTests.cpp
index 665bddd..455b454 100644
--- a/src/tests/white_box/D3D12DescriptorHeapTests.cpp
+++ b/src/tests/white_box/D3D12DescriptorHeapTests.cpp
@@ -17,8 +17,8 @@
 #include "dawn_native/Toggles.h"
 #include "dawn_native/d3d12/BindGroupLayoutD3D12.h"
 #include "dawn_native/d3d12/DeviceD3D12.h"
-#include "dawn_native/d3d12/NonShaderVisibleDescriptorAllocatorD3D12.h"
 #include "dawn_native/d3d12/ShaderVisibleDescriptorAllocatorD3D12.h"
+#include "dawn_native/d3d12/StagingDescriptorAllocatorD3D12.h"
 #include "utils/ComboRenderPipelineDescriptor.h"
 #include "utils/WGPUHelpers.h"
 
@@ -94,11 +94,11 @@
     wgpu::ShaderModule mSimpleFSModule;
 };
 
-class DummyNonShaderVisibleDescriptorAllocator {
+class DummyStagingDescriptorAllocator {
   public:
-    DummyNonShaderVisibleDescriptorAllocator(Device* device,
-                                             uint32_t descriptorCount,
-                                             uint32_t allocationsPerHeap)
+    DummyStagingDescriptorAllocator(Device* device,
+                                    uint32_t descriptorCount,
+                                    uint32_t allocationsPerHeap)
         : mAllocator(device,
                      descriptorCount,
                      allocationsPerHeap * descriptorCount,
@@ -116,7 +116,7 @@
     }
 
   private:
-    NonShaderVisibleDescriptorAllocator mAllocator;
+    StagingDescriptorAllocator mAllocator;
 };
 
 // Verify the shader visible heaps switch over within a single submit.
@@ -719,8 +719,7 @@
 TEST_P(D3D12DescriptorHeapTests, Single) {
     constexpr uint32_t kDescriptorCount = 4;
     constexpr uint32_t kAllocationsPerHeap = 3;
-    DummyNonShaderVisibleDescriptorAllocator allocator(mD3DDevice, kDescriptorCount,
-                                                       kAllocationsPerHeap);
+    DummyStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, kAllocationsPerHeap);
 
     CPUDescriptorHeapAllocation allocation = allocator.AllocateCPUDescriptors();
     EXPECT_EQ(allocation.GetHeapIndex(), 0u);
@@ -735,8 +734,7 @@
 TEST_P(D3D12DescriptorHeapTests, Sequential) {
     constexpr uint32_t kDescriptorCount = 4;
     constexpr uint32_t kAllocationsPerHeap = 3;
-    DummyNonShaderVisibleDescriptorAllocator allocator(mD3DDevice, kDescriptorCount,
-                                                       kAllocationsPerHeap);
+    DummyStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, kAllocationsPerHeap);
 
     // Allocate |kNumOfHeaps| worth.
     constexpr uint32_t kNumOfHeaps = 2;
@@ -766,8 +764,7 @@
 TEST_P(D3D12DescriptorHeapTests, ReuseFreedHeaps) {
     constexpr uint32_t kDescriptorCount = 4;
     constexpr uint32_t kAllocationsPerHeap = 25;
-    DummyNonShaderVisibleDescriptorAllocator allocator(mD3DDevice, kDescriptorCount,
-                                                       kAllocationsPerHeap);
+    DummyStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, kAllocationsPerHeap);
 
     constexpr uint32_t kNumofHeaps = 10;
 
@@ -810,8 +807,7 @@
 TEST_P(D3D12DescriptorHeapTests, AllocateDeallocateMany) {
     constexpr uint32_t kDescriptorCount = 4;
     constexpr uint32_t kAllocationsPerHeap = 25;
-    DummyNonShaderVisibleDescriptorAllocator allocator(mD3DDevice, kDescriptorCount,
-                                                       kAllocationsPerHeap);
+    DummyStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, kAllocationsPerHeap);
 
     std::list<CPUDescriptorHeapAllocation> list3;
     std::list<CPUDescriptorHeapAllocation> list5;