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

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

Issue 681713002: Update from chromium https://crrev.com/301315 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 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
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 "gpu/command_buffer/service/texture_definition.h" 5 #include "gpu/command_buffer/service/texture_definition.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/memory/linked_ptr.h" 9 #include "base/memory/linked_ptr.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 width(width), 271 width(width),
272 height(height), 272 height(height),
273 depth(depth), 273 depth(depth),
274 border(border), 274 border(border),
275 format(format), 275 format(format),
276 type(type), 276 type(type),
277 cleared(cleared) {} 277 cleared(cleared) {}
278 278
279 TextureDefinition::LevelInfo::~LevelInfo() {} 279 TextureDefinition::LevelInfo::~LevelInfo() {}
280 280
281 TextureDefinition::TextureDefinition()
282 : version_(0),
283 target_(0),
284 min_filter_(0),
285 mag_filter_(0),
286 wrap_s_(0),
287 wrap_t_(0),
288 usage_(0),
289 immutable_(true) {
290 }
291
281 TextureDefinition::TextureDefinition( 292 TextureDefinition::TextureDefinition(
282 GLenum target,
283 Texture* texture, 293 Texture* texture,
284 unsigned int version, 294 unsigned int version,
285 const scoped_refptr<NativeImageBuffer>& image_buffer) 295 const scoped_refptr<NativeImageBuffer>& image_buffer)
286 : version_(version), 296 : version_(version),
287 target_(target), 297 target_(texture->target()),
288 image_buffer_(image_buffer.get() 298 image_buffer_(image_buffer.get()
289 ? image_buffer 299 ? image_buffer
290 : NativeImageBuffer::Create(texture->service_id())), 300 : NativeImageBuffer::Create(texture->service_id())),
291 min_filter_(texture->min_filter()), 301 min_filter_(texture->min_filter()),
292 mag_filter_(texture->mag_filter()), 302 mag_filter_(texture->mag_filter()),
293 wrap_s_(texture->wrap_s()), 303 wrap_s_(texture->wrap_s()),
294 wrap_t_(texture->wrap_t()), 304 wrap_t_(texture->wrap_t()),
295 usage_(texture->usage()), 305 usage_(texture->usage()),
296 immutable_(texture->IsImmutable()) { 306 immutable_(texture->IsImmutable()) {
297 // TODO 307 // TODO
298 DCHECK(!texture->face_infos_.empty()); 308 DCHECK(!texture->face_infos_.empty());
299 DCHECK(!texture->face_infos_[0].level_infos.empty()); 309 DCHECK(!texture->face_infos_[0].level_infos.empty());
300 DCHECK(!texture->NeedsMips()); 310 DCHECK(!texture->NeedsMips());
301 DCHECK(texture->face_infos_[0].level_infos[0].width); 311 DCHECK(texture->face_infos_[0].level_infos[0].width);
302 DCHECK(texture->face_infos_[0].level_infos[0].height); 312 DCHECK(texture->face_infos_[0].level_infos[0].height);
303 313
304 const Texture::FaceInfo& first_face = texture->face_infos_[0]; 314 const Texture::FaceInfo& first_face = texture->face_infos_[0];
305 scoped_refptr<gfx::GLImage> gl_image( 315 scoped_refptr<gfx::GLImage> gl_image(
306 new GLImageSync(image_buffer_, 316 new GLImageSync(image_buffer_,
307 gfx::Size(first_face.level_infos[0].width, 317 gfx::Size(first_face.level_infos[0].width,
308 first_face.level_infos[0].height))); 318 first_face.level_infos[0].height)));
309 texture->SetLevelImage(NULL, target, 0, gl_image.get()); 319 texture->SetLevelImage(NULL, target_, 0, gl_image.get());
310 320
311 // TODO: all levels 321 // TODO: all levels
312 level_infos_.clear(); 322 level_infos_.clear();
313 const Texture::LevelInfo& level = first_face.level_infos[0]; 323 const Texture::LevelInfo& level = first_face.level_infos[0];
314 LevelInfo info(level.target, 324 LevelInfo info(level.target,
315 level.internal_format, 325 level.internal_format,
316 level.width, 326 level.width,
317 level.height, 327 level.height,
318 level.depth, 328 level.depth,
319 level.border, 329 level.border,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 419
410 // All structural changes should have orphaned the texture. 420 // All structural changes should have orphaned the texture.
411 if (image_buffer_.get() && !texture->GetLevelImage(texture->target(), 0)) 421 if (image_buffer_.get() && !texture->GetLevelImage(texture->target(), 0))
412 return false; 422 return false;
413 423
414 return true; 424 return true;
415 } 425 }
416 426
417 } // namespace gles2 427 } // namespace gles2
418 } // namespace gpu 428 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_definition.h ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698