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

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

Issue 2082753002: Remove some unnecessary code from BackTexture::Create. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | no next file » | 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 2416 matching lines...) Expand 10 before | Expand all | Expand 10 after
2427 } 2427 }
2428 2428
2429 BackTexture::~BackTexture() { 2429 BackTexture::~BackTexture() {
2430 // This does not destroy the render texture because that would require that 2430 // This does not destroy the render texture because that would require that
2431 // the associated GL context was current. Just check that it was explicitly 2431 // the associated GL context was current. Just check that it was explicitly
2432 // destroyed. 2432 // destroyed.
2433 DCHECK_EQ(id_, 0u); 2433 DCHECK_EQ(id_, 0u);
2434 } 2434 }
2435 2435
2436 void BackTexture::Create() { 2436 void BackTexture::Create() {
2437 DCHECK_EQ(id_, 0u);
2437 ScopedGLErrorSuppressor suppressor("BackTexture::Create", 2438 ScopedGLErrorSuppressor suppressor("BackTexture::Create",
2438 state_->GetErrorState()); 2439 state_->GetErrorState());
2439 Destroy();
2440 glGenTextures(1, &id_); 2440 glGenTextures(1, &id_);
2441 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); 2441 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D);
2442 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 2442 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
2443 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 2443 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
2444 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 2444 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
2445 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 2445 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
2446
2447 // TODO(apatrick): Attempt to diagnose crbug.com/97775. If SwapBuffers is
2448 // never called on an offscreen context, no data will ever be uploaded to the
2449 // saved offscreen color texture (it is deferred until to when SwapBuffers
2450 // is called). My idea is that some nvidia drivers might have a bug where
2451 // deleting a texture that has never been populated might cause a
2452 // crash.
2453 glTexImage2D(
2454 GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
2455
2456 bytes_allocated_ = 16u * 16u * 4u;
2457 memory_tracker_.TrackMemAlloc(bytes_allocated_);
2458 } 2446 }
2459 2447
2460 bool BackTexture::AllocateStorage( 2448 bool BackTexture::AllocateStorage(
2461 const gfx::Size& size, GLenum format, bool zero) { 2449 const gfx::Size& size, GLenum format, bool zero) {
2462 DCHECK_NE(id_, 0u); 2450 DCHECK_NE(id_, 0u);
2463 ScopedGLErrorSuppressor suppressor("BackTexture::AllocateStorage", 2451 ScopedGLErrorSuppressor suppressor("BackTexture::AllocateStorage",
2464 state_->GetErrorState()); 2452 state_->GetErrorState());
2465 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); 2453 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D);
2466 uint32_t image_size = 0; 2454 uint32_t image_size = 0;
2467 GLES2Util::ComputeImageDataSizes( 2455 GLES2Util::ComputeImageDataSizes(
(...skipping 14558 matching lines...) Expand 10 before | Expand all | Expand 10 after
17026 } 17014 }
17027 17015
17028 // Include the auto-generated part of this file. We split this because it means 17016 // Include the auto-generated part of this file. We split this because it means
17029 // we can easily edit the non-auto generated parts right here in this file 17017 // we can easily edit the non-auto generated parts right here in this file
17030 // instead of having to edit some template or the code generator. 17018 // instead of having to edit some template or the code generator.
17031 #include "base/macros.h" 17019 #include "base/macros.h"
17032 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17020 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17033 17021
17034 } // namespace gles2 17022 } // namespace gles2
17035 } // namespace gpu 17023 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698