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/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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |