Bug 1687265 - clear out old SWGL framebuffer after frame ends. r=jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D102493
This commit is contained in:
Lee Salzman 2021-01-21 00:42:11 +00:00
parent 54a8c3feb4
commit 8f06a347bd
3 changed files with 6 additions and 1 deletions

View File

@ -579,12 +579,14 @@ bool RenderCompositorNativeSWGL::InitDefaultFramebuffer(
void RenderCompositorNativeSWGL::CancelFrame() {
if (mNativeLayerForEntireWindow && mLayerTarget) {
wr_swgl_init_default_framebuffer(mContext, 0, 0, 0, 0, 0, nullptr);
UnmapNativeLayer();
}
}
void RenderCompositorNativeSWGL::DoSwap() {
if (mNativeLayerForEntireWindow && mLayerTarget) {
wr_swgl_init_default_framebuffer(mContext, 0, 0, 0, 0, 0, nullptr);
UnmapNativeLayer();
}
}

View File

@ -151,6 +151,9 @@ void RenderCompositorSWGL::CommitMappedBuffer(bool aDirty) {
if (!mDT) {
return;
}
// Clear out the old framebuffer in case something tries to access it after
// the frame.
wr_swgl_init_default_framebuffer(mContext, 0, 0, 0, 0, 0, nullptr);
// If we have a draw target at this point, mapping must have succeeded.
MOZ_ASSERT(mMappedData != nullptr);
if (mSurface) {

View File

@ -648,7 +648,7 @@ struct Texture {
// otherwise change too much...
size_t max_stride = max(buf_stride, aligned_stride(buf_bpp * min_width));
size_t size = max_stride * max(height, min_height) * max(depth, 1);
if (!buf || size > buf_size) {
if ((!buf && size > 0) || size > buf_size) {
// Allocate with a SIMD register-sized tail of padding at the end so we
// can safely read or write past the end of the texture with SIMD ops.
// Currently only the flat Z-buffer texture needs this padding due to