Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2145643004: Fix preserve backbuffer with native GMBs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 explicit BackTexture(GLES2DecoderImpl* decoder); 395 explicit BackTexture(GLES2DecoderImpl* decoder);
396 ~BackTexture(); 396 ~BackTexture();
397 397
398 // Create a new render texture. 398 // Create a new render texture.
399 void Create(); 399 void Create();
400 400
401 // Set the initial size and format of a render texture or resize it. 401 // Set the initial size and format of a render texture or resize it.
402 bool AllocateStorage(const gfx::Size& size, GLenum format, bool zero); 402 bool AllocateStorage(const gfx::Size& size, GLenum format, bool zero);
403 403
404 // Copy the contents of the currently bound frame buffer. 404 // Copy the contents of the currently bound frame buffer.
405 void Copy(const gfx::Size& size, GLenum format); 405 void Copy();
406 406
407 // Destroy the render texture. This must be explicitly called before 407 // Destroy the render texture. This must be explicitly called before
408 // destroying this object. 408 // destroying this object.
409 void Destroy(); 409 void Destroy();
410 410
411 // Invalidate the texture. This can be used when a context is lost and it is 411 // Invalidate the texture. This can be used when a context is lost and it is
412 // not possible to make it current in order to free the resource. 412 // not possible to make it current in order to free the resource.
413 void Invalidate(); 413 void Invalidate();
414 414
415 // The bind point for the texture. 415 // The bind point for the texture.
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 } 2585 }
2586 2586
2587 if (success) { 2587 if (success) {
2588 memory_tracker_.TrackMemFree(bytes_allocated_); 2588 memory_tracker_.TrackMemFree(bytes_allocated_);
2589 bytes_allocated_ = image_size; 2589 bytes_allocated_ = image_size;
2590 memory_tracker_.TrackMemAlloc(bytes_allocated_); 2590 memory_tracker_.TrackMemAlloc(bytes_allocated_);
2591 } 2591 }
2592 return success; 2592 return success;
2593 } 2593 }
2594 2594
2595 void BackTexture::Copy(const gfx::Size& size, GLenum format) { 2595 void BackTexture::Copy() {
2596 DCHECK_NE(id(), 0u); 2596 DCHECK_NE(id(), 0u);
2597 ScopedGLErrorSuppressor suppressor("BackTexture::Copy", 2597 ScopedGLErrorSuppressor suppressor("BackTexture::Copy",
2598 decoder_->state_.GetErrorState()); 2598 decoder_->state_.GetErrorState());
2599 ScopedTextureBinder binder(&decoder_->state_, id(), Target()); 2599 ScopedTextureBinder binder(&decoder_->state_, id(), Target());
2600 glCopyTexImage2D(Target(), 2600 glCopyTexSubImage2D(Target(),
2601 0, // level 2601 0, // level
2602 format, 0, 0, size.width(), size.height(), 2602 0, 0, 0, 0, size_.width(), size_.height());
2603 0); // border
2604 } 2603 }
2605 2604
2606 void BackTexture::Destroy() { 2605 void BackTexture::Destroy() {
2607 if (image_) { 2606 if (image_) {
2608 DCHECK(texture_ref_); 2607 DCHECK(texture_ref_);
2609 ScopedTextureBinder binder(&decoder_->state_, id(), Target()); 2608 ScopedTextureBinder binder(&decoder_->state_, id(), Target());
2610 DestroyNativeGpuMemoryBuffer(true); 2609 DestroyNativeGpuMemoryBuffer(true);
2611 } 2610 }
2612 2611
2613 if (texture_ref_) { 2612 if (texture_ref_) {
(...skipping 10858 matching lines...) Expand 10 before | Expand all | Expand 10 after
13472 13471
13473 if (IsOffscreenBufferMultisampled()) { 13472 if (IsOffscreenBufferMultisampled()) {
13474 // For multisampled buffers, resolve the frame buffer. 13473 // For multisampled buffers, resolve the frame buffer.
13475 ScopedResolvedFrameBufferBinder binder(this, true, false); 13474 ScopedResolvedFrameBufferBinder binder(this, true, false);
13476 } else { 13475 } else {
13477 ScopedFrameBufferBinder binder(this, 13476 ScopedFrameBufferBinder binder(this,
13478 offscreen_target_frame_buffer_->id()); 13477 offscreen_target_frame_buffer_->id());
13479 13478
13480 if (offscreen_target_buffer_preserved_) { 13479 if (offscreen_target_buffer_preserved_) {
13481 // Copy the target frame buffer to the saved offscreen texture. 13480 // Copy the target frame buffer to the saved offscreen texture.
13482 offscreen_saved_color_texture_->Copy( 13481 offscreen_saved_color_texture_->Copy();
13483 offscreen_saved_color_texture_->size(),
13484 offscreen_saved_color_format_);
13485 } else { 13482 } else {
13486 offscreen_saved_color_texture_.swap(offscreen_target_color_texture_); 13483 offscreen_saved_color_texture_.swap(offscreen_target_color_texture_);
13487 offscreen_target_frame_buffer_->AttachRenderTexture( 13484 offscreen_target_frame_buffer_->AttachRenderTexture(
13488 offscreen_target_color_texture_.get()); 13485 offscreen_target_color_texture_.get());
13489 offscreen_saved_frame_buffer_->AttachRenderTexture( 13486 offscreen_saved_frame_buffer_->AttachRenderTexture(
13490 offscreen_saved_color_texture_.get()); 13487 offscreen_saved_color_texture_.get());
13491 } 13488 }
13492 13489
13493 // Ensure the side effects of the copy are visible to the parent 13490 // Ensure the side effects of the copy are visible to the parent
13494 // context. There is no need to do this for ANGLE because it uses a 13491 // context. There is no need to do this for ANGLE because it uses a
(...skipping 3611 matching lines...) Expand 10 before | Expand all | Expand 10 after
17106 } 17103 }
17107 17104
17108 // Include the auto-generated part of this file. We split this because it means 17105 // Include the auto-generated part of this file. We split this because it means
17109 // we can easily edit the non-auto generated parts right here in this file 17106 // we can easily edit the non-auto generated parts right here in this file
17110 // instead of having to edit some template or the code generator. 17107 // instead of having to edit some template or the code generator.
17111 #include "base/macros.h" 17108 #include "base/macros.h"
17112 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17109 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17113 17110
17114 } // namespace gles2 17111 } // namespace gles2
17115 } // namespace gpu 17112 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698