зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1497294 - P5. Clip source to destination size when copying the D3D11 texture. r=mattwoodrow
The Windows' hardware decoder always return an image whose dimensions are multiple of 16 pixels. As such, the image coming out of the decoder is typically bigger than the wanted image. The D3D11 documentation states that " If you try and copy outside the destination resource or specify a source box that is larger than the source resource, the behavior of CopySubresourceRegion is undefined." We've always copied from a bigger texture into a smaller one without specifying clipping. It seems to have always worked but falls into the undefined behaviour category. So to be extra safe, we clip the source so that it matches the dimension of the destination texture. Depends on D8129 Differential Revision: https://phabricator.services.mozilla.com/D8203 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
237243edf2
Коммит
c084a873d7
|
@ -970,10 +970,13 @@ D3D11DXVA2Manager::CopyToImage(IMFSample* aVideoSample,
|
|||
// Our video frame is stored in a non-sharable ID3D11Texture2D. We need
|
||||
// to create a copy of that frame as a sharable resource, save its share
|
||||
// handle, and put that handle into the rendering pipeline.
|
||||
MOZ_DIAGNOSTIC_ASSERT(outDesc.Width <= inDesc.Width &&
|
||||
outDesc.Height <= inDesc.Height);
|
||||
D3D11_BOX srcBox = { 0, 0, 0, outDesc.Width, outDesc.Height, 1 };
|
||||
|
||||
UINT index;
|
||||
dxgiBuf->GetSubresourceIndex(&index);
|
||||
mContext->CopySubresourceRegion(texture, 0, 0, 0, 0, tex, index, nullptr);
|
||||
mContext->CopySubresourceRegion(texture, 0, 0, 0, 0, tex, index, &srcBox);
|
||||
} else {
|
||||
// Use MFT to do color conversion.
|
||||
hr = E_FAIL;
|
||||
|
|
Загрузка…
Ссылка в новой задаче