OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/async_pixel_transfer_manager_share_group.h" | 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_share_group.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 TRACE_EVENT2("gpu", | 286 TRACE_EVENT2("gpu", |
287 "PerformAsyncTexImage", | 287 "PerformAsyncTexImage", |
288 "width", | 288 "width", |
289 tex_params.width, | 289 tex_params.width, |
290 "height", | 290 "height", |
291 tex_params.height); | 291 tex_params.height); |
292 DCHECK_EQ(0, tex_params.level); | 292 DCHECK_EQ(0, tex_params.level); |
293 | 293 |
294 base::TimeTicks begin_time; | 294 base::TimeTicks begin_time; |
295 if (texture_upload_stats.get()) | 295 if (texture_upload_stats.get()) |
296 begin_time = base::TimeTicks::HighResNow(); | 296 begin_time = base::TimeTicks::Now(); |
297 | 297 |
298 void* data = mem_params.GetDataAddress(); | 298 void* data = mem_params.GetDataAddress(); |
299 | 299 |
300 { | 300 { |
301 TRACE_EVENT0("gpu", "glTexImage2D"); | 301 TRACE_EVENT0("gpu", "glTexImage2D"); |
302 glTexImage2D(GL_TEXTURE_2D, | 302 glTexImage2D(GL_TEXTURE_2D, |
303 tex_params.level, | 303 tex_params.level, |
304 tex_params.internal_format, | 304 tex_params.internal_format, |
305 tex_params.width, | 305 tex_params.width, |
306 tex_params.height, | 306 tex_params.height, |
307 tex_params.border, | 307 tex_params.border, |
308 tex_params.format, | 308 tex_params.format, |
309 tex_params.type, | 309 tex_params.type, |
310 data); | 310 data); |
311 TRACE_EVENT_SYNTHETIC_DELAY_END("gpu.AsyncTexImage"); | 311 TRACE_EVENT_SYNTHETIC_DELAY_END("gpu.AsyncTexImage"); |
312 } | 312 } |
313 | 313 |
314 if (texture_upload_stats.get()) { | 314 if (texture_upload_stats.get()) { |
315 texture_upload_stats->AddUpload(base::TimeTicks::HighResNow() - | 315 texture_upload_stats->AddUpload(base::TimeTicks::Now() - begin_time); |
316 begin_time); | |
317 } | 316 } |
318 } | 317 } |
319 | 318 |
320 void PerformAsyncTexSubImage2D( | 319 void PerformAsyncTexSubImage2D( |
321 AsyncTexSubImage2DParams tex_params, | 320 AsyncTexSubImage2DParams tex_params, |
322 AsyncMemoryParams mem_params, | 321 AsyncMemoryParams mem_params, |
323 scoped_refptr<AsyncPixelTransferUploadStats> texture_upload_stats) { | 322 scoped_refptr<AsyncPixelTransferUploadStats> texture_upload_stats) { |
324 TRACE_EVENT2("gpu", | 323 TRACE_EVENT2("gpu", |
325 "PerformAsyncTexSubImage2D", | 324 "PerformAsyncTexSubImage2D", |
326 "width", | 325 "width", |
327 tex_params.width, | 326 tex_params.width, |
328 "height", | 327 "height", |
329 tex_params.height); | 328 tex_params.height); |
330 DCHECK_EQ(0, tex_params.level); | 329 DCHECK_EQ(0, tex_params.level); |
331 | 330 |
332 base::TimeTicks begin_time; | 331 base::TimeTicks begin_time; |
333 if (texture_upload_stats.get()) | 332 if (texture_upload_stats.get()) |
334 begin_time = base::TimeTicks::HighResNow(); | 333 begin_time = base::TimeTicks::Now(); |
335 | 334 |
336 void* data = mem_params.GetDataAddress(); | 335 void* data = mem_params.GetDataAddress(); |
337 { | 336 { |
338 TRACE_EVENT0("gpu", "glTexSubImage2D"); | 337 TRACE_EVENT0("gpu", "glTexSubImage2D"); |
339 glTexSubImage2D(GL_TEXTURE_2D, | 338 glTexSubImage2D(GL_TEXTURE_2D, |
340 tex_params.level, | 339 tex_params.level, |
341 tex_params.xoffset, | 340 tex_params.xoffset, |
342 tex_params.yoffset, | 341 tex_params.yoffset, |
343 tex_params.width, | 342 tex_params.width, |
344 tex_params.height, | 343 tex_params.height, |
345 tex_params.format, | 344 tex_params.format, |
346 tex_params.type, | 345 tex_params.type, |
347 data); | 346 data); |
348 TRACE_EVENT_SYNTHETIC_DELAY_END("gpu.AsyncTexImage"); | 347 TRACE_EVENT_SYNTHETIC_DELAY_END("gpu.AsyncTexImage"); |
349 } | 348 } |
350 | 349 |
351 if (texture_upload_stats.get()) { | 350 if (texture_upload_stats.get()) { |
352 texture_upload_stats->AddUpload(base::TimeTicks::HighResNow() - | 351 texture_upload_stats->AddUpload(base::TimeTicks::Now() - begin_time); |
353 begin_time); | |
354 } | 352 } |
355 } | 353 } |
356 | 354 |
357 scoped_refptr<PendingTask> pending_upload_task_; | 355 scoped_refptr<PendingTask> pending_upload_task_; |
358 | 356 |
359 GLuint texture_id_; | 357 GLuint texture_id_; |
360 | 358 |
361 // Definition params for texture that needs binding. | 359 // Definition params for texture that needs binding. |
362 AsyncTexImage2DParams define_params_; | 360 AsyncTexImage2DParams define_params_; |
363 | 361 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 542 |
545 AsyncPixelTransferDelegate* | 543 AsyncPixelTransferDelegate* |
546 AsyncPixelTransferManagerShareGroup::CreatePixelTransferDelegateImpl( | 544 AsyncPixelTransferManagerShareGroup::CreatePixelTransferDelegateImpl( |
547 gles2::TextureRef* ref, | 545 gles2::TextureRef* ref, |
548 const AsyncTexImage2DParams& define_params) { | 546 const AsyncTexImage2DParams& define_params) { |
549 return new AsyncPixelTransferDelegateShareGroup( | 547 return new AsyncPixelTransferDelegateShareGroup( |
550 &shared_state_, ref->service_id(), define_params); | 548 &shared_state_, ref->service_id(), define_params); |
551 } | 549 } |
552 | 550 |
553 } // namespace gpu | 551 } // namespace gpu |
OLD | NEW |