зеркало из https://github.com/mozilla/gecko-dev.git
Null-check D3D10 devices in a few places. (bug 1225645, r=bas)
This commit is contained in:
Родитель
6458429618
Коммит
ca5b902f03
|
@ -472,6 +472,9 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
|||
}
|
||||
|
||||
srView = static_cast<SourceSurfaceD2DTarget*>(aSurface)->GetSRView();
|
||||
if (!srView) {
|
||||
return;
|
||||
}
|
||||
|
||||
EnsureViews();
|
||||
|
||||
|
@ -759,6 +762,11 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
|||
|
||||
mDevice->Draw(4, 0);
|
||||
|
||||
RefPtr<ID3D10ShaderResourceView> srView = static_cast<SourceSurfaceD2DTarget*>(aSurface)->GetSRView();
|
||||
if (!srView) {
|
||||
return;
|
||||
}
|
||||
|
||||
mPrivateData->mEffect->GetVariableByName("QuadDesc")->AsVector()->
|
||||
SetFloatVector(ShaderConstantRectD3D10(-1.0f + ((aDest.x / mSize.width) * 2.0f),
|
||||
1.0f - (aDest.y / mSize.height * 2.0f),
|
||||
|
|
|
@ -96,6 +96,11 @@ SourceSurfaceD2DTarget::GetSRView()
|
|||
return mSRView;
|
||||
}
|
||||
|
||||
if (!Factory::GetDirect3D10Device()) {
|
||||
gfxCriticalError() << "Invalid D3D10 device in D2D target surface";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HRESULT hr = Factory::GetDirect3D10Device()->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mSRView));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
|
|
|
@ -370,6 +370,9 @@ TextureClientD3D11::Unlock()
|
|||
|
||||
if (NS_IsMainThread() && mReadbackSink && mTexture10) {
|
||||
ID3D10Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D10Device();
|
||||
if (!device) {
|
||||
return;
|
||||
}
|
||||
|
||||
D3D10_TEXTURE2D_DESC desc;
|
||||
mTexture10->GetDesc(&desc);
|
||||
|
@ -588,6 +591,9 @@ TextureClientD3D11::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlag
|
|||
}
|
||||
} else {
|
||||
ID3D10Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D10Device();
|
||||
if (!device) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CD3D10_TEXTURE2D_DESC newDesc(DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||
aSize.width, aSize.height, 1, 1,
|
||||
|
@ -1235,6 +1241,9 @@ SyncObjectD3D11::FinalizeFrame()
|
|||
|
||||
if (!mD3D10Texture && mD3D10SyncedTextures.size()) {
|
||||
ID3D10Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D10Device();
|
||||
if (!device) {
|
||||
return;
|
||||
}
|
||||
|
||||
hr = device->OpenSharedResource(mHandle, __uuidof(ID3D10Texture2D), (void**)(ID3D10Texture2D**)getter_AddRefs(mD3D10Texture));
|
||||
|
||||
|
@ -1305,6 +1314,9 @@ SyncObjectD3D11::FinalizeFrame()
|
|||
box.back = box.bottom = box.right = 1;
|
||||
|
||||
ID3D10Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D10Device();
|
||||
if (!device) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto iter = mD3D10SyncedTextures.begin(); iter != mD3D10SyncedTextures.end(); iter++) {
|
||||
device->CopySubresourceRegion(mD3D10Texture, 0, 0, 0, 0, *iter, 0, &box);
|
||||
|
|
Загрузка…
Ссылка в новой задаче