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

Side by Side Diff: tests/ClipCacheTest.cpp

Issue 24222004: Don't reuse scratch textures patch (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: check nothing changes Created 7 years, 1 month 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 | « src/gpu/GrResource.cpp ('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 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "Test.h" 9 #include "Test.h"
10 // This is a GR test 10 // This is a GR test
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // check to make sure canReuse works 190 // check to make sure canReuse works
191 REPORTER_ASSERT(reporter, cache.canReuse(clip2.getTopmostGenID(), bound2)); 191 REPORTER_ASSERT(reporter, cache.canReuse(clip2.getTopmostGenID(), bound2));
192 REPORTER_ASSERT(reporter, !cache.canReuse(clip1.getTopmostGenID(), bound1)); 192 REPORTER_ASSERT(reporter, !cache.canReuse(clip1.getTopmostGenID(), bound1));
193 193
194 // pop the state 194 // pop the state
195 cache.pop(); 195 cache.pop();
196 196
197 // verify that the old state is restored 197 // verify that the old state is restored
198 check_state(reporter, cache, clip1, texture1, bound1); 198 check_state(reporter, cache, clip1, texture1, bound1);
199 REPORTER_ASSERT(reporter, texture1->getRefCnt()); 199 REPORTER_ASSERT(reporter, texture1->getRefCnt());
200 REPORTER_ASSERT(reporter, texture2->getRefCnt());
201 200
202 // manually clear the state 201 // manually clear the state
203 cache.reset(); 202 cache.reset();
204 203
205 // verify it is now empty 204 // verify it is now empty
206 check_state(reporter, cache, emptyClip, NULL, emptyBound); 205 check_state(reporter, cache, emptyClip, NULL, emptyBound);
207 REPORTER_ASSERT(reporter, texture1->getRefCnt());
208 REPORTER_ASSERT(reporter, texture2->getRefCnt());
209 206
210 // pop again - so there is no state 207 // pop again - so there is no state
211 cache.pop(); 208 cache.pop();
212 209
213 #if !defined(SK_DEBUG) 210 #if !defined(SK_DEBUG)
214 // verify that the getters don't crash 211 // verify that the getters don't crash
215 // only do in release since it generates asserts in debug 212 // only do in release since it generates asserts in debug
216 check_state(reporter, cache, emptyClip, NULL, emptyBound); 213 check_state(reporter, cache, emptyClip, NULL, emptyBound);
217 #endif 214 #endif
218 REPORTER_ASSERT(reporter, texture1->getRefCnt());
219 REPORTER_ASSERT(reporter, texture2->getRefCnt());
220 } 215 }
221 216
222 //////////////////////////////////////////////////////////////////////////////// 217 ////////////////////////////////////////////////////////////////////////////////
223 static void TestClipCache(skiatest::Reporter* reporter, GrContextFactory* factor y) { 218 static void TestClipCache(skiatest::Reporter* reporter, GrContextFactory* factor y) {
224 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { 219 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
225 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G LContextType>(type); 220 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G LContextType>(type);
226 if (!GrContextFactory::IsRenderingGLContext(glType)) { 221 if (!GrContextFactory::IsRenderingGLContext(glType)) {
227 continue; 222 continue;
228 } 223 }
229 GrContext* context = factory->get(glType); 224 GrContext* context = factory->get(glType);
230 if (NULL == context) { 225 if (NULL == context) {
231 continue; 226 continue;
232 } 227 }
233 228
234 test_cache(reporter, context); 229 test_cache(reporter, context);
235 test_clip_bounds(reporter, context); 230 test_clip_bounds(reporter, context);
236 } 231 }
237 } 232 }
238 233
239 //////////////////////////////////////////////////////////////////////////////// 234 ////////////////////////////////////////////////////////////////////////////////
240 #include "TestClassDef.h" 235 #include "TestClassDef.h"
241 DEFINE_GPUTESTCLASS("ClipCache", ClipCacheTestClass, TestClipCache) 236 DEFINE_GPUTESTCLASS("ClipCache", ClipCacheTestClass, TestClipCache)
242 237
243 #endif 238 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrResource.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698