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

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

Issue 16325018: GPU: Factory produces APTManagers instead of APTDelegates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_sync.h"
6
7 namespace gpu {
8
9 namespace {
10
11 class AsyncPixelTransferStateImpl : public AsyncPixelTransferState {
12 public:
13 AsyncPixelTransferStateImpl() {}
14
15 // Implement AsyncPixelTransferState:
16 virtual bool TransferIsInProgress() OVERRIDE {
17 return false;
18 }
19
20 private:
21 virtual ~AsyncPixelTransferStateImpl() {}
22 };
23
24 } // namespace
25
26 AsyncPixelTransferDelegateSync::AsyncPixelTransferDelegateSync()
27 : texture_upload_count_(0) {
28 }
29
30 AsyncPixelTransferDelegateSync::~AsyncPixelTransferDelegateSync() {}
31
32 AsyncPixelTransferState* AsyncPixelTransferDelegateSync::
33 CreatePixelTransferState(GLuint texture_id,
34 const AsyncTexImage2DParams& define_params) {
35 return new AsyncPixelTransferStateImpl;
36 }
37
38 void AsyncPixelTransferDelegateSync::BindCompletedAsyncTransfers() {
39 // Everything is already bound.
40 }
41
42 void AsyncPixelTransferDelegateSync::AsyncNotifyCompletion(
43 const AsyncMemoryParams& mem_params,
44 const CompletionCallback& callback) {
45 callback.Run(mem_params);
46 }
47
48 void AsyncPixelTransferDelegateSync::AsyncTexImage2D(
49 AsyncPixelTransferState* transfer_state,
50 const AsyncTexImage2DParams& tex_params,
51 const AsyncMemoryParams& mem_params,
52 const base::Closure& bind_callback) {
53 // Save the define params to return later during deferred
54 // binding of the transfer texture.
55 DCHECK(transfer_state);
56 void* data = GetAddress(mem_params);
57 glTexImage2D(
58 tex_params.target,
59 tex_params.level,
60 tex_params.internal_format,
61 tex_params.width,
62 tex_params.height,
63 tex_params.border,
64 tex_params.format,
65 tex_params.type,
66 data);
67 // The texture is already fully bound so just call it now.
68 bind_callback.Run();
69 }
70
71 void AsyncPixelTransferDelegateSync::AsyncTexSubImage2D(
72 AsyncPixelTransferState* transfer_state,
73 const AsyncTexSubImage2DParams& tex_params,
74 const AsyncMemoryParams& mem_params) {
75 void* data = GetAddress(mem_params);
76 DCHECK(transfer_state);
77 base::TimeTicks begin_time(base::TimeTicks::HighResNow());
78 glTexSubImage2D(
79 tex_params.target,
80 tex_params.level,
81 tex_params.xoffset,
82 tex_params.yoffset,
83 tex_params.width,
84 tex_params.height,
85 tex_params.format,
86 tex_params.type,
87 data);
88 texture_upload_count_++;
89 total_texture_upload_time_ += base::TimeTicks::HighResNow() - begin_time;
90 }
91
92 void AsyncPixelTransferDelegateSync::WaitForTransferCompletion(
93 AsyncPixelTransferState* state) {
94 // Already done.
95 }
96
97 uint32 AsyncPixelTransferDelegateSync::GetTextureUploadCount() {
98 return texture_upload_count_;
99 }
100
101 base::TimeDelta AsyncPixelTransferDelegateSync::GetTotalTextureUploadTime() {
102 return total_texture_upload_time_;
103 }
104
105 void AsyncPixelTransferDelegateSync::ProcessMorePendingTransfers() {
106 }
107
108 bool AsyncPixelTransferDelegateSync::NeedsProcessMorePendingTransfers() {
109 return false;
110 }
111
112 } // namespace gpu
113
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698