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

Side by Side Diff: gpu/command_buffer/service/renderbuffer_manager_unittest.cc

Issue 12017032: Add calls to EnsureGPUMemoryAvailable into GLES2DecoderImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/service/renderbuffer_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "gpu/command_buffer/service/renderbuffer_manager.h" 5 #include "gpu/command_buffer/service/renderbuffer_manager.h"
6 6
7 #include <set> 7 #include <set>
8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
9 #include "gpu/command_buffer/service/mocks.h" 9 #include "gpu/command_buffer/service/mocks.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const GLsizei kWidth = 128; 141 const GLsizei kWidth = 128;
142 const GLsizei kHeight = 64; 142 const GLsizei kHeight = 64;
143 manager_->SetInfo(info1, kSamples, kFormat, kWidth, kHeight); 143 manager_->SetInfo(info1, kSamples, kFormat, kWidth, kHeight);
144 EXPECT_EQ(kSamples, info1->samples()); 144 EXPECT_EQ(kSamples, info1->samples());
145 EXPECT_EQ(kFormat, info1->internal_format()); 145 EXPECT_EQ(kFormat, info1->internal_format());
146 EXPECT_EQ(kWidth, info1->width()); 146 EXPECT_EQ(kWidth, info1->width());
147 EXPECT_EQ(kHeight, info1->height()); 147 EXPECT_EQ(kHeight, info1->height());
148 EXPECT_FALSE(info1->cleared()); 148 EXPECT_FALSE(info1->cleared());
149 EXPECT_FALSE(info1->IsDeleted()); 149 EXPECT_FALSE(info1->IsDeleted());
150 EXPECT_TRUE(manager_->HaveUnclearedRenderbuffers()); 150 EXPECT_TRUE(manager_->HaveUnclearedRenderbuffers());
151 EXPECT_EQ(kWidth * kHeight * 4u * 2u, info1->EstimatedSize()); 151 EXPECT_EQ(kWidth * kHeight * 4u * 4u, info1->EstimatedSize());
152 152
153 manager_->SetCleared(info1, true); 153 manager_->SetCleared(info1, true);
154 EXPECT_TRUE(info1->cleared()); 154 EXPECT_TRUE(info1->cleared());
155 EXPECT_FALSE(manager_->HaveUnclearedRenderbuffers()); 155 EXPECT_FALSE(manager_->HaveUnclearedRenderbuffers());
156 156
157 manager_->SetInfo(info1, kSamples, kFormat, kWidth, kHeight); 157 manager_->SetInfo(info1, kSamples, kFormat, kWidth, kHeight);
158 EXPECT_TRUE(manager_->HaveUnclearedRenderbuffers()); 158 EXPECT_TRUE(manager_->HaveUnclearedRenderbuffers());
159 159
160 // Check that the renderbuffer is deleted when the last ref is released. 160 // Check that the renderbuffer is deleted when the last ref is released.
161 EXPECT_CALL(*gl_, DeleteRenderbuffersEXT(1, ::testing::Pointee(kService1Id))) 161 EXPECT_CALL(*gl_, DeleteRenderbuffersEXT(1, ::testing::Pointee(kService1Id)))
(...skipping 10 matching lines...) Expand all
172 manager_->CreateRenderbufferInfo(kClient1Id, kService1Id); 172 manager_->CreateRenderbufferInfo(kClient1Id, kService1Id);
173 RenderbufferManager::RenderbufferInfo* info1 = 173 RenderbufferManager::RenderbufferInfo* info1 =
174 manager_->GetRenderbufferInfo(kClient1Id); 174 manager_->GetRenderbufferInfo(kClient1Id);
175 ASSERT_TRUE(info1 != NULL); 175 ASSERT_TRUE(info1 != NULL);
176 176
177 const GLsizei kSamples = 4; 177 const GLsizei kSamples = 4;
178 const GLenum kFormat = GL_RGBA4; 178 const GLenum kFormat = GL_RGBA4;
179 const GLsizei kWidth = 128; 179 const GLsizei kWidth = 128;
180 const GLsizei kHeight1 = 64; 180 const GLsizei kHeight1 = 64;
181 const GLsizei kHeight2 = 32; 181 const GLsizei kHeight2 = 32;
182 size_t expected_size_1 = kWidth * kHeight1 * kSamples * 182 uint32 expected_size_1 = 0;
183 GLES2Util::RenderbufferBytesPerPixel(kFormat); 183 uint32 expected_size_2 = 0;
184 size_t expected_size_2 = kWidth * kHeight2 * kSamples * 184 RenderbufferManager::ComputeEstimatedRenderbufferSize(
185 GLES2Util::RenderbufferBytesPerPixel(kFormat); 185 kWidth, kHeight1, kSamples, kFormat, &expected_size_1);
186 RenderbufferManager::ComputeEstimatedRenderbufferSize(
187 kWidth, kHeight2, kSamples, kFormat, &expected_size_2);
186 EXPECT_MEMORY_ALLOCATION_CHANGE( 188 EXPECT_MEMORY_ALLOCATION_CHANGE(
187 0, expected_size_1, MemoryTracker::kUnmanaged); 189 0, expected_size_1, MemoryTracker::kUnmanaged);
188 manager_->SetInfo(info1, kSamples, kFormat, kWidth, kHeight1); 190 manager_->SetInfo(info1, kSamples, kFormat, kWidth, kHeight1);
189 EXPECT_MEMORY_ALLOCATION_CHANGE( 191 EXPECT_MEMORY_ALLOCATION_CHANGE(
190 expected_size_1, 0, MemoryTracker::kUnmanaged); 192 expected_size_1, 0, MemoryTracker::kUnmanaged);
191 EXPECT_MEMORY_ALLOCATION_CHANGE( 193 EXPECT_MEMORY_ALLOCATION_CHANGE(
192 0, expected_size_2, MemoryTracker::kUnmanaged); 194 0, expected_size_2, MemoryTracker::kUnmanaged);
193 manager_->SetInfo(info1, kSamples, kFormat, kWidth, kHeight2); 195 manager_->SetInfo(info1, kSamples, kFormat, kWidth, kHeight2);
194 EXPECT_MEMORY_ALLOCATION_CHANGE( 196 EXPECT_MEMORY_ALLOCATION_CHANGE(
195 expected_size_2, 0, MemoryTracker::kUnmanaged); 197 expected_size_2, 0, MemoryTracker::kUnmanaged);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 286
285 EXPECT_CALL(*gl_, DeleteRenderbuffersEXT(1, ::testing::Pointee(kService1Id))) 287 EXPECT_CALL(*gl_, DeleteRenderbuffersEXT(1, ::testing::Pointee(kService1Id)))
286 .Times(1) 288 .Times(1)
287 .RetiresOnSaturation(); 289 .RetiresOnSaturation();
288 } 290 }
289 291
290 } // namespace gles2 292 } // namespace gles2
291 } // namespace gpu 293 } // namespace gpu
292 294
293 295
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/renderbuffer_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698