| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "third_party/khronos/GLES2/gl2.h" | 35 #include "third_party/khronos/GLES2/gl2.h" |
| 36 #include "third_party/khronos/GLES2/gl2ext.h" | 36 #include "third_party/khronos/GLES2/gl2ext.h" |
| 37 #include "ui/gfx/geometry/rect.h" | 37 #include "ui/gfx/geometry/rect.h" |
| 38 #include "ui/gfx/gpu_memory_buffer.h" | 38 #include "ui/gfx/gpu_memory_buffer.h" |
| 39 | 39 |
| 40 using testing::Mock; | 40 using testing::Mock; |
| 41 using testing::NiceMock; | 41 using testing::NiceMock; |
| 42 using testing::Return; | 42 using testing::Return; |
| 43 using testing::StrictMock; | 43 using testing::StrictMock; |
| 44 using testing::_; | 44 using testing::_; |
| 45 using testing::AnyNumber; | |
| 46 | 45 |
| 47 namespace cc { | 46 namespace cc { |
| 48 namespace { | 47 namespace { |
| 49 | 48 |
| 50 static const bool kUseGpuMemoryBufferResources = false; | 49 static const bool kUseGpuMemoryBufferResources = false; |
| 51 static const bool kEnableColorCorrectRendering = false; | 50 static const bool kEnableColorCorrectRendering = false; |
| 52 static const bool kDelegatedSyncPointsRequired = true; | 51 static const bool kDelegatedSyncPointsRequired = true; |
| 53 | 52 |
| 54 MATCHER_P(MatchesSyncToken, sync_token, "") { | 53 MATCHER_P(MatchesSyncToken, sync_token, "") { |
| 55 gpu::SyncToken other; | 54 gpu::SyncToken other; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 : shared_data_(ContextSharedData::Create()), | 435 : shared_data_(ContextSharedData::Create()), |
| 437 context3d_(NULL), | 436 context3d_(NULL), |
| 438 child_context_(NULL), | 437 child_context_(NULL), |
| 439 main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) { | 438 main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) { |
| 440 switch (GetParam()) { | 439 switch (GetParam()) { |
| 441 case ResourceProvider::RESOURCE_TYPE_GPU_MEMORY_BUFFER: | 440 case ResourceProvider::RESOURCE_TYPE_GPU_MEMORY_BUFFER: |
| 442 case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: { | 441 case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: { |
| 443 std::unique_ptr<ResourceProviderContext> context3d( | 442 std::unique_ptr<ResourceProviderContext> context3d( |
| 444 ResourceProviderContext::Create(shared_data_.get())); | 443 ResourceProviderContext::Create(shared_data_.get())); |
| 445 context3d_ = context3d.get(); | 444 context3d_ = context3d.get(); |
| 446 context3d_->set_support_texture_buffer_chromium(true); | |
| 447 context_provider_ = TestContextProvider::Create(std::move(context3d)); | 445 context_provider_ = TestContextProvider::Create(std::move(context3d)); |
| 448 context_provider_->BindToCurrentThread(); | 446 context_provider_->BindToCurrentThread(); |
| 449 | 447 |
| 450 std::unique_ptr<ResourceProviderContext> child_context_owned = | 448 std::unique_ptr<ResourceProviderContext> child_context_owned = |
| 451 ResourceProviderContext::Create(shared_data_.get()); | 449 ResourceProviderContext::Create(shared_data_.get()); |
| 452 child_context_ = child_context_owned.get(); | 450 child_context_ = child_context_owned.get(); |
| 453 child_context_provider_ = | 451 child_context_provider_ = |
| 454 TestContextProvider::Create(std::move(child_context_owned)); | 452 TestContextProvider::Create(std::move(child_context_owned)); |
| 455 child_context_provider_->BindToCurrentThread(); | 453 child_context_provider_->BindToCurrentThread(); |
| 456 break; | 454 break; |
| (...skipping 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3080 GLsizei height, | 3078 GLsizei height, |
| 3081 GLint border, | 3079 GLint border, |
| 3082 GLsizei image_size, | 3080 GLsizei image_size, |
| 3083 const void* data)); | 3081 const void* data)); |
| 3084 MOCK_METHOD1(waitAsyncTexImage2DCHROMIUM, void(GLenum)); | 3082 MOCK_METHOD1(waitAsyncTexImage2DCHROMIUM, void(GLenum)); |
| 3085 MOCK_METHOD4(createImageCHROMIUM, | 3083 MOCK_METHOD4(createImageCHROMIUM, |
| 3086 GLuint(ClientBuffer, GLsizei, GLsizei, GLenum)); | 3084 GLuint(ClientBuffer, GLsizei, GLsizei, GLenum)); |
| 3087 MOCK_METHOD1(destroyImageCHROMIUM, void(GLuint)); | 3085 MOCK_METHOD1(destroyImageCHROMIUM, void(GLuint)); |
| 3088 MOCK_METHOD2(bindTexImage2DCHROMIUM, void(GLenum, GLint)); | 3086 MOCK_METHOD2(bindTexImage2DCHROMIUM, void(GLenum, GLint)); |
| 3089 MOCK_METHOD2(releaseTexImage2DCHROMIUM, void(GLenum, GLint)); | 3087 MOCK_METHOD2(releaseTexImage2DCHROMIUM, void(GLenum, GLint)); |
| 3090 MOCK_METHOD3(texParameteri, void(GLenum target, GLenum pname, GLint param)); | 3088 |
| 3089 // We're mocking bindTexture, so we override |
| 3090 // TestWebGraphicsContext3D::texParameteri to avoid assertions related to the |
| 3091 // currently bound texture. |
| 3092 virtual void texParameteri(GLenum target, GLenum pname, GLint param) {} |
| 3091 }; | 3093 }; |
| 3092 | 3094 |
| 3093 TEST_P(ResourceProviderTest, TextureAllocation) { | 3095 TEST_P(ResourceProviderTest, TextureAllocation) { |
| 3094 // Only for GL textures. | 3096 // Only for GL textures. |
| 3095 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 3097 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) |
| 3096 return; | 3098 return; |
| 3097 std::unique_ptr<AllocationTrackingContext3D> context_owned( | 3099 std::unique_ptr<AllocationTrackingContext3D> context_owned( |
| 3098 new StrictMock<AllocationTrackingContext3D>); | 3100 new StrictMock<AllocationTrackingContext3D>); |
| 3099 AllocationTrackingContext3D* context = context_owned.get(); | 3101 AllocationTrackingContext3D* context = context_owned.get(); |
| 3100 auto context_provider = TestContextProvider::Create(std::move(context_owned)); | 3102 auto context_provider = TestContextProvider::Create(std::move(context_owned)); |
| 3101 context_provider->BindToCurrentThread(); | 3103 context_provider->BindToCurrentThread(); |
| 3102 | 3104 |
| 3103 std::unique_ptr<ResourceProvider> resource_provider( | 3105 std::unique_ptr<ResourceProvider> resource_provider( |
| 3104 base::MakeUnique<ResourceProvider>( | 3106 base::MakeUnique<ResourceProvider>( |
| 3105 context_provider.get(), shared_bitmap_manager_.get(), | 3107 context_provider.get(), shared_bitmap_manager_.get(), |
| 3106 gpu_memory_buffer_manager_.get(), nullptr, | 3108 gpu_memory_buffer_manager_.get(), nullptr, |
| 3107 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, | 3109 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, |
| 3108 CreateResourceSettings())); | 3110 CreateResourceSettings())); |
| 3109 | 3111 |
| 3110 gfx::Size size(2, 2); | 3112 gfx::Size size(2, 2); |
| 3111 gfx::Vector2d offset(0, 0); | 3113 gfx::Vector2d offset(0, 0); |
| 3112 viz::ResourceFormat format = viz::RGBA_8888; | 3114 viz::ResourceFormat format = viz::RGBA_8888; |
| 3113 viz::ResourceId id = 0; | 3115 viz::ResourceId id = 0; |
| 3114 uint8_t pixels[16] = { 0 }; | 3116 uint8_t pixels[16] = { 0 }; |
| 3115 int texture_id = 123; | 3117 int texture_id = 123; |
| 3116 | 3118 |
| 3117 EXPECT_CALL(*context, texParameteri(_, _, _)).Times(AnyNumber()); | |
| 3118 // Lazy allocation. Don't allocate when creating the resource. | 3119 // Lazy allocation. Don't allocate when creating the resource. |
| 3119 id = resource_provider->CreateResource( | 3120 id = resource_provider->CreateResource( |
| 3120 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 3121 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 3121 gfx::ColorSpace()); | 3122 gfx::ColorSpace()); |
| 3122 | 3123 |
| 3123 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3124 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3124 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(1); | 3125 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(1); |
| 3125 resource_provider->CreateForTesting(id); | 3126 resource_provider->CreateForTesting(id); |
| 3126 | 3127 |
| 3127 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3128 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
| 3128 resource_provider->DeleteResource(id); | 3129 resource_provider->DeleteResource(id); |
| 3129 | 3130 |
| 3130 Mock::VerifyAndClearExpectations(context); | 3131 Mock::VerifyAndClearExpectations(context); |
| 3131 EXPECT_CALL(*context, texParameteri(_, _, _)).Times(AnyNumber()); | |
| 3132 | 3132 |
| 3133 // Do allocate when we set the pixels. | 3133 // Do allocate when we set the pixels. |
| 3134 id = resource_provider->CreateResource( | 3134 id = resource_provider->CreateResource( |
| 3135 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 3135 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 3136 gfx::ColorSpace()); | 3136 gfx::ColorSpace()); |
| 3137 | 3137 |
| 3138 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3138 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3139 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); | 3139 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); |
| 3140 EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _)).Times(1); | 3140 EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _)).Times(1); |
| 3141 EXPECT_CALL(*context, texSubImage2D(_, _, _, _, 2, 2, _, _, _)).Times(1); | 3141 EXPECT_CALL(*context, texSubImage2D(_, _, _, _, 2, 2, _, _, _)).Times(1); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3185 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3185 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3186 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3186 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
| 3187 bool is_immutable_hint = | 3187 bool is_immutable_hint = |
| 3188 hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE; | 3188 hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE; |
| 3189 bool support_immutable_texture = | 3189 bool support_immutable_texture = |
| 3190 is_immutable_hint && formats[i] != viz::BGRA_8888; | 3190 is_immutable_hint && formats[i] != viz::BGRA_8888; |
| 3191 EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2)) | 3191 EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2)) |
| 3192 .Times(support_immutable_texture ? 1 : 0); | 3192 .Times(support_immutable_texture ? 1 : 0); |
| 3193 EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _)) | 3193 EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _)) |
| 3194 .Times(support_immutable_texture ? 0 : 1); | 3194 .Times(support_immutable_texture ? 0 : 1); |
| 3195 EXPECT_CALL(*context, texParameteri(_, _, _)).Times(AnyNumber()); | |
| 3196 resource_provider->AllocateForTesting(id); | 3195 resource_provider->AllocateForTesting(id); |
| 3197 | 3196 |
| 3198 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3197 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
| 3199 resource_provider->DeleteResource(id); | 3198 resource_provider->DeleteResource(id); |
| 3200 | 3199 |
| 3201 Mock::VerifyAndClearExpectations(context); | 3200 Mock::VerifyAndClearExpectations(context); |
| 3202 } | 3201 } |
| 3203 } | 3202 } |
| 3204 } | 3203 } |
| 3205 | 3204 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3239 size, hints[texture_id - 1], formats[i], gfx::ColorSpace()); | 3238 size, hints[texture_id - 1], formats[i], gfx::ColorSpace()); |
| 3240 | 3239 |
| 3241 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3240 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3242 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3241 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
| 3243 bool is_immutable_hint = | 3242 bool is_immutable_hint = |
| 3244 hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE; | 3243 hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE; |
| 3245 EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2)) | 3244 EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2)) |
| 3246 .Times(is_immutable_hint ? 1 : 0); | 3245 .Times(is_immutable_hint ? 1 : 0); |
| 3247 EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _)) | 3246 EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _)) |
| 3248 .Times(is_immutable_hint ? 0 : 1); | 3247 .Times(is_immutable_hint ? 0 : 1); |
| 3249 EXPECT_CALL(*context, texParameteri(_, _, _)).Times(AnyNumber()); | |
| 3250 resource_provider->AllocateForTesting(id); | |
| 3251 | |
| 3252 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | |
| 3253 resource_provider->DeleteResource(id); | |
| 3254 | |
| 3255 Mock::VerifyAndClearExpectations(context); | |
| 3256 } | |
| 3257 } | |
| 3258 } | |
| 3259 | |
| 3260 TEST_P(ResourceProviderTest, ImageTextureAllocationHint_BGRA) { | |
| 3261 // Only for GL textures. | |
| 3262 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GPU_MEMORY_BUFFER) | |
| 3263 return; | |
| 3264 std::unique_ptr<AllocationTrackingContext3D> context_owned( | |
| 3265 new StrictMock<AllocationTrackingContext3D>); | |
| 3266 AllocationTrackingContext3D* context = context_owned.get(); | |
| 3267 context->set_support_texture_format_bgra8888(true); | |
| 3268 context->set_support_texture_storage(true); | |
| 3269 context->set_support_texture_usage(true); | |
| 3270 auto context_provider = TestContextProvider::Create(std::move(context_owned)); | |
| 3271 context_provider->BindToCurrentThread(); | |
| 3272 | |
| 3273 std::unique_ptr<ResourceProvider> resource_provider( | |
| 3274 base::MakeUnique<ResourceProvider>( | |
| 3275 context_provider.get(), shared_bitmap_manager_.get(), | |
| 3276 gpu_memory_buffer_manager_.get(), nullptr, | |
| 3277 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, | |
| 3278 CreateResourceSettings())); | |
| 3279 | |
| 3280 gfx::Size size(2, 2); | |
| 3281 const viz::ResourceFormat formats[2] = {viz::RGBA_8888, viz::BGRA_8888}; | |
| 3282 | |
| 3283 const ResourceProvider::TextureHint hints[4] = { | |
| 3284 ResourceProvider::TEXTURE_HINT_DEFAULT, | |
| 3285 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | |
| 3286 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | |
| 3287 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | |
| 3288 }; | |
| 3289 for (size_t i = 0; i < arraysize(formats); ++i) { | |
| 3290 for (GLuint texture_id = 1; texture_id <= arraysize(hints); ++texture_id) { | |
| 3291 // Lazy allocation. Don't allocate when creating the resource. | |
| 3292 viz::ResourceId id = resource_provider->CreateResource( | |
| 3293 size, hints[texture_id - 1], formats[i], gfx::ColorSpace()); | |
| 3294 | |
| 3295 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | |
| 3296 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | |
| 3297 bool is_immutable_hint = | |
| 3298 hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE; | |
| 3299 EXPECT_CALL(*context, texParameteri(_, GL_TEXTURE_BUFFER_USAGE_CHROMIUM, | |
| 3300 GL_TEXTURE_BUFFER_SCANOUT_CHROMIUM)); | |
| 3301 EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2)) | |
| 3302 .Times(is_immutable_hint ? 1 : 0); | |
| 3303 EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _)) | |
| 3304 .Times(is_immutable_hint ? 0 : 1); | |
| 3305 resource_provider->AllocateForTesting(id); | 3248 resource_provider->AllocateForTesting(id); |
| 3306 | 3249 |
| 3307 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3250 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
| 3308 resource_provider->DeleteResource(id); | 3251 resource_provider->DeleteResource(id); |
| 3309 | 3252 |
| 3310 Mock::VerifyAndClearExpectations(context); | 3253 Mock::VerifyAndClearExpectations(context); |
| 3311 } | 3254 } |
| 3312 } | 3255 } |
| 3313 } | 3256 } |
| 3314 | 3257 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3330 const unsigned kTextureId = 123u; | 3273 const unsigned kTextureId = 123u; |
| 3331 const unsigned kImageId = 234u; | 3274 const unsigned kImageId = 234u; |
| 3332 | 3275 |
| 3333 std::unique_ptr<ResourceProvider> resource_provider( | 3276 std::unique_ptr<ResourceProvider> resource_provider( |
| 3334 base::MakeUnique<ResourceProvider>( | 3277 base::MakeUnique<ResourceProvider>( |
| 3335 context_provider.get(), shared_bitmap_manager_.get(), | 3278 context_provider.get(), shared_bitmap_manager_.get(), |
| 3336 gpu_memory_buffer_manager_.get(), nullptr, | 3279 gpu_memory_buffer_manager_.get(), nullptr, |
| 3337 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, | 3280 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, |
| 3338 CreateResourceSettings())); | 3281 CreateResourceSettings())); |
| 3339 | 3282 |
| 3340 EXPECT_CALL(*context, texParameteri(_, _, _)).Times(AnyNumber()); | |
| 3341 id = resource_provider->CreateResource( | 3283 id = resource_provider->CreateResource( |
| 3342 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 3284 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 3343 gfx::ColorSpace()); | 3285 gfx::ColorSpace()); |
| 3344 | 3286 |
| 3345 EXPECT_CALL(*context, NextTextureId()) | 3287 EXPECT_CALL(*context, NextTextureId()) |
| 3346 .WillOnce(Return(kTextureId)) | 3288 .WillOnce(Return(kTextureId)) |
| 3347 .RetiresOnSaturation(); | 3289 .RetiresOnSaturation(); |
| 3348 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) | 3290 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) |
| 3349 .Times(3) | 3291 .Times(3) |
| 3350 .RetiresOnSaturation(); | 3292 .RetiresOnSaturation(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3416 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, | 3358 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, |
| 3417 CreateResourceSettings())); | 3359 CreateResourceSettings())); |
| 3418 int texture_id = 123; | 3360 int texture_id = 123; |
| 3419 | 3361 |
| 3420 viz::ResourceId id = resource_provider->CreateResource( | 3362 viz::ResourceId id = resource_provider->CreateResource( |
| 3421 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, viz::ETC1, | 3363 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, viz::ETC1, |
| 3422 gfx::ColorSpace()); | 3364 gfx::ColorSpace()); |
| 3423 EXPECT_NE(0u, id); | 3365 EXPECT_NE(0u, id); |
| 3424 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3366 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3425 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3367 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
| 3426 EXPECT_CALL(*context, texParameteri(_, _, _)).Times(AnyNumber()); | |
| 3427 resource_provider->AllocateForTesting(id); | 3368 resource_provider->AllocateForTesting(id); |
| 3428 | 3369 |
| 3429 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3370 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
| 3430 resource_provider->DeleteResource(id); | 3371 resource_provider->DeleteResource(id); |
| 3431 } | 3372 } |
| 3432 | 3373 |
| 3433 TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) { | 3374 TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) { |
| 3434 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 3375 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) |
| 3435 return; | 3376 return; |
| 3436 | 3377 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3558 lock.set_sync_token(token); | 3499 lock.set_sync_token(token); |
| 3559 } | 3500 } |
| 3560 | 3501 |
| 3561 gpu::SyncToken last_token = | 3502 gpu::SyncToken last_token = |
| 3562 resource_provider_->GetSyncTokenForResources(array); | 3503 resource_provider_->GetSyncTokenForResources(array); |
| 3563 EXPECT_EQ(last_token.release_count(), 10u); | 3504 EXPECT_EQ(last_token.release_count(), 10u); |
| 3564 } | 3505 } |
| 3565 | 3506 |
| 3566 } // namespace | 3507 } // namespace |
| 3567 } // namespace cc | 3508 } // namespace cc |
| OLD | NEW |