@@ -40,29 +40,18 @@ WebGL2Context::BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY
4040
4141 // //
4242
43- const auto & readFB = mBoundReadFramebuffer ;
44- if (readFB &&
45- !readFB->ValidateAndInitAttachments (" blitFramebuffer's READ_FRAMEBUFFER" ))
43+ if (!ValidateAndInitFB (" blitFramebuffer: READ_FRAMEBUFFER" , mBoundReadFramebuffer ) ||
44+ !ValidateAndInitFB (" blitFramebuffer: DRAW_FRAMEBUFFER" , mBoundDrawFramebuffer ))
4645 {
4746 return ;
4847 }
4948
50- const auto & drawFB = mBoundDrawFramebuffer ;
51- if (drawFB &&
52- !drawFB->ValidateAndInitAttachments (" blitFramebuffer's DRAW_FRAMEBUFFER" ))
53- {
54- return ;
55- }
56-
57- // //
58-
59- if (!mBoundReadFramebuffer ) {
60- ClearBackbufferIfNeeded ();
61- }
49+ DoBindFB (mBoundReadFramebuffer , LOCAL_GL_READ_FRAMEBUFFER );
50+ DoBindFB (mBoundDrawFramebuffer , LOCAL_GL_DRAW_FRAMEBUFFER );
6251
6352 WebGLFramebuffer::BlitFramebuffer (this ,
64- readFB, srcX0, srcY0, srcX1, srcY1,
65- drawFB, dstX0, dstY0, dstX1, dstY1,
53+ srcX0, srcY0, srcX1, srcY1,
54+ dstX0, dstY0, dstX1, dstY1,
6655 mask, filter);
6756}
6857
@@ -170,23 +159,25 @@ WebGLContext::ValidateInvalidateFramebuffer(const char* funcName, GLenum target,
170159 return false ;
171160
172161 const WebGLFramebuffer* fb;
173- bool isDefaultFB;
162+ bool isDefaultFB = false ;
174163 switch (target) {
175164 case LOCAL_GL_FRAMEBUFFER :
176165 case LOCAL_GL_DRAW_FRAMEBUFFER :
177166 fb = mBoundDrawFramebuffer ;
178- isDefaultFB = gl->Screen ()->IsDrawFramebufferDefault ();
179167 break ;
180168
181169 case LOCAL_GL_READ_FRAMEBUFFER :
182170 fb = mBoundReadFramebuffer ;
183- isDefaultFB = gl->Screen ()->IsReadFramebufferDefault ();
184171 break ;
185172
186173 default :
187174 MOZ_CRASH (" GFX: Bad target." );
188175 }
189176
177+ if (!ValidateAndInitFB (funcName, fb))
178+ return false ;
179+ DoBindFB (fb, target);
180+
190181 *out_glNumAttachments = attachments.Length ();
191182 *out_glAttachments = attachments.Elements ();
192183
@@ -230,13 +221,9 @@ WebGLContext::ValidateInvalidateFramebuffer(const char* funcName, GLenum target,
230221 // //
231222
232223 if (!fb) {
233- ClearBackbufferIfNeeded ();
234-
235- // Don't do more validation after these.
236- Invalidate ();
237- mShouldPresent = true ;
224+ mDefaultFB_IsInvalid = true ;
225+ mResolvedDefaultFB = nullptr ;
238226 }
239-
240227 return true ;
241228}
242229
@@ -331,7 +318,7 @@ WebGL2Context::ReadBuffer(GLenum mode)
331318 return ;
332319 }
333320
334- gl-> Screen ()-> SetReadBuffer ( mode) ;
321+ mDefaultFB_ReadBuffer = mode;
335322}
336323
337324} // namespace mozilla
0 commit comments