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

Side by Side Diff: cc/direct_renderer.cc

Issue 11420079: Allow using a larger-than-necessary texture as cached render pass backing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/direct_renderer.h" 5 #include "cc/direct_renderer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/math_util.h" 10 #include "cc/math_util.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 passesToDelete.push_back(passIterator->first); 128 passesToDelete.push_back(passIterator->first);
129 continue; 129 continue;
130 } 130 }
131 131
132 const RenderPass* renderPassInFrame = it->second; 132 const RenderPass* renderPassInFrame = it->second;
133 const gfx::Size& requiredSize = renderPassTextureSize(renderPassInFrame) ; 133 const gfx::Size& requiredSize = renderPassTextureSize(renderPassInFrame) ;
134 GLenum requiredFormat = renderPassTextureFormat(renderPassInFrame); 134 GLenum requiredFormat = renderPassTextureFormat(renderPassInFrame);
135 CachedResource* texture = passIterator->second; 135 CachedResource* texture = passIterator->second;
136 DCHECK(texture); 136 DCHECK(texture);
137 137
138 if (texture->id() && (texture->size() != requiredSize || texture->format () != requiredFormat)) 138 bool sizeAppropriate = texture->size().width() >= requiredSize.width() & &
139 texture->size().height() >= requiredSize.height() ;
140 if (texture->id() && (!sizeAppropriate || texture->format() != requiredF ormat))
danakj 2012/11/20 00:26:33 I'm worried about the texture cacheing code. It ma
danakj 2012/11/20 00:36:41 Is it true that in order for the size of the rende
enne (OOO) 2012/11/20 00:39:45 Yeah, I think contentsChangedSinceLastFrame will c
danakj 2012/11/20 00:41:36 Ya, Okay I've convinced myself that we'll be alrig
139 texture->Free(); 141 texture->Free();
140 } 142 }
141 143
142 // Delete RenderPass textures from the previous frame that will not be used again. 144 // Delete RenderPass textures from the previous frame that will not be used again.
143 for (size_t i = 0; i < passesToDelete.size(); ++i) 145 for (size_t i = 0; i < passesToDelete.size(); ++i)
144 m_renderPassTextures.erase(passesToDelete[i]); 146 m_renderPassTextures.erase(passesToDelete[i]);
145 147
146 for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) { 148 for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) {
147 if (!m_renderPassTextures.contains(renderPassesInDrawOrder[i]->id())) { 149 if (!m_renderPassTextures.contains(renderPassesInDrawOrder[i]->id())) {
148 scoped_ptr<CachedResource> texture = CachedResource::create(m_resource Provider); 150 scoped_ptr<CachedResource> texture = CachedResource::create(m_resource Provider);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 return pass->outputRect().size(); 233 return pass->outputRect().size();
232 } 234 }
233 235
234 // static 236 // static
235 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*) 237 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*)
236 { 238 {
237 return GL_RGBA; 239 return GL_RGBA;
238 } 240 }
239 241
240 } // namespace cc 242 } // namespace cc
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