Bug 1305326 - Use D3DChecks::DoesAlphaTextureSharingWork again. r=dvander

--HG--
extra : rebase_source : 78b458c0c4f6967e5bed9da58fc00d143645e437
This commit is contained in:
Matt Woodrow 2016-09-28 13:29:46 +13:00
parent 0dfc4f3bfa
commit 584704be9c
4 changed files with 19 additions and 1 deletions

View File

@ -19,6 +19,7 @@ struct D3D11DeviceStatus
{ {
bool isWARP; bool isWARP;
bool textureSharingWorks; bool textureSharingWorks;
bool alphaTextureSharingWorks;
uint32_t featureLevel; uint32_t featureLevel;
DxgiAdapterDesc adapter; DxgiAdapterDesc adapter;
}; };

View File

@ -237,7 +237,8 @@ IMFYCbCrImage::GetTextureClient(KnowsCompositor* aForwarder)
return nullptr; return nullptr;
} }
if (!gfx::DeviceManagerDx::Get()->CanInitializeKeyedMutexTextures()) { if (!gfx::DeviceManagerDx::Get()->CanInitializeKeyedMutexTextures() ||
!gfx::DeviceManagerDx::Get()->AlphaTextureSharingWorks()) {
return nullptr; return nullptr;
} }

View File

@ -328,6 +328,7 @@ DeviceManagerDx::CreateCompositorDevice(FeatureState& d3d11)
// Only test this when not using WARP since it can fail and cause // Only test this when not using WARP since it can fail and cause
// GetDeviceRemovedReason to return weird values. // GetDeviceRemovedReason to return weird values.
bool textureSharingWorks = D3D11Checks::DoesTextureSharingWork(device); bool textureSharingWorks = D3D11Checks::DoesTextureSharingWork(device);
bool alphaTextureSharingWorks = D3D11Checks::DoesAlphaTextureSharingWork(device);
DXGI_ADAPTER_DESC desc; DXGI_ADAPTER_DESC desc;
PodZero(&desc); PodZero(&desc);
@ -355,6 +356,7 @@ DeviceManagerDx::CreateCompositorDevice(FeatureState& d3d11)
mDeviceStatus = Some(D3D11DeviceStatus( mDeviceStatus = Some(D3D11DeviceStatus(
false, false,
textureSharingWorks, textureSharingWorks,
alphaTextureSharingWorks,
featureLevel, featureLevel,
DxgiAdapterDesc::From(desc))); DxgiAdapterDesc::From(desc)));
} }
@ -409,8 +411,10 @@ DeviceManagerDx::CreateWARPCompositorDevice()
// Only test for texture sharing on Windows 8 since it puts the device into // Only test for texture sharing on Windows 8 since it puts the device into
// an unusable state if used on Windows 7 // an unusable state if used on Windows 7
bool textureSharingWorks = false; bool textureSharingWorks = false;
bool alphaTextureSharingWorks = false;
if (IsWin8OrLater()) { if (IsWin8OrLater()) {
textureSharingWorks = D3D11Checks::DoesTextureSharingWork(device); textureSharingWorks = D3D11Checks::DoesTextureSharingWork(device);
alphaTextureSharingWorks = D3D11Checks::DoesAlphaTextureSharingWork(device);
} }
DxgiAdapterDesc nullAdapter; DxgiAdapterDesc nullAdapter;
@ -423,6 +427,7 @@ DeviceManagerDx::CreateWARPCompositorDevice()
mDeviceStatus = Some(D3D11DeviceStatus( mDeviceStatus = Some(D3D11DeviceStatus(
true, true,
textureSharingWorks, textureSharingWorks,
alphaTextureSharingWorks,
featureLevel, featureLevel,
nullAdapter)); nullAdapter));
} }
@ -670,6 +675,16 @@ DeviceManagerDx::TextureSharingWorks()
return mDeviceStatus->textureSharingWorks(); return mDeviceStatus->textureSharingWorks();
} }
bool
DeviceManagerDx::AlphaTextureSharingWorks()
{
MutexAutoLock lock(mDeviceLock);
if (!mDeviceStatus) {
return false;
}
return mDeviceStatus->alphaTextureSharingWorks();
}
bool bool
DeviceManagerDx::CanInitializeKeyedMutexTextures() DeviceManagerDx::CanInitializeKeyedMutexTextures()
{ {

View File

@ -58,6 +58,7 @@ public:
unsigned GetCompositorFeatureLevel() const; unsigned GetCompositorFeatureLevel() const;
bool TextureSharingWorks(); bool TextureSharingWorks();
bool AlphaTextureSharingWorks();
bool IsWARP(); bool IsWARP();
// Returns true if we can create a texture with // Returns true if we can create a texture with