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

Side by Side Diff: cc/test/render_pass_test_common.cc

Issue 11622008: cc: Defer texture allocation (to allow async allocations). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase. Rebase test fixes. Created 7 years, 11 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
« no previous file with comments | « cc/resource_update_controller.cc ('k') | cc/texture_layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_common.h" 5 #include "cc/test/render_pass_test_common.h"
6 6
7 #include "cc/checkerboard_draw_quad.h" 7 #include "cc/checkerboard_draw_quad.h"
8 #include "cc/debug_border_draw_quad.h" 8 #include "cc/debug_border_draw_quad.h"
9 #include "cc/io_surface_draw_quad.h" 9 #include "cc/io_surface_draw_quad.h"
10 #include "cc/render_pass_draw_quad.h" 10 #include "cc/render_pass_draw_quad.h"
(...skipping 11 matching lines...) Expand all
22 void TestRenderPass::AppendOneOfEveryQuadType( 22 void TestRenderPass::AppendOneOfEveryQuadType(
23 cc::ResourceProvider* resourceProvider) { 23 cc::ResourceProvider* resourceProvider) {
24 gfx::Rect rect(0, 0, 100, 100); 24 gfx::Rect rect(0, 0, 100, 100);
25 gfx::Rect opaque_rect(10, 10, 80, 80); 25 gfx::Rect opaque_rect(10, 10, 80, 80);
26 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; 26 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f};
27 cc::ResourceProvider::ResourceId texture_resource = 27 cc::ResourceProvider::ResourceId texture_resource =
28 resourceProvider->createResource( 28 resourceProvider->createResource(
29 gfx::Size(20, 12), 29 gfx::Size(20, 12),
30 resourceProvider->bestTextureFormat(), 30 resourceProvider->bestTextureFormat(),
31 ResourceProvider::TextureUsageAny); 31 ResourceProvider::TextureUsageAny);
32 resourceProvider->allocateForTesting(texture_resource);
32 unsigned texture_id = ResourceProvider::ScopedReadLockGL( 33 unsigned texture_id = ResourceProvider::ScopedReadLockGL(
33 resourceProvider, texture_resource).textureId(); 34 resourceProvider, texture_resource).textureId();
34 35
35 scoped_ptr<cc::SharedQuadState> shared_state = cc::SharedQuadState::Create(); 36 scoped_ptr<cc::SharedQuadState> shared_state = cc::SharedQuadState::Create();
36 shared_state->SetAll(gfx::Transform(), 37 shared_state->SetAll(gfx::Transform(),
37 rect, 38 rect,
38 rect, 39 rect,
39 rect, 40 rect,
40 false, 41 false,
41 1); 42 1);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 false); 157 false);
157 AppendQuad(tile_quad.PassAs<DrawQuad>()); 158 AppendQuad(tile_quad.PassAs<DrawQuad>());
158 159
159 cc::VideoLayerImpl::FramePlane planes[3]; 160 cc::VideoLayerImpl::FramePlane planes[3];
160 for (int i = 0; i < 3; ++i) { 161 for (int i = 0; i < 3; ++i) {
161 planes[i].resourceId = 162 planes[i].resourceId =
162 resourceProvider->createResource( 163 resourceProvider->createResource(
163 gfx::Size(20, 12), 164 gfx::Size(20, 12),
164 resourceProvider->bestTextureFormat(), 165 resourceProvider->bestTextureFormat(),
165 ResourceProvider::TextureUsageAny); 166 ResourceProvider::TextureUsageAny);
167 resourceProvider->allocateForTesting(planes[i].resourceId);
166 planes[i].size = gfx::Size(100, 100); 168 planes[i].size = gfx::Size(100, 100);
167 planes[i].format = GL_LUMINANCE; 169 planes[i].format = GL_LUMINANCE;
168 } 170 }
169 scoped_ptr<cc::YUVVideoDrawQuad> yuv_quad = 171 scoped_ptr<cc::YUVVideoDrawQuad> yuv_quad =
170 cc::YUVVideoDrawQuad::Create(); 172 cc::YUVVideoDrawQuad::Create();
171 yuv_quad->SetNew(shared_state.get(), 173 yuv_quad->SetNew(shared_state.get(),
172 rect, 174 rect,
173 opaque_rect, 175 opaque_rect,
174 gfx::Size(100, 100), 176 gfx::Size(100, 100),
175 planes[0], 177 planes[0],
176 planes[1], 178 planes[1],
177 planes[2]); 179 planes[2]);
178 AppendQuad(yuv_quad.PassAs<DrawQuad>()); 180 AppendQuad(yuv_quad.PassAs<DrawQuad>());
179 181
180 AppendSharedQuadState(transformed_state.Pass()); 182 AppendSharedQuadState(transformed_state.Pass());
181 AppendSharedQuadState(shared_state.Pass()); 183 AppendSharedQuadState(shared_state.Pass());
182 } 184 }
183 185
184 } // namespace cc 186 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resource_update_controller.cc ('k') | cc/texture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698