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

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

Issue 2674493003: Add compositor support for half-float RGBA buffers and textures (Closed)
Patch Set: Don't enable on non-ES3 yet Created 3 years, 10 months 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
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | gpu/command_buffer/common/capabilities.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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 3455 matching lines...) Expand 10 before | Expand all | Expand 10 after
3466 std::unique_ptr<ResourceProvider> resource_provider( 3466 std::unique_ptr<ResourceProvider> resource_provider(
3467 base::MakeUnique<ResourceProvider>( 3467 base::MakeUnique<ResourceProvider>(
3468 context_provider.get(), shared_bitmap_manager_.get(), 3468 context_provider.get(), shared_bitmap_manager_.get(),
3469 gpu_memory_buffer_manager_.get(), nullptr, 1, 3469 gpu_memory_buffer_manager_.get(), nullptr, 1,
3470 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, 3470 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources,
3471 kEnableColorCorrectRendering, 3471 kEnableColorCorrectRendering,
3472 DefaultBufferToTextureTargetMapForTesting())); 3472 DefaultBufferToTextureTargetMapForTesting()));
3473 3473
3474 gfx::Size size(2, 2); 3474 gfx::Size size(2, 2);
3475 3475
3476 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; 3476 const ResourceFormat formats[3] = {RGBA_8888, BGRA_8888, RGBA_F16};
3477 const ResourceProvider::TextureHint hints[4] = { 3477 const ResourceProvider::TextureHint hints[4] = {
3478 ResourceProvider::TEXTURE_HINT_DEFAULT, 3478 ResourceProvider::TEXTURE_HINT_DEFAULT,
3479 ResourceProvider::TEXTURE_HINT_IMMUTABLE, 3479 ResourceProvider::TEXTURE_HINT_IMMUTABLE,
3480 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, 3480 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER,
3481 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, 3481 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
3482 }; 3482 };
3483 for (size_t i = 0; i < arraysize(formats); ++i) { 3483 for (size_t i = 0; i < arraysize(formats); ++i) {
3484 for (GLuint texture_id = 1; texture_id <= arraysize(hints); ++texture_id) { 3484 for (GLuint texture_id = 1; texture_id <= arraysize(hints); ++texture_id) {
3485 // Lazy allocation. Don't allocate when creating the resource. 3485 // Lazy allocation. Don't allocate when creating the resource.
3486 ResourceId id = resource_provider->CreateResource( 3486 ResourceId id = resource_provider->CreateResource(
3487 size, hints[texture_id - 1], formats[i], gfx::ColorSpace()); 3487 size, hints[texture_id - 1], formats[i], gfx::ColorSpace());
3488 3488
3489 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); 3489 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
3490 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); 3490 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
3491 bool is_immutable_hint = 3491 bool is_immutable_hint =
3492 hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE; 3492 hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE;
3493 bool support_immutable_texture = 3493 bool support_immutable_texture =
3494 is_immutable_hint && formats[i] == RGBA_8888; 3494 is_immutable_hint && formats[i] != BGRA_8888;
3495 EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2)) 3495 EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2))
3496 .Times(support_immutable_texture ? 1 : 0); 3496 .Times(support_immutable_texture ? 1 : 0);
3497 EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _)) 3497 EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _))
3498 .Times(support_immutable_texture ? 0 : 1); 3498 .Times(support_immutable_texture ? 0 : 1);
3499 resource_provider->AllocateForTesting(id); 3499 resource_provider->AllocateForTesting(id);
3500 3500
3501 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); 3501 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1);
3502 resource_provider->DeleteResource(id); 3502 resource_provider->DeleteResource(id);
3503 3503
3504 Mock::VerifyAndClearExpectations(context); 3504 Mock::VerifyAndClearExpectations(context);
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
3807 lock.set_sync_token(token); 3807 lock.set_sync_token(token);
3808 } 3808 }
3809 3809
3810 gpu::SyncToken last_token = 3810 gpu::SyncToken last_token =
3811 resource_provider_->GetSyncTokenForResources(array); 3811 resource_provider_->GetSyncTokenForResources(array);
3812 EXPECT_EQ(last_token.release_count(), 10u); 3812 EXPECT_EQ(last_token.release_count(), 10u);
3813 } 3813 }
3814 3814
3815 } // namespace 3815 } // namespace
3816 } // namespace cc 3816 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | gpu/command_buffer/common/capabilities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698