| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gpu/command_buffer/common/sync_token.h" | 5 #include "gpu/command_buffer/common/sync_token.h" |
| 6 #include "gpu/command_buffer/service/feature_info.h" | 6 #include "gpu/command_buffer/service/feature_info.h" |
| 7 #include "gpu/command_buffer/service/gpu_service_test.h" | 7 #include "gpu/command_buffer/service/gpu_service_test.h" |
| 8 #include "gpu/command_buffer/service/mailbox_manager_impl.h" | 8 #include "gpu/command_buffer/service/mailbox_manager_impl.h" |
| 9 #include "gpu/command_buffer/service/mailbox_manager_sync.h" | 9 #include "gpu/command_buffer/service/mailbox_manager_sync.h" |
| 10 #include "gpu/command_buffer/service/texture_manager.h" | 10 #include "gpu/command_buffer/service/texture_manager.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT); | 331 kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT); |
| 332 Texture* new_texture = manager2_->ConsumeTexture(name); | 332 Texture* new_texture = manager2_->ConsumeTexture(name); |
| 333 EXPECT_FALSE(new_texture == NULL); | 333 EXPECT_FALSE(new_texture == NULL); |
| 334 EXPECT_NE(texture, new_texture); | 334 EXPECT_NE(texture, new_texture); |
| 335 EXPECT_EQ(kNewTextureId, new_texture->service_id()); | 335 EXPECT_EQ(kNewTextureId, new_texture->service_id()); |
| 336 | 336 |
| 337 // Resize original texture | 337 // Resize original texture |
| 338 SetLevelInfo(texture, GL_TEXTURE_2D, 0, GL_RGBA, 16, 32, 1, 0, GL_RGBA, | 338 SetLevelInfo(texture, GL_TEXTURE_2D, 0, GL_RGBA, 16, 32, 1, 0, GL_RGBA, |
| 339 GL_UNSIGNED_BYTE, gfx::Rect(16, 32)); | 339 GL_UNSIGNED_BYTE, gfx::Rect(16, 32)); |
| 340 // Should have been orphaned | 340 // Should have been orphaned |
| 341 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 341 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, nullptr) == nullptr); |
| 342 | 342 |
| 343 // Synchronize again | 343 // Synchronize again |
| 344 manager_->PushTextureUpdates(g_sync_token); | 344 manager_->PushTextureUpdates(g_sync_token); |
| 345 SetupUpdateTexParamExpectations( | 345 SetupUpdateTexParamExpectations( |
| 346 kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT); | 346 kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT); |
| 347 manager2_->PullTextureUpdates(g_sync_token); | 347 manager2_->PullTextureUpdates(g_sync_token); |
| 348 GLsizei width, height; | 348 GLsizei width, height; |
| 349 new_texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr); | 349 new_texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr); |
| 350 EXPECT_EQ(16, width); | 350 EXPECT_EQ(16, width); |
| 351 EXPECT_EQ(32, height); | 351 EXPECT_EQ(32, height); |
| 352 | 352 |
| 353 // Should have gotten a new attachment | 353 // Should have gotten a new attachment |
| 354 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) != NULL); | 354 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, nullptr) != nullptr); |
| 355 // Resize original texture again.... | 355 // Resize original texture again.... |
| 356 SetLevelInfo(texture, GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 1, 0, GL_RGBA, | 356 SetLevelInfo(texture, GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 1, 0, GL_RGBA, |
| 357 GL_UNSIGNED_BYTE, gfx::Rect(64, 64)); | 357 GL_UNSIGNED_BYTE, gfx::Rect(64, 64)); |
| 358 // ...and immediately delete the texture which should save the changes. | 358 // ...and immediately delete the texture which should save the changes. |
| 359 SetupUpdateTexParamExpectations( | 359 SetupUpdateTexParamExpectations( |
| 360 kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT); | 360 kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT); |
| 361 DestroyTexture(texture); | 361 DestroyTexture(texture); |
| 362 | 362 |
| 363 // Should be still around since there is a ref from manager2 | 363 // Should be still around since there is a ref from manager2 |
| 364 EXPECT_EQ(new_texture, manager2_->ConsumeTexture(name)); | 364 EXPECT_EQ(new_texture, manager2_->ConsumeTexture(name)); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 DestroyTexture(texture2); | 686 DestroyTexture(texture2); |
| 687 DestroyTexture(new_texture); | 687 DestroyTexture(new_texture); |
| 688 } | 688 } |
| 689 | 689 |
| 690 // TODO: Texture::level_infos_[][].size() | 690 // TODO: Texture::level_infos_[][].size() |
| 691 | 691 |
| 692 // TODO: unsupported targets and formats | 692 // TODO: unsupported targets and formats |
| 693 | 693 |
| 694 } // namespace gles2 | 694 } // namespace gles2 |
| 695 } // namespace gpu | 695 } // namespace gpu |
| OLD | NEW |