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