зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1684412 - Pass only valid rests to Present1() r=nical
Empty rect causes error on Present1(). Differential Revision: https://phabricator.services.mozilla.com/D101557
This commit is contained in:
Родитель
404511fd71
Коммит
d99c416a10
|
@ -531,30 +531,41 @@ RenderedFrameId RenderCompositorANGLE::EndFrame(
|
|||
mFullRender = false;
|
||||
// If there is no diry rect, we skip SwapChain present.
|
||||
if (!aDirtyRects.IsEmpty()) {
|
||||
int rectsCount = 0;
|
||||
StackArray<RECT, 1> rects(aDirtyRects.Length());
|
||||
|
||||
for (size_t i = 0; i < aDirtyRects.Length(); ++i) {
|
||||
const DeviceIntRect& rect = aDirtyRects[i];
|
||||
// Clip rect to bufferSize
|
||||
rects[i].left =
|
||||
std::max(0, std::min(rect.origin.x, bufferSize.width));
|
||||
rects[i].top =
|
||||
std::max(0, std::min(rect.origin.y, bufferSize.height));
|
||||
rects[i].right = std::max(
|
||||
int left = std::max(0, std::min(rect.origin.x, bufferSize.width));
|
||||
int top = std::max(0, std::min(rect.origin.y, bufferSize.height));
|
||||
int right = std::max(
|
||||
0, std::min(rect.origin.x + rect.size.width, bufferSize.width));
|
||||
rects[i].bottom = std::max(
|
||||
int bottom = std::max(
|
||||
0, std::min(rect.origin.y + rect.size.height, bufferSize.height));
|
||||
|
||||
// When rect is not empty, the rect could be passed to Present1().
|
||||
if (left < right && top < bottom) {
|
||||
rects[rectsCount].left = left;
|
||||
rects[rectsCount].top = top;
|
||||
rects[rectsCount].right = right;
|
||||
rects[rectsCount].bottom = bottom;
|
||||
rectsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
DXGI_PRESENT_PARAMETERS params;
|
||||
PodZero(¶ms);
|
||||
params.DirtyRectsCount = aDirtyRects.Length();
|
||||
params.pDirtyRects = rects.data();
|
||||
if (rectsCount > 0) {
|
||||
DXGI_PRESENT_PARAMETERS params;
|
||||
PodZero(¶ms);
|
||||
params.DirtyRectsCount = rectsCount;
|
||||
params.pDirtyRects = rects.data();
|
||||
|
||||
HRESULT hr;
|
||||
hr = mSwapChain1->Present1(0, 0, ¶ms);
|
||||
if (FAILED(hr) && hr != DXGI_STATUS_OCCLUDED) {
|
||||
gfxCriticalNote << "Present1 failed: " << gfx::hexa(hr);
|
||||
mFullRender = true;
|
||||
HRESULT hr;
|
||||
hr = mSwapChain1->Present1(0, 0, ¶ms);
|
||||
if (FAILED(hr) && hr != DXGI_STATUS_OCCLUDED) {
|
||||
gfxCriticalNote << "Present1 failed: " << gfx::hexa(hr);
|
||||
mFullRender = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче