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>
This commit is contained in:
Corentin Wallez 2021-07-19 14:44:06 +00:00 committed by Dawn LUCI CQ
parent c014c74f80
commit 0f3c35c8c1
4 changed files with 8 additions and 10 deletions

View File

@ -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<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());
}

View File

@ -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;
};

View File

@ -122,6 +122,7 @@ namespace {
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 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase {
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 @@ 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<WGPUTextureUsageFlags>(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;

View File

@ -221,6 +221,7 @@ namespace {
dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc;
externalAccessDesc.acquireMutexKey = 1;
externalAccessDesc.releaseMutexKey = 2;
externalAccessDesc.isInitialized = true;
externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(textureDesc.usage);