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/test/render_pass_test_utils.h" | 5 #include "cc/test/render_pass_test_utils.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "cc/quads/debug_border_draw_quad.h" | 8 #include "cc/quads/debug_border_draw_quad.h" |
9 #include "cc/quads/io_surface_draw_quad.h" | 9 #include "cc/quads/io_surface_draw_quad.h" |
10 #include "cc/quads/render_pass_draw_quad.h" | 10 #include "cc/quads/render_pass_draw_quad.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 output_rect, | 136 output_rect, |
137 contributing_pass->id, | 137 contributing_pass->id, |
138 mask_resource_id, | 138 mask_resource_id, |
139 gfx::Vector2dF(1.f, 1.f), | 139 gfx::Vector2dF(1.f, 1.f), |
140 arbitrary_nonzero_size, | 140 arbitrary_nonzero_size, |
141 filters, | 141 filters, |
142 gfx::Vector2dF(), | 142 gfx::Vector2dF(), |
143 FilterOperations()); | 143 FilterOperations()); |
144 } | 144 } |
145 | 145 |
146 static void EmptyReleaseCallback(uint32 sync_point, | 146 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token, |
147 bool lost_resource, | 147 bool lost_resource, |
148 BlockingTaskRunner* main_thread_task_runner) {} | 148 BlockingTaskRunner* main_thread_task_runner) {} |
149 | 149 |
150 void AddOneOfEveryQuadType(RenderPass* to_pass, | 150 void AddOneOfEveryQuadType(RenderPass* to_pass, |
151 ResourceProvider* resource_provider, | 151 ResourceProvider* resource_provider, |
152 RenderPassId child_pass, | 152 RenderPassId child_pass, |
153 uint32_t* sync_point_for_mailbox_texture_quad) { | 153 uint32_t* sync_point_for_mailbox_texture) { |
154 gfx::Rect rect(0, 0, 100, 100); | 154 gfx::Rect rect(0, 0, 100, 100); |
155 gfx::Rect opaque_rect(10, 10, 80, 80); | 155 gfx::Rect opaque_rect(10, 10, 80, 80); |
156 gfx::Rect visible_rect(0, 0, 100, 100); | 156 gfx::Rect visible_rect(0, 0, 100, 100); |
157 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 157 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
158 | 158 |
159 static const uint32_t kSyncPointForMailboxTextureQuad = 30; | 159 static const uint32_t kSyncTokenForMailboxTextureQuad = 30; |
160 *sync_point_for_mailbox_texture_quad = kSyncPointForMailboxTextureQuad; | 160 *sync_point_for_mailbox_texture = kSyncTokenForMailboxTextureQuad; |
161 | 161 |
162 ResourceId resource1 = resource_provider->CreateResource( | 162 ResourceId resource1 = resource_provider->CreateResource( |
163 gfx::Size(45, 5), ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 163 gfx::Size(45, 5), ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
164 resource_provider->best_texture_format()); | 164 resource_provider->best_texture_format()); |
165 resource_provider->AllocateForTesting(resource1); | 165 resource_provider->AllocateForTesting(resource1); |
166 ResourceId resource2 = resource_provider->CreateResource( | 166 ResourceId resource2 = resource_provider->CreateResource( |
167 gfx::Size(346, 61), ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 167 gfx::Size(346, 61), ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
168 resource_provider->best_texture_format()); | 168 resource_provider->best_texture_format()); |
169 resource_provider->AllocateForTesting(resource2); | 169 resource_provider->AllocateForTesting(resource2); |
170 ResourceId resource3 = resource_provider->CreateResource( | 170 ResourceId resource3 = resource_provider->CreateResource( |
(...skipping 16 matching lines...) Expand all Loading... |
187 ResourceId resource7 = resource_provider->CreateResource( | 187 ResourceId resource7 = resource_provider->CreateResource( |
188 gfx::Size(9, 14), ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 188 gfx::Size(9, 14), ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
189 resource_provider->best_texture_format()); | 189 resource_provider->best_texture_format()); |
190 resource_provider->AllocateForTesting(resource7); | 190 resource_provider->AllocateForTesting(resource7); |
191 | 191 |
192 unsigned target = GL_TEXTURE_2D; | 192 unsigned target = GL_TEXTURE_2D; |
193 gpu::Mailbox gpu_mailbox; | 193 gpu::Mailbox gpu_mailbox; |
194 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 194 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
195 scoped_ptr<SingleReleaseCallbackImpl> callback = | 195 scoped_ptr<SingleReleaseCallbackImpl> callback = |
196 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); | 196 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
197 TextureMailbox mailbox(gpu_mailbox, target, | 197 TextureMailbox mailbox( |
198 *sync_point_for_mailbox_texture_quad); | 198 gpu_mailbox, gpu::SyncToken(*sync_point_for_mailbox_texture), target); |
199 ResourceId resource8 = resource_provider->CreateResourceFromTextureMailbox( | 199 ResourceId resource8 = resource_provider->CreateResourceFromTextureMailbox( |
200 mailbox, callback.Pass()); | 200 mailbox, callback.Pass()); |
201 resource_provider->AllocateForTesting(resource8); | 201 resource_provider->AllocateForTesting(resource8); |
202 | 202 |
203 SharedQuadState* shared_state = to_pass->CreateAndAppendSharedQuadState(); | 203 SharedQuadState* shared_state = to_pass->CreateAndAppendSharedQuadState(); |
204 shared_state->SetAll(gfx::Transform(), rect.size(), rect, rect, false, 1, | 204 shared_state->SetAll(gfx::Transform(), rect.size(), rect, rect, false, 1, |
205 SkXfermode::kSrcOver_Mode, 0); | 205 SkXfermode::kSrcOver_Mode, 0); |
206 | 206 |
207 DebugBorderDrawQuad* debug_border_quad = | 207 DebugBorderDrawQuad* debug_border_quad = |
208 to_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); | 208 to_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 YUVVideoDrawQuad* yuv_quad = | 292 YUVVideoDrawQuad* yuv_quad = |
293 to_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); | 293 to_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); |
294 yuv_quad->SetNew(shared_state2, rect, opaque_rect, visible_rect, | 294 yuv_quad->SetNew(shared_state2, rect, opaque_rect, visible_rect, |
295 gfx::RectF(.0f, .0f, 100.0f, 100.0f), | 295 gfx::RectF(.0f, .0f, 100.0f, 100.0f), |
296 gfx::RectF(.0f, .0f, 50.0f, 50.0f), gfx::Size(100, 100), | 296 gfx::RectF(.0f, .0f, 50.0f, 50.0f), gfx::Size(100, 100), |
297 gfx::Size(50, 50), plane_resources[0], plane_resources[1], | 297 gfx::Size(50, 50), plane_resources[0], plane_resources[1], |
298 plane_resources[2], plane_resources[3], color_space); | 298 plane_resources[2], plane_resources[3], color_space); |
299 } | 299 } |
300 | 300 |
301 } // namespace cc | 301 } // namespace cc |
OLD | NEW |