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 textureSharingWorks;
bool alphaTextureSharingWorks;
uint32_t featureLevel;
DxgiAdapterDesc adapter;
};

View File

@ -237,7 +237,8 @@ IMFYCbCrImage::GetTextureClient(KnowsCompositor* aForwarder)
return nullptr;
}
if (!gfx::DeviceManagerDx::Get()->CanInitializeKeyedMutexTextures()) {
if (!gfx::DeviceManagerDx::Get()->CanInitializeKeyedMutexTextures() ||
!gfx::DeviceManagerDx::Get()->AlphaTextureSharingWorks()) {
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
// GetDeviceRemovedReason to return weird values.
bool textureSharingWorks = D3D11Checks::DoesTextureSharingWork(device);
bool alphaTextureSharingWorks = D3D11Checks::DoesAlphaTextureSharingWork(device);
DXGI_ADAPTER_DESC desc;
PodZero(&desc);
@ -355,6 +356,7 @@ DeviceManagerDx::CreateCompositorDevice(FeatureState& d3d11)
mDeviceStatus = Some(D3D11DeviceStatus(
false,
textureSharingWorks,
alphaTextureSharingWorks,
featureLevel,
DxgiAdapterDesc::From(desc)));
}
@ -409,8 +411,10 @@ DeviceManagerDx::CreateWARPCompositorDevice()
// Only test for texture sharing on Windows 8 since it puts the device into
// an unusable state if used on Windows 7
bool textureSharingWorks = false;
bool alphaTextureSharingWorks = false;
if (IsWin8OrLater()) {
textureSharingWorks = D3D11Checks::DoesTextureSharingWork(device);
alphaTextureSharingWorks = D3D11Checks::DoesAlphaTextureSharingWork(device);
}
DxgiAdapterDesc nullAdapter;
@ -423,6 +427,7 @@ DeviceManagerDx::CreateWARPCompositorDevice()
mDeviceStatus = Some(D3D11DeviceStatus(
true,
textureSharingWorks,
alphaTextureSharingWorks,
featureLevel,
nullAdapter));
}
@ -670,6 +675,16 @@ DeviceManagerDx::TextureSharingWorks()
return mDeviceStatus->textureSharingWorks();
}
bool
DeviceManagerDx::AlphaTextureSharingWorks()
{
MutexAutoLock lock(mDeviceLock);
if (!mDeviceStatus) {
return false;
}
return mDeviceStatus->alphaTextureSharingWorks();
}
bool
DeviceManagerDx::CanInitializeKeyedMutexTextures()
{

View File

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