OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // Set the initial size and format of a render texture or resize it. | 196 // Set the initial size and format of a render texture or resize it. |
197 bool AllocateStorage(const gfx::Size& size, GLenum format); | 197 bool AllocateStorage(const gfx::Size& size, GLenum format); |
198 | 198 |
199 // Copy the contents of the currently bound frame buffer. | 199 // Copy the contents of the currently bound frame buffer. |
200 void Copy(const gfx::Size& size); | 200 void Copy(const gfx::Size& size); |
201 | 201 |
202 // Destroy the render texture. This must be explicitly called before | 202 // Destroy the render texture. This must be explicitly called before |
203 // destroying this object. | 203 // destroying this object. |
204 void Destroy(); | 204 void Destroy(); |
205 | 205 |
| 206 // Invalidate the texture. This can be used when a context is lost and it is |
| 207 // not possible to make it current in order to free the resource. |
| 208 void Invalidate(); |
| 209 |
206 GLuint id() const { | 210 GLuint id() const { |
207 return id_; | 211 return id_; |
208 } | 212 } |
209 | 213 |
210 gfx::Size size() const { | 214 gfx::Size size() const { |
211 return size_; | 215 return size_; |
212 } | 216 } |
213 | 217 |
214 private: | 218 private: |
215 GLES2DecoderImpl* decoder_; | 219 GLES2DecoderImpl* decoder_; |
(...skipping 11 matching lines...) Expand all Loading... |
227 // Create a new render buffer. | 231 // Create a new render buffer. |
228 void Create(); | 232 void Create(); |
229 | 233 |
230 // Set the initial size and format of a render buffer or resize it. | 234 // Set the initial size and format of a render buffer or resize it. |
231 bool AllocateStorage(const gfx::Size& size, GLenum format, GLsizei samples); | 235 bool AllocateStorage(const gfx::Size& size, GLenum format, GLsizei samples); |
232 | 236 |
233 // Destroy the render buffer. This must be explicitly called before destroying | 237 // Destroy the render buffer. This must be explicitly called before destroying |
234 // this object. | 238 // this object. |
235 void Destroy(); | 239 void Destroy(); |
236 | 240 |
| 241 // Invalidate the render buffer. This can be used when a context is lost and |
| 242 // it is not possible to make it current in order to free the resource. |
| 243 void Invalidate(); |
| 244 |
237 GLuint id() const { | 245 GLuint id() const { |
238 return id_; | 246 return id_; |
239 } | 247 } |
240 | 248 |
241 private: | 249 private: |
242 GLES2DecoderImpl* decoder_; | 250 GLES2DecoderImpl* decoder_; |
243 GLuint id_; | 251 GLuint id_; |
244 DISALLOW_COPY_AND_ASSIGN(RenderBuffer); | 252 DISALLOW_COPY_AND_ASSIGN(RenderBuffer); |
245 }; | 253 }; |
246 | 254 |
(...skipping 13 matching lines...) Expand all Loading... |
260 // currently bound frame buffer. | 268 // currently bound frame buffer. |
261 void AttachRenderBuffer(GLenum target, RenderBuffer* render_buffer); | 269 void AttachRenderBuffer(GLenum target, RenderBuffer* render_buffer); |
262 | 270 |
263 // Clear the given attached buffers. | 271 // Clear the given attached buffers. |
264 void Clear(GLbitfield buffers); | 272 void Clear(GLbitfield buffers); |
265 | 273 |
266 // Destroy the frame buffer. This must be explicitly called before destroying | 274 // Destroy the frame buffer. This must be explicitly called before destroying |
267 // this object. | 275 // this object. |
268 void Destroy(); | 276 void Destroy(); |
269 | 277 |
| 278 // Invalidate the frame buffer. This can be used when a context is lost and it |
| 279 // is not possible to make it current in order to free the resource. |
| 280 void Invalidate(); |
| 281 |
270 // See glCheckFramebufferStatusEXT. | 282 // See glCheckFramebufferStatusEXT. |
271 GLenum CheckStatus(); | 283 GLenum CheckStatus(); |
272 | 284 |
273 GLuint id() const { | 285 GLuint id() const { |
274 return id_; | 286 return id_; |
275 } | 287 } |
276 | 288 |
277 private: | 289 private: |
278 GLES2DecoderImpl* decoder_; | 290 GLES2DecoderImpl* decoder_; |
279 GLuint id_; | 291 GLuint id_; |
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 GLenum offscreen_target_depth_format_; | 1374 GLenum offscreen_target_depth_format_; |
1363 GLenum offscreen_target_stencil_format_; | 1375 GLenum offscreen_target_stencil_format_; |
1364 GLsizei offscreen_target_samples_; | 1376 GLsizei offscreen_target_samples_; |
1365 | 1377 |
1366 GLuint copy_texture_to_parent_texture_fb_; | 1378 GLuint copy_texture_to_parent_texture_fb_; |
1367 | 1379 |
1368 // The copy that is saved when SwapBuffers is called. It is also | 1380 // The copy that is saved when SwapBuffers is called. It is also |
1369 // used as the destination for multi-sample resolves. | 1381 // used as the destination for multi-sample resolves. |
1370 scoped_ptr<FrameBuffer> offscreen_saved_frame_buffer_; | 1382 scoped_ptr<FrameBuffer> offscreen_saved_frame_buffer_; |
1371 scoped_ptr<Texture> offscreen_saved_color_texture_; | 1383 scoped_ptr<Texture> offscreen_saved_color_texture_; |
| 1384 GLenum offscreen_saved_color_format_; |
1372 | 1385 |
1373 scoped_ptr<Callback0::Type> swap_buffers_callback_; | 1386 scoped_ptr<Callback0::Type> swap_buffers_callback_; |
1374 | 1387 |
1375 // The last error message set. | 1388 // The last error message set. |
1376 std::string last_error_; | 1389 std::string last_error_; |
1377 | 1390 |
1378 // The current decoder error. | 1391 // The current decoder error. |
1379 error::Error current_decoder_error_; | 1392 error::Error current_decoder_error_; |
1380 | 1393 |
1381 bool use_shader_translator_; | 1394 bool use_shader_translator_; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 } | 1546 } |
1534 | 1547 |
1535 void Texture::Destroy() { | 1548 void Texture::Destroy() { |
1536 if (id_ != 0) { | 1549 if (id_ != 0) { |
1537 ScopedGLErrorSuppressor suppressor(decoder_); | 1550 ScopedGLErrorSuppressor suppressor(decoder_); |
1538 glDeleteTextures(1, &id_); | 1551 glDeleteTextures(1, &id_); |
1539 id_ = 0; | 1552 id_ = 0; |
1540 } | 1553 } |
1541 } | 1554 } |
1542 | 1555 |
| 1556 void Texture::Invalidate() { |
| 1557 id_ = 0; |
| 1558 } |
| 1559 |
1543 RenderBuffer::RenderBuffer(GLES2DecoderImpl* decoder) | 1560 RenderBuffer::RenderBuffer(GLES2DecoderImpl* decoder) |
1544 : decoder_(decoder), | 1561 : decoder_(decoder), |
1545 id_(0) { | 1562 id_(0) { |
1546 } | 1563 } |
1547 | 1564 |
1548 RenderBuffer::~RenderBuffer() { | 1565 RenderBuffer::~RenderBuffer() { |
1549 // This does not destroy the render buffer because that would require that | 1566 // This does not destroy the render buffer because that would require that |
1550 // the associated GL context was current. Just check that it was explicitly | 1567 // the associated GL context was current. Just check that it was explicitly |
1551 // destroyed. | 1568 // destroyed. |
1552 DCHECK_EQ(id_, 0u); | 1569 DCHECK_EQ(id_, 0u); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 } | 1603 } |
1587 | 1604 |
1588 void RenderBuffer::Destroy() { | 1605 void RenderBuffer::Destroy() { |
1589 if (id_ != 0) { | 1606 if (id_ != 0) { |
1590 ScopedGLErrorSuppressor suppressor(decoder_); | 1607 ScopedGLErrorSuppressor suppressor(decoder_); |
1591 glDeleteRenderbuffersEXT(1, &id_); | 1608 glDeleteRenderbuffersEXT(1, &id_); |
1592 id_ = 0; | 1609 id_ = 0; |
1593 } | 1610 } |
1594 } | 1611 } |
1595 | 1612 |
| 1613 void RenderBuffer::Invalidate() { |
| 1614 id_ = 0; |
| 1615 } |
| 1616 |
1596 FrameBuffer::FrameBuffer(GLES2DecoderImpl* decoder) | 1617 FrameBuffer::FrameBuffer(GLES2DecoderImpl* decoder) |
1597 : decoder_(decoder), | 1618 : decoder_(decoder), |
1598 id_(0) { | 1619 id_(0) { |
1599 } | 1620 } |
1600 | 1621 |
1601 FrameBuffer::~FrameBuffer() { | 1622 FrameBuffer::~FrameBuffer() { |
1602 // This does not destroy the frame buffer because that would require that | 1623 // This does not destroy the frame buffer because that would require that |
1603 // the associated GL context was current. Just check that it was explicitly | 1624 // the associated GL context was current. Just check that it was explicitly |
1604 // destroyed. | 1625 // destroyed. |
1605 DCHECK_EQ(id_, 0u); | 1626 DCHECK_EQ(id_, 0u); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 } | 1663 } |
1643 | 1664 |
1644 void FrameBuffer::Destroy() { | 1665 void FrameBuffer::Destroy() { |
1645 if (id_ != 0) { | 1666 if (id_ != 0) { |
1646 ScopedGLErrorSuppressor suppressor(decoder_); | 1667 ScopedGLErrorSuppressor suppressor(decoder_); |
1647 glDeleteFramebuffersEXT(1, &id_); | 1668 glDeleteFramebuffersEXT(1, &id_); |
1648 id_ = 0; | 1669 id_ = 0; |
1649 } | 1670 } |
1650 } | 1671 } |
1651 | 1672 |
| 1673 void FrameBuffer::Invalidate() { |
| 1674 id_ = 0; |
| 1675 } |
| 1676 |
1652 GLenum FrameBuffer::CheckStatus() { | 1677 GLenum FrameBuffer::CheckStatus() { |
1653 DCHECK_NE(id_, 0u); | 1678 DCHECK_NE(id_, 0u); |
1654 ScopedGLErrorSuppressor suppressor(decoder_); | 1679 ScopedGLErrorSuppressor suppressor(decoder_); |
1655 ScopedFrameBufferBinder binder(decoder_, id_); | 1680 ScopedFrameBufferBinder binder(decoder_, id_); |
1656 return glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | 1681 return glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); |
1657 } | 1682 } |
1658 | 1683 |
1659 GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { | 1684 GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { |
1660 return new GLES2DecoderImpl(group); | 1685 return new GLES2DecoderImpl(group); |
1661 } | 1686 } |
(...skipping 19 matching lines...) Expand all Loading... |
1681 clear_stencil_(0), | 1706 clear_stencil_(0), |
1682 mask_stencil_front_(-1), | 1707 mask_stencil_front_(-1), |
1683 mask_stencil_back_(-1), | 1708 mask_stencil_back_(-1), |
1684 clear_depth_(1.0f), | 1709 clear_depth_(1.0f), |
1685 mask_depth_(true), | 1710 mask_depth_(true), |
1686 enable_scissor_test_(false), | 1711 enable_scissor_test_(false), |
1687 offscreen_target_color_format_(0), | 1712 offscreen_target_color_format_(0), |
1688 offscreen_target_depth_format_(0), | 1713 offscreen_target_depth_format_(0), |
1689 offscreen_target_stencil_format_(0), | 1714 offscreen_target_stencil_format_(0), |
1690 offscreen_target_samples_(0), | 1715 offscreen_target_samples_(0), |
| 1716 offscreen_saved_color_format_(0), |
1691 current_decoder_error_(error::kNoError), | 1717 current_decoder_error_(error::kNoError), |
1692 use_shader_translator_(true), | 1718 use_shader_translator_(true), |
1693 validators_(group_->feature_info()->validators()), | 1719 validators_(group_->feature_info()->validators()), |
1694 feature_info_(group_->feature_info()) { | 1720 feature_info_(group_->feature_info()) { |
1695 attrib_0_value_.v[0] = 0.0f; | 1721 attrib_0_value_.v[0] = 0.0f; |
1696 attrib_0_value_.v[1] = 0.0f; | 1722 attrib_0_value_.v[1] = 0.0f; |
1697 attrib_0_value_.v[2] = 0.0f; | 1723 attrib_0_value_.v[2] = 0.0f; |
1698 attrib_0_value_.v[3] = 1.0f; | 1724 attrib_0_value_.v[3] = 1.0f; |
1699 | 1725 |
1700 // The shader translator is not needed for EGL because it already uses the | 1726 // The shader translator is not needed for EGL because it already uses the |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8; | 1859 offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8; |
1834 offscreen_target_stencil_format_ = 0; | 1860 offscreen_target_stencil_format_ = 0; |
1835 } else { | 1861 } else { |
1836 offscreen_target_depth_format_ = attrib_parser.depth_size_ > 0 ? | 1862 offscreen_target_depth_format_ = attrib_parser.depth_size_ > 0 ? |
1837 GL_DEPTH_COMPONENT : 0; | 1863 GL_DEPTH_COMPONENT : 0; |
1838 offscreen_target_stencil_format_ = attrib_parser.stencil_size_ > 0 ? | 1864 offscreen_target_stencil_format_ = attrib_parser.stencil_size_ > 0 ? |
1839 GL_STENCIL_INDEX : 0; | 1865 GL_STENCIL_INDEX : 0; |
1840 } | 1866 } |
1841 } | 1867 } |
1842 | 1868 |
| 1869 offscreen_saved_color_format_ = attrib_parser.alpha_size_ > 0 ? |
| 1870 GL_RGBA : GL_RGB; |
| 1871 |
1843 // Create the target frame buffer. This is the one that the client renders | 1872 // Create the target frame buffer. This is the one that the client renders |
1844 // directly to. | 1873 // directly to. |
1845 offscreen_target_frame_buffer_.reset(new FrameBuffer(this)); | 1874 offscreen_target_frame_buffer_.reset(new FrameBuffer(this)); |
1846 offscreen_target_frame_buffer_->Create(); | 1875 offscreen_target_frame_buffer_->Create(); |
1847 // Due to GLES2 format limitations, either the color texture (for | 1876 // Due to GLES2 format limitations, either the color texture (for |
1848 // non-multisampling) or the color render buffer (for multisampling) will be | 1877 // non-multisampling) or the color render buffer (for multisampling) will be |
1849 // attached to the offscreen frame buffer. The render buffer has more | 1878 // attached to the offscreen frame buffer. The render buffer has more |
1850 // limited formats available to it, but the texture can't do multisampling. | 1879 // limited formats available to it, but the texture can't do multisampling. |
1851 if (IsOffscreenBufferMultisampled()) { | 1880 if (IsOffscreenBufferMultisampled()) { |
1852 offscreen_target_color_render_buffer_.reset(new RenderBuffer(this)); | 1881 offscreen_target_color_render_buffer_.reset(new RenderBuffer(this)); |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2269 glStencilMaskSeparate(GL_FRONT, GL_TRUE); | 2298 glStencilMaskSeparate(GL_FRONT, GL_TRUE); |
2270 glStencilMaskSeparate(GL_BACK, GL_TRUE); | 2299 glStencilMaskSeparate(GL_BACK, GL_TRUE); |
2271 glClearDepth(0); | 2300 glClearDepth(0); |
2272 glDepthMask(GL_TRUE); | 2301 glDepthMask(GL_TRUE); |
2273 glDisable(GL_SCISSOR_TEST); | 2302 glDisable(GL_SCISSOR_TEST); |
2274 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 2303 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
2275 RestoreClearState(); | 2304 RestoreClearState(); |
2276 } | 2305 } |
2277 | 2306 |
2278 if (parent_ || IsOffscreenBufferMultisampled()) { | 2307 if (parent_ || IsOffscreenBufferMultisampled()) { |
2279 offscreen_saved_color_texture_->AllocateStorage(pending_offscreen_size_, | 2308 DCHECK(offscreen_saved_color_format_); |
2280 GL_RGBA); | 2309 offscreen_saved_color_texture_->AllocateStorage( |
| 2310 pending_offscreen_size_, offscreen_saved_color_format_); |
2281 | 2311 |
2282 offscreen_saved_frame_buffer_->AttachRenderTexture( | 2312 offscreen_saved_frame_buffer_->AttachRenderTexture( |
2283 offscreen_saved_color_texture_.get()); | 2313 offscreen_saved_color_texture_.get()); |
2284 if (offscreen_saved_frame_buffer_->CheckStatus() != | 2314 if (offscreen_saved_frame_buffer_->CheckStatus() != |
2285 GL_FRAMEBUFFER_COMPLETE) { | 2315 GL_FRAMEBUFFER_COMPLETE) { |
2286 LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " | 2316 LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " |
2287 << "because offscreen saved FBO was incomplete."; | 2317 << "because offscreen saved FBO was incomplete."; |
2288 return false; | 2318 return false; |
2289 } | 2319 } |
2290 } | 2320 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 texture_manager()->GetTextureInfo(client_texture_id); | 2366 texture_manager()->GetTextureInfo(client_texture_id); |
2337 if (texture) { | 2367 if (texture) { |
2338 *service_texture_id = texture->service_id(); | 2368 *service_texture_id = texture->service_id(); |
2339 return true; | 2369 return true; |
2340 } | 2370 } |
2341 return false; | 2371 return false; |
2342 } | 2372 } |
2343 | 2373 |
2344 void GLES2DecoderImpl::Destroy() { | 2374 void GLES2DecoderImpl::Destroy() { |
2345 bool have_context = context_.get() && MakeCurrent(); | 2375 bool have_context = context_.get() && MakeCurrent(); |
2346 group_->set_have_context(have_context); | 2376 |
| 2377 if (group_.get()) |
| 2378 group_->set_have_context(have_context); |
| 2379 |
2347 if (have_context) { | 2380 if (have_context) { |
2348 if (attrib_0_buffer_id_) { | 2381 if (attrib_0_buffer_id_) { |
2349 glDeleteBuffersARB(1, &attrib_0_buffer_id_); | 2382 glDeleteBuffersARB(1, &attrib_0_buffer_id_); |
2350 } | 2383 } |
2351 | 2384 |
2352 // Remove the saved frame buffer mapping from the parent decoder. The | 2385 // Remove the saved frame buffer mapping from the parent decoder. The |
2353 // parent pointer is a weak pointer so it will be null if the parent has | 2386 // parent pointer is a weak pointer so it will be null if the parent has |
2354 // already been destroyed. | 2387 // already been destroyed. |
2355 if (parent_) { | 2388 if (parent_) { |
2356 // First check the texture has been mapped into the parent. This might not | 2389 // First check the texture has been mapped into the parent. This might not |
2357 // be the case if initialization failed midway through. | 2390 // be the case if initialization failed midway through. |
2358 GLuint service_id = offscreen_saved_color_texture_->id(); | 2391 GLuint service_id = offscreen_saved_color_texture_->id(); |
2359 GLuint client_id = 0; | 2392 GLuint client_id = 0; |
2360 if (parent_->texture_manager()->GetClientId(service_id, &client_id)) { | 2393 if (parent_->texture_manager()->GetClientId(service_id, &client_id)) { |
2361 parent_->texture_manager()->RemoveTextureInfo(feature_info_, client_id); | 2394 parent_->texture_manager()->RemoveTextureInfo(feature_info_, client_id); |
2362 } | 2395 } |
2363 | 2396 |
2364 glDeleteFramebuffersEXT(1, ©_texture_to_parent_texture_fb_); | 2397 glDeleteFramebuffersEXT(1, ©_texture_to_parent_texture_fb_); |
2365 } | 2398 } |
2366 | 2399 |
2367 if (offscreen_target_frame_buffer_.get()) { | 2400 if (offscreen_target_frame_buffer_.get()) |
2368 offscreen_target_frame_buffer_->Destroy(); | 2401 offscreen_target_frame_buffer_->Destroy(); |
2369 offscreen_target_frame_buffer_.reset(); | 2402 if (offscreen_target_color_texture_.get()) |
2370 } | |
2371 | |
2372 if (offscreen_target_color_texture_.get()) { | |
2373 offscreen_target_color_texture_->Destroy(); | 2403 offscreen_target_color_texture_->Destroy(); |
2374 offscreen_target_color_texture_.reset(); | 2404 if (offscreen_target_color_render_buffer_.get()) |
2375 } | |
2376 | |
2377 if (offscreen_target_color_render_buffer_.get()) { | |
2378 offscreen_target_color_render_buffer_->Destroy(); | 2405 offscreen_target_color_render_buffer_->Destroy(); |
2379 offscreen_target_color_render_buffer_.reset(); | 2406 if (offscreen_target_depth_render_buffer_.get()) |
2380 } | |
2381 | |
2382 if (offscreen_target_depth_render_buffer_.get()) { | |
2383 offscreen_target_depth_render_buffer_->Destroy(); | 2407 offscreen_target_depth_render_buffer_->Destroy(); |
2384 offscreen_target_depth_render_buffer_.reset(); | 2408 if (offscreen_target_stencil_render_buffer_.get()) |
2385 } | |
2386 | |
2387 if (offscreen_target_stencil_render_buffer_.get()) { | |
2388 offscreen_target_stencil_render_buffer_->Destroy(); | 2409 offscreen_target_stencil_render_buffer_->Destroy(); |
2389 offscreen_target_stencil_render_buffer_.reset(); | 2410 if (offscreen_saved_frame_buffer_.get()) |
2390 } | |
2391 | |
2392 if (offscreen_saved_frame_buffer_.get()) { | |
2393 offscreen_saved_frame_buffer_->Destroy(); | 2411 offscreen_saved_frame_buffer_->Destroy(); |
2394 offscreen_saved_frame_buffer_.reset(); | 2412 if (offscreen_saved_color_texture_.get()) |
2395 } | |
2396 | |
2397 if (offscreen_saved_color_texture_.get()) { | |
2398 offscreen_saved_color_texture_->Destroy(); | 2413 offscreen_saved_color_texture_->Destroy(); |
2399 offscreen_saved_color_texture_.reset(); | |
2400 } | |
2401 | 2414 |
2402 // must release the ContextGroup before destroying the context as its | 2415 // must release the ContextGroup before destroying the context as its |
2403 // destructor uses GL. | 2416 // destructor uses GL. |
2404 group_ = NULL; | 2417 group_ = NULL; |
2405 | 2418 |
2406 context_->Destroy(); | 2419 context_->Destroy(); |
2407 context_.reset(); | 2420 context_.reset(); |
| 2421 } else { |
| 2422 if (offscreen_target_frame_buffer_.get()) |
| 2423 offscreen_target_frame_buffer_->Invalidate(); |
| 2424 if (offscreen_target_color_texture_.get()) |
| 2425 offscreen_target_color_texture_->Invalidate(); |
| 2426 if (offscreen_target_color_render_buffer_.get()) |
| 2427 offscreen_target_color_render_buffer_->Invalidate(); |
| 2428 if (offscreen_target_depth_render_buffer_.get()) |
| 2429 offscreen_target_depth_render_buffer_->Invalidate(); |
| 2430 if (offscreen_target_stencil_render_buffer_.get()) |
| 2431 offscreen_target_stencil_render_buffer_->Invalidate(); |
| 2432 if (offscreen_saved_frame_buffer_.get()) |
| 2433 offscreen_saved_frame_buffer_->Invalidate(); |
| 2434 if (offscreen_saved_color_texture_.get()) |
| 2435 offscreen_saved_color_texture_->Invalidate(); |
2408 } | 2436 } |
| 2437 |
| 2438 offscreen_target_frame_buffer_.reset(); |
| 2439 offscreen_target_color_texture_.reset(); |
| 2440 offscreen_target_color_render_buffer_.reset(); |
| 2441 offscreen_target_depth_render_buffer_.reset(); |
| 2442 offscreen_target_stencil_render_buffer_.reset(); |
| 2443 offscreen_saved_frame_buffer_.reset(); |
| 2444 offscreen_saved_color_texture_.reset(); |
2409 } | 2445 } |
2410 | 2446 |
2411 void GLES2DecoderImpl::ResizeOffscreenFrameBuffer(const gfx::Size& size) { | 2447 void GLES2DecoderImpl::ResizeOffscreenFrameBuffer(const gfx::Size& size) { |
2412 // We can't resize the render buffers immediately because there might be a | 2448 // We can't resize the render buffers immediately because there might be a |
2413 // partial frame rendered into them and we don't want the tail end of that | 2449 // partial frame rendered into them and we don't want the tail end of that |
2414 // rendered into the reallocated storage. Defer until the next SwapBuffers. | 2450 // rendered into the reallocated storage. Defer until the next SwapBuffers. |
2415 pending_offscreen_size_ = size; | 2451 pending_offscreen_size_ = size; |
2416 } | 2452 } |
2417 | 2453 |
2418 void GLES2DecoderImpl::DoCopyTextureToParentTexture( | 2454 void GLES2DecoderImpl::DoCopyTextureToParentTexture( |
(...skipping 3253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5672 return error::kNoError; | 5708 return error::kNoError; |
5673 } | 5709 } |
5674 | 5710 |
5675 // Include the auto-generated part of this file. We split this because it means | 5711 // Include the auto-generated part of this file. We split this because it means |
5676 // we can easily edit the non-auto generated parts right here in this file | 5712 // we can easily edit the non-auto generated parts right here in this file |
5677 // instead of having to edit some template or the code generator. | 5713 // instead of having to edit some template or the code generator. |
5678 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 5714 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
5679 | 5715 |
5680 } // namespace gles2 | 5716 } // namespace gles2 |
5681 } // namespace gpu | 5717 } // namespace gpu |
OLD | NEW |