зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1015718 - Deserialize the DXGI handle when constructing the TextureHost rather than when locking it. r=nical
This commit is contained in:
Родитель
27e075e0aa
Коммит
024807715d
|
@ -310,12 +310,23 @@ DXGITextureHostD3D11::DXGITextureHostD3D11(TextureFlags aFlags,
|
|||
, mHandle(aDescriptor.handle())
|
||||
, mFormat(aDescriptor.format())
|
||||
, mIsLocked(false)
|
||||
{}
|
||||
{
|
||||
HRESULT hr = GetDevice()->OpenSharedResource((HANDLE)mHandle,
|
||||
__uuidof(ID3D11Texture2D),
|
||||
(void**)(ID3D11Texture2D**)byRef(mTexture));
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("Failed to open shared texture");
|
||||
}
|
||||
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
mTexture->GetDesc(&desc);
|
||||
mSize = IntSize(desc.Width, desc.Height);
|
||||
}
|
||||
|
||||
ID3D11Device*
|
||||
DXGITextureHostD3D11::GetDevice()
|
||||
{
|
||||
return mCompositor ? mCompositor->GetDevice() : nullptr;
|
||||
return gfxWindowsPlatform::GetPlatform()->GetD3D11Device();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -332,19 +343,11 @@ DXGITextureHostD3D11::Lock()
|
|||
return false;
|
||||
}
|
||||
if (!mTextureSource) {
|
||||
RefPtr<ID3D11Texture2D> tex;
|
||||
HRESULT hr = GetDevice()->OpenSharedResource((HANDLE)mHandle,
|
||||
__uuidof(ID3D11Texture2D),
|
||||
(void**)(ID3D11Texture2D**)byRef(tex));
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("Failed to open shared texture");
|
||||
if (!mTexture) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mTextureSource = new DataTextureSourceD3D11(mFormat, mCompositor, tex);
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
tex->GetDesc(&desc);
|
||||
mSize = IntSize(desc.Width, desc.Height);
|
||||
mTextureSource = new DataTextureSourceD3D11(mFormat, mCompositor, mTexture);
|
||||
}
|
||||
|
||||
mIsLocked = LockD3DTexture(mTextureSource->GetD3D11Texture());
|
||||
|
|
|
@ -193,6 +193,7 @@ public:
|
|||
protected:
|
||||
ID3D11Device* GetDevice();
|
||||
|
||||
RefPtr<ID3D11Texture2D> mTexture;
|
||||
RefPtr<DataTextureSourceD3D11> mTextureSource;
|
||||
RefPtr<CompositorD3D11> mCompositor;
|
||||
gfx::IntSize mSize;
|
||||
|
|
Загрузка…
Ссылка в новой задаче