Remove deprecated ExternalImageAccessDescriptorDXGIKeyedMutex behavior

Previously Dawn was using acquireKey + 1 for the releaseKey but we
changed the code transition to requiring a specific key. We supported
both options for a time but now that Chromium uses a releaseKey, we can
remove the deprecated option.

Bug: chromium:1213977
Change-Id: Iab253673c15b83b107dcc3635ee165cfa09efeb6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/58383
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn_native/d3d12/D3D12Backend.cpp b/src/dawn_native/d3d12/D3D12Backend.cpp
index a363757..fc10fe3 100644
--- a/src/dawn_native/d3d12/D3D12Backend.cpp
+++ b/src/dawn_native/d3d12/D3D12Backend.cpp
@@ -84,16 +84,10 @@
         textureDescriptor.mipLevelCount = mMipLevelCount;
         textureDescriptor.sampleCount = mSampleCount;
 
-        // Set the release key to acquire key + 1 if not set. This allows supporting the old keyed
-        // mutex protocol during the transition to making this a required parameter.
-        ExternalMutexSerial releaseMutexKey =
-            (descriptor->releaseMutexKey != UINT64_MAX)
-                ? ExternalMutexSerial(descriptor->releaseMutexKey)
-                : ExternalMutexSerial(descriptor->acquireMutexKey + 1);
-
         Ref<TextureBase> texture = backendDevice->CreateExternalTexture(
             &textureDescriptor, mD3D12Resource, ExternalMutexSerial(descriptor->acquireMutexKey),
-            releaseMutexKey, descriptor->isSwapChainTexture, descriptor->isInitialized);
+            ExternalMutexSerial(descriptor->releaseMutexKey), descriptor->isSwapChainTexture,
+            descriptor->isInitialized);
         return reinterpret_cast<WGPUTexture>(texture.Detach());
     }
 
diff --git a/src/include/dawn_native/D3D12Backend.h b/src/include/dawn_native/D3D12Backend.h
index e545ee1..cfddcc2 100644
--- a/src/include/dawn_native/D3D12Backend.h
+++ b/src/include/dawn_native/D3D12Backend.h
@@ -56,8 +56,7 @@
         : ExternalImageAccessDescriptor {
       public:
         uint64_t acquireMutexKey;
-        // Release key will be set to acquireMutexKey + 1 if set to sentinel value UINT64_MAX.
-        uint64_t releaseMutexKey = UINT64_MAX;
+        uint64_t releaseMutexKey;
         bool isSwapChainTexture = false;
     };
 
diff --git a/src/tests/end2end/D3D12ResourceWrappingTests.cpp b/src/tests/end2end/D3D12ResourceWrappingTests.cpp
index ce92a10..7050dfe 100644
--- a/src/tests/end2end/D3D12ResourceWrappingTests.cpp
+++ b/src/tests/end2end/D3D12ResourceWrappingTests.cpp
@@ -122,6 +122,7 @@
 
             dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc;
             externalAccessDesc.acquireMutexKey = 0;
+            externalAccessDesc.releaseMutexKey = 1;
             externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(dawnDesc->usage);
 
             *dawnTexture = wgpu::Texture::Acquire(
@@ -361,6 +362,7 @@
 
         dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc;
         externalAccessDesc.acquireMutexKey = 1;
+        externalAccessDesc.releaseMutexKey = 2;
         externalAccessDesc.isInitialized = isInitialized;
         externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(dawnDescriptor->usage);
 
@@ -582,6 +584,7 @@
     // Create another Dawn texture then clear it with another color.
     dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc;
     externalAccessDesc.acquireMutexKey = 1;
+    externalAccessDesc.releaseMutexKey = 2;
     externalAccessDesc.isInitialized = true;
     externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(baseDawnDescriptor.usage);
 
@@ -607,6 +610,7 @@
 
     dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc;
     externalAccessDesc.acquireMutexKey = 1;
+    externalAccessDesc.releaseMutexKey = 2;
     externalAccessDesc.isInitialized = true;
 
     wgpu::Texture texture;
diff --git a/src/tests/end2end/D3D12VideoViewsTests.cpp b/src/tests/end2end/D3D12VideoViewsTests.cpp
index 187cbb7..165b700 100644
--- a/src/tests/end2end/D3D12VideoViewsTests.cpp
+++ b/src/tests/end2end/D3D12VideoViewsTests.cpp
@@ -221,6 +221,7 @@
 
             dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc;
             externalAccessDesc.acquireMutexKey = 1;
+            externalAccessDesc.releaseMutexKey = 2;
             externalAccessDesc.isInitialized = true;
             externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(textureDesc.usage);