diff --git a/src/dawn_native/d3d12/D3D12Backend.cpp b/src/dawn_native/d3d12/D3D12Backend.cpp index a363757f02..fc10fe3a43 100644 --- a/src/dawn_native/d3d12/D3D12Backend.cpp +++ b/src/dawn_native/d3d12/D3D12Backend.cpp @@ -84,16 +84,10 @@ namespace dawn_native { namespace d3d12 { 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 texture = backendDevice->CreateExternalTexture( &textureDescriptor, mD3D12Resource, ExternalMutexSerial(descriptor->acquireMutexKey), - releaseMutexKey, descriptor->isSwapChainTexture, descriptor->isInitialized); + ExternalMutexSerial(descriptor->releaseMutexKey), descriptor->isSwapChainTexture, + descriptor->isInitialized); return reinterpret_cast(texture.Detach()); } diff --git a/src/include/dawn_native/D3D12Backend.h b/src/include/dawn_native/D3D12Backend.h index e545ee1949..cfddcc2a67 100644 --- a/src/include/dawn_native/D3D12Backend.h +++ b/src/include/dawn_native/D3D12Backend.h @@ -56,8 +56,7 @@ namespace dawn_native { namespace d3d12 { : 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 ce92a1050c..7050dfe0c5 100644 --- a/src/tests/end2end/D3D12ResourceWrappingTests.cpp +++ b/src/tests/end2end/D3D12ResourceWrappingTests.cpp @@ -122,6 +122,7 @@ namespace { dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; externalAccessDesc.acquireMutexKey = 0; + externalAccessDesc.releaseMutexKey = 1; externalAccessDesc.usage = static_cast(dawnDesc->usage); *dawnTexture = wgpu::Texture::Acquire( @@ -361,6 +362,7 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase { dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; externalAccessDesc.acquireMutexKey = 1; + externalAccessDesc.releaseMutexKey = 2; externalAccessDesc.isInitialized = isInitialized; externalAccessDesc.usage = static_cast(dawnDescriptor->usage); @@ -582,6 +584,7 @@ TEST_P(D3D12SharedHandleUsageTests, ReuseExternalImage) { // 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(baseDawnDescriptor.usage); @@ -607,6 +610,7 @@ TEST_P(D3D12SharedHandleUsageTests, ExternalImageUsage) { 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 187cbb7578..165b700e43 100644 --- a/src/tests/end2end/D3D12VideoViewsTests.cpp +++ b/src/tests/end2end/D3D12VideoViewsTests.cpp @@ -221,6 +221,7 @@ namespace { dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; externalAccessDesc.acquireMutexKey = 1; + externalAccessDesc.releaseMutexKey = 2; externalAccessDesc.isInitialized = true; externalAccessDesc.usage = static_cast(textureDesc.usage);