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

Side by Side Diff: mojo/gpu/texture_cache.cc

Issue 1411103004: mozart: Port the spinning cube example. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 | « examples/ui/spinning_cube/spinning_cube_view.cc ('k') | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef GL_GLEXT_PROTOTYPES 5 #ifndef GL_GLEXT_PROTOTYPES
6 #define GL_GLEXT_PROTOTYPES 6 #define GL_GLEXT_PROTOTYPES
7 #endif 7 #endif
8 #include <GLES2/gl2extmojo.h> 8 #include <GLES2/gl2extmojo.h>
9 9
10 #include "mojo/gpu/gl_context.h" 10 #include "mojo/gpu/gl_context.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // Get the sync point from the sync point map. 50 // Get the sync point from the sync point map.
51 auto sync_point_iterator = 51 auto sync_point_iterator =
52 resource_to_sync_point_map_.find(available_resource_id); 52 resource_to_sync_point_map_.find(available_resource_id);
53 int sync_point = sync_point_iterator->second; 53 int sync_point = sync_point_iterator->second;
54 resource_to_sync_point_map_.erase(sync_point_iterator); 54 resource_to_sync_point_map_.erase(sync_point_iterator);
55 55
56 // If the texture is the right size, use it. 56 // If the texture is the right size, use it.
57 if (texture_size.width == requested_size.width && 57 if (texture_size.width == requested_size.width &&
58 texture_size.height == requested_size.height) { 58 texture_size.height == requested_size.height) {
59 gl_context_->MakeCurrent();
59 glWaitSyncPointCHROMIUM(sync_point); 60 glWaitSyncPointCHROMIUM(sync_point);
60 return texture_info; 61 return texture_info;
61 } 62 }
62 } 63 }
63 64
64 // If our context is invalid return an empty scoped ptr. 65 // If our context is invalid return an empty scoped ptr.
65 if (!gl_context_) { 66 if (!gl_context_) {
66 return scoped_ptr<TextureInfo>(); 67 return scoped_ptr<TextureInfo>();
67 } 68 }
68 69
(...skipping 25 matching lines...) Expand all
94 auto it = resource_to_texture_map_.find(resource->id); 95 auto it = resource_to_texture_map_.find(resource->id);
95 // Ignore the returned resource if we haven't been notified of its pending 96 // Ignore the returned resource if we haven't been notified of its pending
96 // return. 97 // return.
97 if (it != resource_to_texture_map_.end()) { 98 if (it != resource_to_texture_map_.end()) {
98 available_textures_.push_back(resource->id); 99 available_textures_.push_back(resource->id);
99 resource_to_sync_point_map_[resource->id] = resource->sync_point; 100 resource_to_sync_point_map_[resource->id] = resource->sync_point;
100 } 101 }
101 } 102 }
102 } 103 }
103 } // namespace mojo 104 } // namespace mojo
OLDNEW
« no previous file with comments | « examples/ui/spinning_cube/spinning_cube_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698