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_sync.h" | 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_sync.h" |
6 | 6 |
7 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" | 7 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" |
8 | 8 |
9 namespace gpu { | 9 namespace gpu { |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 AsyncPixelTransferDelegateSync::~AsyncPixelTransferDelegateSync() {} | 39 AsyncPixelTransferDelegateSync::~AsyncPixelTransferDelegateSync() {} |
40 | 40 |
41 void AsyncPixelTransferDelegateSync::AsyncTexImage2D( | 41 void AsyncPixelTransferDelegateSync::AsyncTexImage2D( |
42 const AsyncTexImage2DParams& tex_params, | 42 const AsyncTexImage2DParams& tex_params, |
43 const AsyncMemoryParams& mem_params, | 43 const AsyncMemoryParams& mem_params, |
44 const base::Closure& bind_callback) { | 44 const base::Closure& bind_callback) { |
45 // Save the define params to return later during deferred | 45 // Save the define params to return later during deferred |
46 // binding of the transfer texture. | 46 // binding of the transfer texture. |
47 void* data = mem_params.GetDataAddress(); | 47 void* data = mem_params.GetDataAddress(); |
48 base::TimeTicks begin_time(base::TimeTicks::HighResNow()); | 48 base::TimeTicks begin_time(base::TimeTicks::Now()); |
49 glTexImage2D( | 49 glTexImage2D( |
50 tex_params.target, | 50 tex_params.target, |
51 tex_params.level, | 51 tex_params.level, |
52 tex_params.internal_format, | 52 tex_params.internal_format, |
53 tex_params.width, | 53 tex_params.width, |
54 tex_params.height, | 54 tex_params.height, |
55 tex_params.border, | 55 tex_params.border, |
56 tex_params.format, | 56 tex_params.format, |
57 tex_params.type, | 57 tex_params.type, |
58 data); | 58 data); |
59 shared_state_->texture_upload_count++; | 59 shared_state_->texture_upload_count++; |
60 shared_state_->total_texture_upload_time += | 60 shared_state_->total_texture_upload_time += |
61 base::TimeTicks::HighResNow() - begin_time; | 61 base::TimeTicks::Now() - begin_time; |
62 // The texture is already fully bound so just call it now. | 62 // The texture is already fully bound so just call it now. |
63 bind_callback.Run(); | 63 bind_callback.Run(); |
64 } | 64 } |
65 | 65 |
66 void AsyncPixelTransferDelegateSync::AsyncTexSubImage2D( | 66 void AsyncPixelTransferDelegateSync::AsyncTexSubImage2D( |
67 const AsyncTexSubImage2DParams& tex_params, | 67 const AsyncTexSubImage2DParams& tex_params, |
68 const AsyncMemoryParams& mem_params) { | 68 const AsyncMemoryParams& mem_params) { |
69 void* data = mem_params.GetDataAddress(); | 69 void* data = mem_params.GetDataAddress(); |
70 base::TimeTicks begin_time(base::TimeTicks::HighResNow()); | 70 base::TimeTicks begin_time(base::TimeTicks::Now()); |
71 glTexSubImage2D( | 71 glTexSubImage2D( |
72 tex_params.target, | 72 tex_params.target, |
73 tex_params.level, | 73 tex_params.level, |
74 tex_params.xoffset, | 74 tex_params.xoffset, |
75 tex_params.yoffset, | 75 tex_params.yoffset, |
76 tex_params.width, | 76 tex_params.width, |
77 tex_params.height, | 77 tex_params.height, |
78 tex_params.format, | 78 tex_params.format, |
79 tex_params.type, | 79 tex_params.type, |
80 data); | 80 data); |
81 shared_state_->texture_upload_count++; | 81 shared_state_->texture_upload_count++; |
82 shared_state_->total_texture_upload_time += | 82 shared_state_->total_texture_upload_time += |
83 base::TimeTicks::HighResNow() - begin_time; | 83 base::TimeTicks::Now() - begin_time; |
84 } | 84 } |
85 | 85 |
86 bool AsyncPixelTransferDelegateSync::TransferIsInProgress() { | 86 bool AsyncPixelTransferDelegateSync::TransferIsInProgress() { |
87 // Already done. | 87 // Already done. |
88 return false; | 88 return false; |
89 } | 89 } |
90 | 90 |
91 void AsyncPixelTransferDelegateSync::WaitForTransferCompletion() { | 91 void AsyncPixelTransferDelegateSync::WaitForTransferCompletion() { |
92 // Already done. | 92 // Already done. |
93 } | 93 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 130 } |
131 | 131 |
132 AsyncPixelTransferDelegate* | 132 AsyncPixelTransferDelegate* |
133 AsyncPixelTransferManagerSync::CreatePixelTransferDelegateImpl( | 133 AsyncPixelTransferManagerSync::CreatePixelTransferDelegateImpl( |
134 gles2::TextureRef* ref, | 134 gles2::TextureRef* ref, |
135 const AsyncTexImage2DParams& define_params) { | 135 const AsyncTexImage2DParams& define_params) { |
136 return new AsyncPixelTransferDelegateSync(&shared_state_); | 136 return new AsyncPixelTransferDelegateSync(&shared_state_); |
137 } | 137 } |
138 | 138 |
139 } // namespace gpu | 139 } // namespace gpu |
OLD | NEW |