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

Side by Side Diff: ui/gl/gl_image_memory.cc

Issue 977853002: Reland of Revert of gpu: introduce glCopySubTextureCHROMIUM (patchset #1 id:1 of https://codereview… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply image optimization to CopySubTexture. move glValidateProgram Created 5 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/gl/gl_image_memory.h" 5 #include "ui/gl/gl_image_memory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "ui/gl/gl_bindings.h" 9 #include "ui/gl/gl_bindings.h"
10 #include "ui/gl/scoped_binders.h" 10 #include "ui/gl/scoped_binders.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // Defer DoBindTexImage if not currently in use. 257 // Defer DoBindTexImage if not currently in use.
258 if (!in_use_) { 258 if (!in_use_) {
259 need_do_bind_tex_image_ = true; 259 need_do_bind_tex_image_ = true;
260 return true; 260 return true;
261 } 261 }
262 262
263 DoBindTexImage(target); 263 DoBindTexImage(target);
264 return true; 264 return true;
265 } 265 }
266 266
267 bool GLImageMemory::CopyTexImage(unsigned target) { 267 bool GLImageMemory::CopyTexSubImage(unsigned target, int xoffset, int yoffset) {
268 TRACE_EVENT0("gpu", "GLImageMemory::CopyTexImage"); 268 TRACE_EVENT0("gpu", "GLImageMemory::CopyTexImage");
269 269
270 // GL_TEXTURE_EXTERNAL_OES is not a supported CopyTexImage target. 270 // GL_TEXTURE_EXTERNAL_OES is not a supported CopyTexImage target.
271 if (target == GL_TEXTURE_EXTERNAL_OES) 271 if (target == GL_TEXTURE_EXTERNAL_OES)
272 return false; 272 return false;
273 273
274 DCHECK(memory_); 274 DCHECK(memory_);
275 if (IsCompressedFormat(format_)) { 275 if (IsCompressedFormat(format_)) {
276 glCompressedTexSubImage2D(target, 276 glCompressedTexSubImage2D(target,
277 0, // level 277 0, // level
278 0, // x-offset 278 xoffset, yoffset, size_.width(), size_.height(),
279 0, // y-offset
280 size_.width(), size_.height(),
281 DataFormat(format_), SizeInBytes(size_, format_), 279 DataFormat(format_), SizeInBytes(size_, format_),
282 memory_); 280 memory_);
283 } else { 281 } else {
284 glTexSubImage2D(target, 0, // level 282 glTexSubImage2D(target, 0, // level
285 0, // x 283 xoffset, yoffset, size_.width(), size_.height(),
286 0, // y 284 DataFormat(format_), DataType(format_), memory_);
287 size_.width(), size_.height(), DataFormat(format_),
288 DataType(format_), memory_);
289 } 285 }
290 286
291 return true; 287 return true;
292 } 288 }
293 289
294 void GLImageMemory::WillUseTexImage() { 290 void GLImageMemory::WillUseTexImage() {
295 DCHECK(!in_use_); 291 DCHECK(!in_use_);
296 in_use_ = true; 292 in_use_ = true;
297 293
298 if (!need_do_bind_tex_image_) 294 if (!need_do_bind_tex_image_)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 size_.width(), 408 size_.width(),
413 size_.height(), 409 size_.height(),
414 0, // border 410 0, // border
415 DataFormat(format_), 411 DataFormat(format_),
416 DataType(format_), 412 DataType(format_),
417 memory_); 413 memory_);
418 } 414 }
419 } 415 }
420 416
421 } // namespace gfx 417 } // namespace gfx
OLDNEW
« ui/gl/gl_image.h ('K') | « ui/gl/gl_image_memory.h ('k') | ui/gl/gl_image_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698