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

Side by Side Diff: cc/resources/resource_provider_unittest.cc

Issue 83883002: cc: Allow TEXTURE_RECTANGLE_ARB to be used for tile textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review feedback Created 7 years, 1 month 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
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/tile_manager.h » ('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/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2125 2125
2126 scoped_ptr<ResourceProvider> resource_provider( 2126 scoped_ptr<ResourceProvider> resource_provider(
2127 ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1)); 2127 ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
2128 2128
2129 gfx::Size size(1, 1); 2129 gfx::Size size(1, 1);
2130 ResourceFormat format = RGBA_8888; 2130 ResourceFormat format = RGBA_8888;
2131 int texture_id = 1; 2131 int texture_id = 1;
2132 2132
2133 // Check that the texture gets created with the right sampler settings. 2133 // Check that the texture gets created with the right sampler settings.
2134 ResourceProvider::ResourceId id = resource_provider->CreateManagedResource( 2134 ResourceProvider::ResourceId id = resource_provider->CreateManagedResource(
2135 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format); 2135 size,
2136 GL_TEXTURE_2D,
2137 GL_CLAMP_TO_EDGE,
2138 ResourceProvider::TextureUsageAny,
2139 format);
2136 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); 2140 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id));
2137 EXPECT_CALL(*context, 2141 EXPECT_CALL(*context,
2138 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); 2142 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
2139 EXPECT_CALL(*context, 2143 EXPECT_CALL(*context,
2140 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); 2144 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
2141 EXPECT_CALL( 2145 EXPECT_CALL(
2142 *context, 2146 *context,
2143 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); 2147 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
2144 EXPECT_CALL( 2148 EXPECT_CALL(
2145 *context, 2149 *context,
(...skipping 27 matching lines...) Expand all
2173 2177
2174 gfx::Size size(1, 1); 2178 gfx::Size size(1, 1);
2175 ResourceFormat format = RGBA_8888; 2179 ResourceFormat format = RGBA_8888;
2176 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; 2180 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM;
2177 2181
2178 for (int texture_id = 1; texture_id <= 2; ++texture_id) { 2182 for (int texture_id = 1; texture_id <= 2; ++texture_id) {
2179 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; 2183 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT;
2180 // Check that the texture gets created with the right sampler settings. 2184 // Check that the texture gets created with the right sampler settings.
2181 ResourceProvider::ResourceId id = 2185 ResourceProvider::ResourceId id =
2182 resource_provider->CreateGLTexture(size, 2186 resource_provider->CreateGLTexture(size,
2187 GL_TEXTURE_2D,
2183 texture_pool, 2188 texture_pool,
2184 wrap_mode, 2189 wrap_mode,
2185 ResourceProvider::TextureUsageAny, 2190 ResourceProvider::TextureUsageAny,
2186 format); 2191 format);
2187 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); 2192 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id));
2188 EXPECT_CALL(*context, 2193 EXPECT_CALL(*context,
2189 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); 2194 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
2190 EXPECT_CALL(*context, 2195 EXPECT_CALL(*context,
2191 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); 2196 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
2192 EXPECT_CALL( 2197 EXPECT_CALL(
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
3075 resource_provider->AllocateForTesting(id); 3080 resource_provider->AllocateForTesting(id);
3076 Mock::VerifyAndClearExpectations(context); 3081 Mock::VerifyAndClearExpectations(context);
3077 3082
3078 DCHECK_EQ(10u, context->PeekTextureId()); 3083 DCHECK_EQ(10u, context->PeekTextureId());
3079 resource_provider->DeleteResource(id); 3084 resource_provider->DeleteResource(id);
3080 } 3085 }
3081 } 3086 }
3082 3087
3083 } // namespace 3088 } // namespace
3084 } // namespace cc 3089 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/tile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698