OLD | NEW |
---|---|
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/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 break; | 47 break; |
48 } | 48 } |
49 | 49 |
50 return storage_format; | 50 return storage_format; |
51 } | 51 } |
52 | 52 |
53 bool IsTextureFormatSupportedForStorage(GLenum format) { | 53 bool IsTextureFormatSupportedForStorage(GLenum format) { |
54 return (format == GL_RGBA || format == GL_BGRA_EXT); | 54 return (format == GL_RGBA || format == GL_BGRA_EXT); |
55 } | 55 } |
56 | 56 |
57 unsigned CreateTextureId(WebGraphicsContext3D* context3d) { | |
58 unsigned texture_id = 0; | |
59 GLC(context3d, texture_id = context3d->createTexture()); | |
60 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, texture_id)); | |
61 GLC(context3d, context3d->texParameteri( | |
62 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); | |
63 GLC(context3d, context3d->texParameteri( | |
64 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); | |
65 GLC(context3d, context3d->texParameteri( | |
66 GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); | |
67 GLC(context3d, context3d->texParameteri( | |
68 GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); | |
69 return texture_id; | |
70 } | |
71 | |
72 } // namespace | 57 } // namespace |
73 | 58 |
74 ResourceProvider::Resource::Resource() | 59 ResourceProvider::Resource::Resource() |
75 : gl_id(0), | 60 : gl_id(0), |
76 gl_pixel_buffer_id(0), | 61 gl_pixel_buffer_id(0), |
77 gl_upload_query_id(0), | 62 gl_upload_query_id(0), |
78 pixels(NULL), | 63 pixels(NULL), |
79 pixel_buffer(NULL), | 64 pixel_buffer(NULL), |
80 lock_for_read_count(0), | 65 lock_for_read_count(0), |
81 imported_count(0), | 66 imported_count(0), |
82 exported_count(0), | 67 exported_count(0), |
83 locked_for_write(false), | 68 locked_for_write(false), |
84 external(false), | 69 external(false), |
85 marked_for_deletion(false), | 70 marked_for_deletion(false), |
86 pending_set_pixels(false), | 71 pending_set_pixels(false), |
87 set_pixels_completion_forced(false), | 72 set_pixels_completion_forced(false), |
88 allocated(false), | 73 allocated(false), |
89 enable_read_lock_fences(false), | 74 enable_read_lock_fences(false), |
90 read_lock_fence(NULL), | 75 read_lock_fence(NULL), |
91 size(), | 76 size(), |
92 format(0), | 77 format(0), |
93 filter(0), | 78 filter(0), |
94 image_id(0), | 79 image_id(0), |
95 texture_pool(0), | 80 texture_pool(0), |
81 wrap_mode(0), | |
96 hint(TextureUsageAny), | 82 hint(TextureUsageAny), |
97 type(static_cast<ResourceType>(0)) {} | 83 type(static_cast<ResourceType>(0)) {} |
98 | 84 |
99 ResourceProvider::Resource::~Resource() {} | 85 ResourceProvider::Resource::~Resource() {} |
100 | 86 |
101 ResourceProvider::Resource::Resource( | 87 ResourceProvider::Resource::Resource( |
102 unsigned texture_id, | 88 unsigned texture_id, |
103 gfx::Size size, | 89 gfx::Size size, |
104 GLenum format, | 90 GLenum format, |
105 GLenum filter, | 91 GLenum filter, |
106 GLenum texture_pool, | 92 GLenum texture_pool, |
93 GLint wrap_mode, | |
107 TextureUsageHint hint) | 94 TextureUsageHint hint) |
108 : gl_id(texture_id), | 95 : gl_id(texture_id), |
109 gl_pixel_buffer_id(0), | 96 gl_pixel_buffer_id(0), |
110 gl_upload_query_id(0), | 97 gl_upload_query_id(0), |
111 pixels(NULL), | 98 pixels(NULL), |
112 pixel_buffer(NULL), | 99 pixel_buffer(NULL), |
113 lock_for_read_count(0), | 100 lock_for_read_count(0), |
114 imported_count(0), | 101 imported_count(0), |
115 exported_count(0), | 102 exported_count(0), |
116 locked_for_write(false), | 103 locked_for_write(false), |
117 external(false), | 104 external(false), |
118 marked_for_deletion(false), | 105 marked_for_deletion(false), |
119 pending_set_pixels(false), | 106 pending_set_pixels(false), |
120 set_pixels_completion_forced(false), | 107 set_pixels_completion_forced(false), |
121 allocated(false), | 108 allocated(false), |
122 enable_read_lock_fences(false), | 109 enable_read_lock_fences(false), |
123 read_lock_fence(NULL), | 110 read_lock_fence(NULL), |
124 size(size), | 111 size(size), |
125 format(format), | 112 format(format), |
126 filter(filter), | 113 filter(filter), |
127 image_id(0), | 114 image_id(0), |
128 texture_pool(texture_pool), | 115 texture_pool(texture_pool), |
116 wrap_mode(wrap_mode), | |
129 hint(hint), | 117 hint(hint), |
130 type(GLTexture) {} | 118 type(GLTexture) { |
119 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); | |
120 } | |
131 | 121 |
132 ResourceProvider::Resource::Resource( | 122 ResourceProvider::Resource::Resource( |
133 uint8_t* pixels, gfx::Size size, GLenum format, GLenum filter) | 123 uint8_t* pixels, |
124 gfx::Size size, | |
125 GLenum format, | |
126 GLenum filter, | |
127 GLint wrap_mode) | |
134 : gl_id(0), | 128 : gl_id(0), |
135 gl_pixel_buffer_id(0), | 129 gl_pixel_buffer_id(0), |
136 gl_upload_query_id(0), | 130 gl_upload_query_id(0), |
137 pixels(pixels), | 131 pixels(pixels), |
138 pixel_buffer(NULL), | 132 pixel_buffer(NULL), |
139 lock_for_read_count(0), | 133 lock_for_read_count(0), |
140 imported_count(0), | 134 imported_count(0), |
141 exported_count(0), | 135 exported_count(0), |
142 locked_for_write(false), | 136 locked_for_write(false), |
143 external(false), | 137 external(false), |
144 marked_for_deletion(false), | 138 marked_for_deletion(false), |
145 pending_set_pixels(false), | 139 pending_set_pixels(false), |
146 set_pixels_completion_forced(false), | 140 set_pixels_completion_forced(false), |
147 allocated(false), | 141 allocated(false), |
148 enable_read_lock_fences(false), | 142 enable_read_lock_fences(false), |
149 read_lock_fence(NULL), | 143 read_lock_fence(NULL), |
150 size(size), | 144 size(size), |
151 format(format), | 145 format(format), |
152 filter(filter), | 146 filter(filter), |
153 image_id(0), | 147 image_id(0), |
154 texture_pool(0), | 148 texture_pool(0), |
149 wrap_mode(wrap_mode), | |
155 hint(TextureUsageAny), | 150 hint(TextureUsageAny), |
156 type(Bitmap) {} | 151 type(Bitmap) { |
152 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); | |
153 } | |
157 | 154 |
158 ResourceProvider::Child::Child() {} | 155 ResourceProvider::Child::Child() {} |
159 | 156 |
160 ResourceProvider::Child::~Child() {} | 157 ResourceProvider::Child::~Child() {} |
161 | 158 |
162 scoped_ptr<ResourceProvider> ResourceProvider::Create( | 159 scoped_ptr<ResourceProvider> ResourceProvider::Create( |
163 OutputSurface* output_surface, | 160 OutputSurface* output_surface, |
164 int highp_threshold_min) { | 161 int highp_threshold_min) { |
165 scoped_ptr<ResourceProvider> resource_provider( | 162 scoped_ptr<ResourceProvider> resource_provider( |
166 new ResourceProvider(output_surface, highp_threshold_min)); | 163 new ResourceProvider(output_surface, highp_threshold_min)); |
(...skipping 19 matching lines...) Expand all Loading... | |
186 | 183 |
187 CleanUpGLIfNeeded(); | 184 CleanUpGLIfNeeded(); |
188 } | 185 } |
189 | 186 |
190 bool ResourceProvider::InUseByConsumer(ResourceId id) { | 187 bool ResourceProvider::InUseByConsumer(ResourceId id) { |
191 Resource* resource = GetResource(id); | 188 Resource* resource = GetResource(id); |
192 return resource->lock_for_read_count > 0 || resource->exported_count > 0; | 189 return resource->lock_for_read_count > 0 || resource->exported_count > 0; |
193 } | 190 } |
194 | 191 |
195 ResourceProvider::ResourceId ResourceProvider::CreateResource( | 192 ResourceProvider::ResourceId ResourceProvider::CreateResource( |
196 gfx::Size size, GLenum format, TextureUsageHint hint) { | 193 gfx::Size size, GLenum format, GLint wrap_mode, TextureUsageHint hint) { |
197 DCHECK(!size.IsEmpty()); | 194 DCHECK(!size.IsEmpty()); |
198 switch (default_resource_type_) { | 195 switch (default_resource_type_) { |
199 case GLTexture: | 196 case GLTexture: |
200 return CreateGLTexture( | 197 return CreateGLTexture(size, format, GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, |
201 size, format, GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, hint); | 198 wrap_mode, hint); |
202 case Bitmap: | 199 case Bitmap: |
203 DCHECK(format == GL_RGBA); | 200 DCHECK(format == GL_RGBA); |
204 return CreateBitmap(size); | 201 return CreateBitmap(size); |
enne (OOO)
2013/09/04 17:36:56
Can you leave a comment with the bug you filed her
ccameron
2013/09/04 20:00:39
Done.
| |
205 case InvalidType: | 202 case InvalidType: |
206 break; | 203 break; |
207 } | 204 } |
208 | 205 |
209 LOG(FATAL) << "Invalid default resource type."; | 206 LOG(FATAL) << "Invalid default resource type."; |
210 return 0; | 207 return 0; |
211 } | 208 } |
212 | 209 |
213 ResourceProvider::ResourceId ResourceProvider::CreateManagedResource( | 210 ResourceProvider::ResourceId ResourceProvider::CreateManagedResource( |
214 gfx::Size size, GLenum format, TextureUsageHint hint) { | 211 gfx::Size size, GLenum format, GLint wrap_mode, TextureUsageHint hint) { |
215 DCHECK(!size.IsEmpty()); | 212 DCHECK(!size.IsEmpty()); |
216 switch (default_resource_type_) { | 213 switch (default_resource_type_) { |
217 case GLTexture: | 214 case GLTexture: |
218 return CreateGLTexture( | 215 return CreateGLTexture(size, format, GL_TEXTURE_POOL_MANAGED_CHROMIUM, |
219 size, format, GL_TEXTURE_POOL_MANAGED_CHROMIUM, hint); | 216 wrap_mode, hint); |
220 case Bitmap: | 217 case Bitmap: |
221 DCHECK(format == GL_RGBA); | 218 DCHECK(format == GL_RGBA); |
222 return CreateBitmap(size); | 219 return CreateBitmap(size); |
223 case InvalidType: | 220 case InvalidType: |
224 break; | 221 break; |
225 } | 222 } |
226 | 223 |
227 LOG(FATAL) << "Invalid default resource type."; | 224 LOG(FATAL) << "Invalid default resource type."; |
228 return 0; | 225 return 0; |
229 } | 226 } |
230 | 227 |
231 ResourceProvider::ResourceId ResourceProvider::CreateGLTexture( | 228 ResourceProvider::ResourceId ResourceProvider::CreateGLTexture( |
232 gfx::Size size, GLenum format, GLenum texture_pool, TextureUsageHint hint) { | 229 gfx::Size size, |
230 GLenum format, | |
231 GLenum texture_pool, | |
232 GLint wrap_mode, | |
233 TextureUsageHint hint) { | |
233 DCHECK_LE(size.width(), max_texture_size_); | 234 DCHECK_LE(size.width(), max_texture_size_); |
234 DCHECK_LE(size.height(), max_texture_size_); | 235 DCHECK_LE(size.height(), max_texture_size_); |
235 DCHECK(thread_checker_.CalledOnValidThread()); | 236 DCHECK(thread_checker_.CalledOnValidThread()); |
236 | 237 |
237 ResourceId id = next_id_++; | 238 ResourceId id = next_id_++; |
238 Resource resource(0, size, format, GL_LINEAR, texture_pool, hint); | 239 Resource resource(0, size, format, GL_LINEAR, texture_pool, wrap_mode, hint); |
239 resource.allocated = false; | 240 resource.allocated = false; |
240 resources_[id] = resource; | 241 resources_[id] = resource; |
241 return id; | 242 return id; |
242 } | 243 } |
243 | 244 |
244 ResourceProvider::ResourceId ResourceProvider::CreateBitmap(gfx::Size size) { | 245 ResourceProvider::ResourceId ResourceProvider::CreateBitmap(gfx::Size size) { |
245 DCHECK(thread_checker_.CalledOnValidThread()); | 246 DCHECK(thread_checker_.CalledOnValidThread()); |
246 | 247 |
247 uint8_t* pixels = new uint8_t[4 * size.GetArea()]; | 248 uint8_t* pixels = new uint8_t[4 * size.GetArea()]; |
248 | 249 |
249 ResourceId id = next_id_++; | 250 ResourceId id = next_id_++; |
250 Resource resource(pixels, size, GL_RGBA, GL_LINEAR); | 251 Resource resource(pixels, size, GL_RGBA, GL_LINEAR, GL_CLAMP_TO_EDGE); |
251 resource.allocated = true; | 252 resource.allocated = true; |
252 resources_[id] = resource; | 253 resources_[id] = resource; |
253 return id; | 254 return id; |
254 } | 255 } |
255 | 256 |
256 ResourceProvider::ResourceId | 257 ResourceProvider::ResourceId |
257 ResourceProvider::CreateResourceFromExternalTexture( | 258 ResourceProvider::CreateResourceFromExternalTexture( |
258 unsigned texture_target, | 259 unsigned texture_target, |
259 unsigned texture_id) { | 260 unsigned texture_id) { |
260 DCHECK(thread_checker_.CalledOnValidThread()); | 261 DCHECK(thread_checker_.CalledOnValidThread()); |
261 | 262 |
262 WebGraphicsContext3D* context3d = Context3d(); | 263 WebGraphicsContext3D* context3d = Context3d(); |
263 DCHECK(context3d); | 264 DCHECK(context3d); |
264 GLC(context3d, context3d->bindTexture(texture_target, texture_id)); | 265 GLC(context3d, context3d->bindTexture(texture_target, texture_id)); |
265 GLC(context3d, context3d->texParameteri( | 266 GLC(context3d, context3d->texParameteri( |
266 texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); | 267 texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); |
267 GLC(context3d, context3d->texParameteri( | 268 GLC(context3d, context3d->texParameteri( |
268 texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); | 269 texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); |
269 GLC(context3d, context3d->texParameteri( | 270 GLC(context3d, context3d->texParameteri( |
270 texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); | 271 texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); |
271 GLC(context3d, context3d->texParameteri( | 272 GLC(context3d, context3d->texParameteri( |
272 texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); | 273 texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); |
273 | 274 |
274 ResourceId id = next_id_++; | 275 ResourceId id = next_id_++; |
275 Resource resource(texture_id, gfx::Size(), 0, GL_LINEAR, 0, TextureUsageAny); | 276 Resource resource(texture_id, gfx::Size(), 0, GL_LINEAR, 0, GL_CLAMP_TO_EDGE, |
277 TextureUsageAny); | |
276 resource.external = true; | 278 resource.external = true; |
277 resource.allocated = true; | 279 resource.allocated = true; |
278 resources_[id] = resource; | 280 resources_[id] = resource; |
279 return id; | 281 return id; |
280 } | 282 } |
281 | 283 |
282 ResourceProvider::ResourceId ResourceProvider::CreateResourceFromTextureMailbox( | 284 ResourceProvider::ResourceId ResourceProvider::CreateResourceFromTextureMailbox( |
283 const TextureMailbox& mailbox) { | 285 const TextureMailbox& mailbox) { |
284 DCHECK(thread_checker_.CalledOnValidThread()); | 286 DCHECK(thread_checker_.CalledOnValidThread()); |
285 // Just store the information. Mailbox will be consumed in LockForRead(). | 287 // Just store the information. Mailbox will be consumed in LockForRead(). |
286 ResourceId id = next_id_++; | 288 ResourceId id = next_id_++; |
287 DCHECK(mailbox.IsValid()); | 289 DCHECK(mailbox.IsValid()); |
288 Resource& resource = resources_[id]; | 290 Resource& resource = resources_[id]; |
289 if (mailbox.IsTexture()) { | 291 if (mailbox.IsTexture()) { |
290 resource = Resource(0, gfx::Size(), 0, GL_LINEAR, 0, TextureUsageAny); | 292 resource = Resource(0, gfx::Size(), 0, GL_LINEAR, 0, GL_CLAMP_TO_EDGE, |
293 TextureUsageAny); | |
291 } else { | 294 } else { |
292 DCHECK(mailbox.IsSharedMemory()); | 295 DCHECK(mailbox.IsSharedMemory()); |
293 base::SharedMemory* shared_memory = mailbox.shared_memory(); | 296 base::SharedMemory* shared_memory = mailbox.shared_memory(); |
294 DCHECK(shared_memory->memory()); | 297 DCHECK(shared_memory->memory()); |
295 uint8_t* pixels = reinterpret_cast<uint8_t*>(shared_memory->memory()); | 298 uint8_t* pixels = reinterpret_cast<uint8_t*>(shared_memory->memory()); |
296 resource = Resource(pixels, mailbox.shared_memory_size(), | 299 resource = Resource(pixels, mailbox.shared_memory_size(), |
297 GL_RGBA, GL_LINEAR); | 300 GL_RGBA, GL_LINEAR, GL_CLAMP_TO_EDGE); |
298 } | 301 } |
299 resource.external = true; | 302 resource.external = true; |
300 resource.allocated = true; | 303 resource.allocated = true; |
301 resource.mailbox = mailbox; | 304 resource.mailbox = mailbox; |
302 return id; | 305 return id; |
303 } | 306 } |
304 | 307 |
305 void ResourceProvider::DeleteResource(ResourceId id) { | 308 void ResourceProvider::DeleteResource(ResourceId id) { |
306 DCHECK(thread_checker_.CalledOnValidThread()); | 309 DCHECK(thread_checker_.CalledOnValidThread()); |
307 ResourceMap::iterator it = resources_.find(id); | 310 ResourceMap::iterator it = resources_.find(id); |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
877 // However if the parent is a renderer (e.g. browser tag), it may be ok | 880 // However if the parent is a renderer (e.g. browser tag), it may be ok |
878 // (and is simpler) to wait. | 881 // (and is simpler) to wait. |
879 if (it->sync_point) | 882 if (it->sync_point) |
880 GLC(context3d, context3d->waitSyncPoint(it->sync_point)); | 883 GLC(context3d, context3d->waitSyncPoint(it->sync_point)); |
881 GLC(context3d, texture_id = context3d->createTexture()); | 884 GLC(context3d, texture_id = context3d->createTexture()); |
882 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, texture_id)); | 885 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, texture_id)); |
883 GLC(context3d, context3d->consumeTextureCHROMIUM(GL_TEXTURE_2D, | 886 GLC(context3d, context3d->consumeTextureCHROMIUM(GL_TEXTURE_2D, |
884 it->mailbox.name)); | 887 it->mailbox.name)); |
885 ResourceId id = next_id_++; | 888 ResourceId id = next_id_++; |
886 Resource resource( | 889 Resource resource( |
887 texture_id, it->size, it->format, it->filter, 0, TextureUsageAny); | 890 texture_id, it->size, it->format, it->filter, 0, GL_CLAMP_TO_EDGE, |
891 TextureUsageAny); | |
888 resource.mailbox.SetName(it->mailbox); | 892 resource.mailbox.SetName(it->mailbox); |
889 // Don't allocate a texture for a child. | 893 // Don't allocate a texture for a child. |
890 resource.allocated = true; | 894 resource.allocated = true; |
891 resource.imported_count = 1; | 895 resource.imported_count = 1; |
892 resources_[id] = resource; | 896 resources_[id] = resource; |
893 child_info.parent_to_child_map[id] = it->id; | 897 child_info.parent_to_child_map[id] = it->id; |
894 child_info.child_to_parent_map[it->id] = id; | 898 child_info.child_to_parent_map[it->id] = id; |
895 } | 899 } |
896 } | 900 } |
897 | 901 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1235 resource->pending_set_pixels = false; | 1239 resource->pending_set_pixels = false; |
1236 UnlockForWrite(id); | 1240 UnlockForWrite(id); |
1237 | 1241 |
1238 return true; | 1242 return true; |
1239 } | 1243 } |
1240 | 1244 |
1241 void ResourceProvider::CreateForTesting(ResourceId id) { | 1245 void ResourceProvider::CreateForTesting(ResourceId id) { |
1242 LazyCreate(GetResource(id)); | 1246 LazyCreate(GetResource(id)); |
1243 } | 1247 } |
1244 | 1248 |
1249 GLint ResourceProvider::WrapModeForTesting(ResourceId id) { | |
1250 Resource* resource = GetResource(id); | |
1251 return resource->wrap_mode; | |
1252 } | |
1253 | |
1245 void ResourceProvider::LazyCreate(Resource* resource) { | 1254 void ResourceProvider::LazyCreate(Resource* resource) { |
1246 if (resource->type != GLTexture || resource->gl_id != 0) | 1255 if (resource->type != GLTexture || resource->gl_id != 0) |
1247 return; | 1256 return; |
1248 | 1257 |
1249 // Early out for resources that don't require texture creation. | 1258 // Early out for resources that don't require texture creation. |
1250 if (resource->texture_pool == 0) | 1259 if (resource->texture_pool == 0) |
1251 return; | 1260 return; |
1252 | 1261 |
1253 WebGraphicsContext3D* context3d = Context3d(); | 1262 WebGraphicsContext3D* context3d = Context3d(); |
1254 DCHECK(context3d); | 1263 DCHECK(context3d); |
1264 | |
1255 // Create and set texture properties. Allocation is delayed until needed. | 1265 // Create and set texture properties. Allocation is delayed until needed. |
1256 resource->gl_id = CreateTextureId(context3d); | 1266 GLC(context3d, resource->gl_id = context3d->createTexture()); |
1267 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->gl_id)); | |
1268 GLC(context3d, context3d->texParameteri( | |
1269 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); | |
1270 GLC(context3d, context3d->texParameteri( | |
1271 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); | |
1272 GLC(context3d, context3d->texParameteri( | |
1273 GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, resource->wrap_mode)); | |
1274 GLC(context3d, context3d->texParameteri( | |
1275 GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, resource->wrap_mode)); | |
1257 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, | 1276 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, |
1258 GL_TEXTURE_POOL_CHROMIUM, | 1277 GL_TEXTURE_POOL_CHROMIUM, |
1259 resource->texture_pool)); | 1278 resource->texture_pool)); |
1260 if (use_texture_usage_hint_ && resource->hint == TextureUsageFramebuffer) { | 1279 if (use_texture_usage_hint_ && resource->hint == TextureUsageFramebuffer) { |
1261 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, | 1280 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, |
1262 GL_TEXTURE_USAGE_ANGLE, | 1281 GL_TEXTURE_USAGE_ANGLE, |
1263 GL_FRAMEBUFFER_ATTACHMENT_ANGLE)); | 1282 GL_FRAMEBUFFER_ATTACHMENT_ANGLE)); |
1264 } | 1283 } |
1265 } | 1284 } |
1266 | 1285 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1394 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 1413 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
1395 return active_unit; | 1414 return active_unit; |
1396 } | 1415 } |
1397 | 1416 |
1398 WebKit::WebGraphicsContext3D* ResourceProvider::Context3d() const { | 1417 WebKit::WebGraphicsContext3D* ResourceProvider::Context3d() const { |
1399 ContextProvider* context_provider = output_surface_->context_provider(); | 1418 ContextProvider* context_provider = output_surface_->context_provider(); |
1400 return context_provider ? context_provider->Context3d() : NULL; | 1419 return context_provider ? context_provider->Context3d() : NULL; |
1401 } | 1420 } |
1402 | 1421 |
1403 } // namespace cc | 1422 } // namespace cc |
OLD | NEW |