| 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; |
| 45 | 46 |
| 46 namespace cc { | 47 namespace cc { |
| 47 namespace { | 48 namespace { |
| 48 | 49 |
| 49 static const bool kUseGpuMemoryBufferResources = false; | 50 static const bool kUseGpuMemoryBufferResources = false; |
| 50 static const bool kEnableColorCorrectRendering = false; | 51 static const bool kEnableColorCorrectRendering = false; |
| 51 static const bool kDelegatedSyncPointsRequired = true; | 52 static const bool kDelegatedSyncPointsRequired = true; |
| 52 | 53 |
| 53 MATCHER_P(MatchesSyncToken, sync_token, "") { | 54 MATCHER_P(MatchesSyncToken, sync_token, "") { |
| 54 gpu::SyncToken other; | 55 gpu::SyncToken other; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 : shared_data_(ContextSharedData::Create()), | 436 : shared_data_(ContextSharedData::Create()), |
| 436 context3d_(NULL), | 437 context3d_(NULL), |
| 437 child_context_(NULL), | 438 child_context_(NULL), |
| 438 main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) { | 439 main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) { |
| 439 switch (GetParam()) { | 440 switch (GetParam()) { |
| 440 case ResourceProvider::RESOURCE_TYPE_GPU_MEMORY_BUFFER: | 441 case ResourceProvider::RESOURCE_TYPE_GPU_MEMORY_BUFFER: |
| 441 case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: { | 442 case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: { |
| 442 std::unique_ptr<ResourceProviderContext> context3d( | 443 std::unique_ptr<ResourceProviderContext> context3d( |
| 443 ResourceProviderContext::Create(shared_data_.get())); | 444 ResourceProviderContext::Create(shared_data_.get())); |
| 444 context3d_ = context3d.get(); | 445 context3d_ = context3d.get(); |
| 446 context3d_->set_support_texture_buffer_chromium(true); |
| 445 context_provider_ = TestContextProvider::Create(std::move(context3d)); | 447 context_provider_ = TestContextProvider::Create(std::move(context3d)); |
| 446 context_provider_->BindToCurrentThread(); | 448 context_provider_->BindToCurrentThread(); |
| 447 | 449 |
| 448 std::unique_ptr<ResourceProviderContext> child_context_owned = | 450 std::unique_ptr<ResourceProviderContext> child_context_owned = |
| 449 ResourceProviderContext::Create(shared_data_.get()); | 451 ResourceProviderContext::Create(shared_data_.get()); |
| 450 child_context_ = child_context_owned.get(); | 452 child_context_ = child_context_owned.get(); |
| 451 child_context_provider_ = | 453 child_context_provider_ = |
| 452 TestContextProvider::Create(std::move(child_context_owned)); | 454 TestContextProvider::Create(std::move(child_context_owned)); |
| 453 child_context_provider_->BindToCurrentThread(); | 455 child_context_provider_->BindToCurrentThread(); |
| 454 break; | 456 break; |
| (...skipping 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3078 GLsizei height, | 3080 GLsizei height, |
| 3079 GLint border, | 3081 GLint border, |
| 3080 GLsizei image_size, | 3082 GLsizei image_size, |
| 3081 const void* data)); | 3083 const void* data)); |
| 3082 MOCK_METHOD1(waitAsyncTexImage2DCHROMIUM, void(GLenum)); | 3084 MOCK_METHOD1(waitAsyncTexImage2DCHROMIUM, void(GLenum)); |
| 3083 MOCK_METHOD4(createImageCHROMIUM, | 3085 MOCK_METHOD4(createImageCHROMIUM, |
| 3084 GLuint(ClientBuffer, GLsizei, GLsizei, GLenum)); | 3086 GLuint(ClientBuffer, GLsizei, GLsizei, GLenum)); |
| 3085 MOCK_METHOD1(destroyImageCHROMIUM, void(GLuint)); | 3087 MOCK_METHOD1(destroyImageCHROMIUM, void(GLuint)); |
| 3086 MOCK_METHOD2(bindTexImage2DCHROMIUM, void(GLenum, GLint)); | 3088 MOCK_METHOD2(bindTexImage2DCHROMIUM, void(GLenum, GLint)); |
| 3087 MOCK_METHOD2(releaseTexImage2DCHROMIUM, void(GLenum, GLint)); | 3089 MOCK_METHOD2(releaseTexImage2DCHROMIUM, void(GLenum, GLint)); |
| 3088 | 3090 MOCK_METHOD3(texParameteri, void(GLenum target, GLenum pname, GLint param)); |
| 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) {} | |
| 3093 }; | 3091 }; |
| 3094 | 3092 |
| 3095 TEST_P(ResourceProviderTest, TextureAllocation) { | 3093 TEST_P(ResourceProviderTest, TextureAllocation) { |
| 3096 // Only for GL textures. | 3094 // Only for GL textures. |
| 3097 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 3095 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) |
| 3098 return; | 3096 return; |
| 3099 std::unique_ptr<AllocationTrackingContext3D> context_owned( | 3097 std::unique_ptr<AllocationTrackingContext3D> context_owned( |
| 3100 new StrictMock<AllocationTrackingContext3D>); | 3098 new StrictMock<AllocationTrackingContext3D>); |
| 3101 AllocationTrackingContext3D* context = context_owned.get(); | 3099 AllocationTrackingContext3D* context = context_owned.get(); |
| 3102 auto context_provider = TestContextProvider::Create(std::move(context_owned)); | 3100 auto context_provider = TestContextProvider::Create(std::move(context_owned)); |
| 3103 context_provider->BindToCurrentThread(); | 3101 context_provider->BindToCurrentThread(); |
| 3104 | 3102 |
| 3105 std::unique_ptr<ResourceProvider> resource_provider( | 3103 std::unique_ptr<ResourceProvider> resource_provider( |
| 3106 base::MakeUnique<ResourceProvider>( | 3104 base::MakeUnique<ResourceProvider>( |
| 3107 context_provider.get(), shared_bitmap_manager_.get(), | 3105 context_provider.get(), shared_bitmap_manager_.get(), |
| 3108 gpu_memory_buffer_manager_.get(), nullptr, | 3106 gpu_memory_buffer_manager_.get(), nullptr, |
| 3109 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, | 3107 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, |
| 3110 CreateResourceSettings())); | 3108 CreateResourceSettings())); |
| 3111 | 3109 |
| 3112 gfx::Size size(2, 2); | 3110 gfx::Size size(2, 2); |
| 3113 gfx::Vector2d offset(0, 0); | 3111 gfx::Vector2d offset(0, 0); |
| 3114 viz::ResourceFormat format = viz::RGBA_8888; | 3112 viz::ResourceFormat format = viz::RGBA_8888; |
| 3115 viz::ResourceId id = 0; | 3113 viz::ResourceId id = 0; |
| 3116 uint8_t pixels[16] = { 0 }; | 3114 uint8_t pixels[16] = { 0 }; |
| 3117 int texture_id = 123; | 3115 int texture_id = 123; |
| 3118 | 3116 |
| 3117 EXPECT_CALL(*context, texParameteri(_, _, _)).Times(AnyNumber()); |
| 3119 // Lazy allocation. Don't allocate when creating the resource. | 3118 // Lazy allocation. Don't allocate when creating the resource. |
| 3120 id = resource_provider->CreateResource( | 3119 id = resource_provider->CreateResource( |
| 3121 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 3120 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 3122 gfx::ColorSpace()); | 3121 gfx::ColorSpace()); |
| 3123 | 3122 |
| 3124 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3123 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3125 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(1); | 3124 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(1); |
| 3126 resource_provider->CreateForTesting(id); | 3125 resource_provider->CreateForTesting(id); |
| 3127 | 3126 |
| 3128 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3127 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
| 3129 resource_provider->DeleteResource(id); | 3128 resource_provider->DeleteResource(id); |
| 3130 | 3129 |
| 3131 Mock::VerifyAndClearExpectations(context); | 3130 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()); |
| 3195 resource_provider->AllocateForTesting(id); | 3196 resource_provider->AllocateForTesting(id); |
| 3196 | 3197 |
| 3197 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3198 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
| 3198 resource_provider->DeleteResource(id); | 3199 resource_provider->DeleteResource(id); |
| 3199 | 3200 |
| 3200 Mock::VerifyAndClearExpectations(context); | 3201 Mock::VerifyAndClearExpectations(context); |
| 3201 } | 3202 } |
| 3202 } | 3203 } |
| 3203 } | 3204 } |
| 3204 | 3205 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3238 size, hints[texture_id - 1], formats[i], gfx::ColorSpace()); | 3239 size, hints[texture_id - 1], formats[i], gfx::ColorSpace()); |
| 3239 | 3240 |
| 3240 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3241 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3241 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3242 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
| 3242 bool is_immutable_hint = | 3243 bool is_immutable_hint = |
| 3243 hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE; | 3244 hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE; |
| 3244 EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2)) | 3245 EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2)) |
| 3245 .Times(is_immutable_hint ? 1 : 0); | 3246 .Times(is_immutable_hint ? 1 : 0); |
| 3246 EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _)) | 3247 EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _)) |
| 3247 .Times(is_immutable_hint ? 0 : 1); | 3248 .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); |
| 3248 resource_provider->AllocateForTesting(id); | 3305 resource_provider->AllocateForTesting(id); |
| 3249 | 3306 |
| 3250 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3307 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
| 3251 resource_provider->DeleteResource(id); | 3308 resource_provider->DeleteResource(id); |
| 3252 | 3309 |
| 3253 Mock::VerifyAndClearExpectations(context); | 3310 Mock::VerifyAndClearExpectations(context); |
| 3254 } | 3311 } |
| 3255 } | 3312 } |
| 3256 } | 3313 } |
| 3257 | 3314 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3273 const unsigned kTextureId = 123u; | 3330 const unsigned kTextureId = 123u; |
| 3274 const unsigned kImageId = 234u; | 3331 const unsigned kImageId = 234u; |
| 3275 | 3332 |
| 3276 std::unique_ptr<ResourceProvider> resource_provider( | 3333 std::unique_ptr<ResourceProvider> resource_provider( |
| 3277 base::MakeUnique<ResourceProvider>( | 3334 base::MakeUnique<ResourceProvider>( |
| 3278 context_provider.get(), shared_bitmap_manager_.get(), | 3335 context_provider.get(), shared_bitmap_manager_.get(), |
| 3279 gpu_memory_buffer_manager_.get(), nullptr, | 3336 gpu_memory_buffer_manager_.get(), nullptr, |
| 3280 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, | 3337 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, |
| 3281 CreateResourceSettings())); | 3338 CreateResourceSettings())); |
| 3282 | 3339 |
| 3340 EXPECT_CALL(*context, texParameteri(_, _, _)).Times(AnyNumber()); |
| 3283 id = resource_provider->CreateResource( | 3341 id = resource_provider->CreateResource( |
| 3284 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 3342 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 3285 gfx::ColorSpace()); | 3343 gfx::ColorSpace()); |
| 3286 | 3344 |
| 3287 EXPECT_CALL(*context, NextTextureId()) | 3345 EXPECT_CALL(*context, NextTextureId()) |
| 3288 .WillOnce(Return(kTextureId)) | 3346 .WillOnce(Return(kTextureId)) |
| 3289 .RetiresOnSaturation(); | 3347 .RetiresOnSaturation(); |
| 3290 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) | 3348 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) |
| 3291 .Times(3) | 3349 .Times(3) |
| 3292 .RetiresOnSaturation(); | 3350 .RetiresOnSaturation(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3358 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, | 3416 kDelegatedSyncPointsRequired, kEnableColorCorrectRendering, |
| 3359 CreateResourceSettings())); | 3417 CreateResourceSettings())); |
| 3360 int texture_id = 123; | 3418 int texture_id = 123; |
| 3361 | 3419 |
| 3362 viz::ResourceId id = resource_provider->CreateResource( | 3420 viz::ResourceId id = resource_provider->CreateResource( |
| 3363 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, viz::ETC1, | 3421 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, viz::ETC1, |
| 3364 gfx::ColorSpace()); | 3422 gfx::ColorSpace()); |
| 3365 EXPECT_NE(0u, id); | 3423 EXPECT_NE(0u, id); |
| 3366 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3424 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3367 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3425 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
| 3426 EXPECT_CALL(*context, texParameteri(_, _, _)).Times(AnyNumber()); |
| 3368 resource_provider->AllocateForTesting(id); | 3427 resource_provider->AllocateForTesting(id); |
| 3369 | 3428 |
| 3370 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3429 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
| 3371 resource_provider->DeleteResource(id); | 3430 resource_provider->DeleteResource(id); |
| 3372 } | 3431 } |
| 3373 | 3432 |
| 3374 TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) { | 3433 TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) { |
| 3375 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 3434 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) |
| 3376 return; | 3435 return; |
| 3377 | 3436 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3499 lock.set_sync_token(token); | 3558 lock.set_sync_token(token); |
| 3500 } | 3559 } |
| 3501 | 3560 |
| 3502 gpu::SyncToken last_token = | 3561 gpu::SyncToken last_token = |
| 3503 resource_provider_->GetSyncTokenForResources(array); | 3562 resource_provider_->GetSyncTokenForResources(array); |
| 3504 EXPECT_EQ(last_token.release_count(), 10u); | 3563 EXPECT_EQ(last_token.release_count(), 10u); |
| 3505 } | 3564 } |
| 3506 | 3565 |
| 3507 } // namespace | 3566 } // namespace |
| 3508 } // namespace cc | 3567 } // namespace cc |
| OLD | NEW |