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

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 1261643004: Some cleanup in GrTextureProvider and GrResourceProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@pathargs
Patch Set: fix Created 5 years, 4 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 // This is a GPU-backend specific test. It relies on static intializers to work 9 // This is a GPU-backend specific test. It relies on static intializers to work
10 10
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 193 }
194 194
195 bool GrDrawTarget::programUnitTest(GrContext* context, int maxStages) { 195 bool GrDrawTarget::programUnitTest(GrContext* context, int maxStages) {
196 // setup dummy textures 196 // setup dummy textures
197 GrSurfaceDesc dummyDesc; 197 GrSurfaceDesc dummyDesc;
198 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag; 198 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
199 dummyDesc.fConfig = kSkia8888_GrPixelConfig; 199 dummyDesc.fConfig = kSkia8888_GrPixelConfig;
200 dummyDesc.fWidth = 34; 200 dummyDesc.fWidth = 34;
201 dummyDesc.fHeight = 18; 201 dummyDesc.fHeight = 18;
202 SkAutoTUnref<GrTexture> dummyTexture1( 202 SkAutoTUnref<GrTexture> dummyTexture1(
203 fResourceProvider->createTexture(dummyDesc, false, NULL, 0)); 203 context->textureProvider()->createTexture(dummyDesc, false, NULL, 0));
204 dummyDesc.fFlags = kNone_GrSurfaceFlags; 204 dummyDesc.fFlags = kNone_GrSurfaceFlags;
205 dummyDesc.fConfig = kAlpha_8_GrPixelConfig; 205 dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
206 dummyDesc.fWidth = 16; 206 dummyDesc.fWidth = 16;
207 dummyDesc.fHeight = 22; 207 dummyDesc.fHeight = 22;
208 SkAutoTUnref<GrTexture> dummyTexture2( 208 SkAutoTUnref<GrTexture> dummyTexture2(
209 fResourceProvider->createTexture(dummyDesc, false, NULL, 0)); 209 context->textureProvider()->createTexture(dummyDesc, false, NULL, 0));
210 210
211 if (!dummyTexture1 || ! dummyTexture2) { 211 if (!dummyTexture1 || ! dummyTexture2) {
212 SkDebugf("Could not allocate dummy textures"); 212 SkDebugf("Could not allocate dummy textures");
213 return false; 213 return false;
214 } 214 }
215 215
216 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()}; 216 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()};
217 217
218 // dummy scissor state 218 // dummy scissor state
219 GrScissorState scissor; 219 GrScissorState scissor;
220 220
221 // wide open clip 221 // wide open clip
222 GrClip clip; 222 GrClip clip;
223 223
224 SkRandom random; 224 SkRandom random;
225 static const int NUM_TESTS = 2048; 225 static const int NUM_TESTS = 2048;
226 for (int t = 0; t < NUM_TESTS; t++) { 226 for (int t = 0; t < NUM_TESTS; t++) {
227 // setup random render target(can fail) 227 // setup random render target(can fail)
228 SkAutoTUnref<GrRenderTarget> rt(random_render_target( 228 SkAutoTUnref<GrRenderTarget> rt(random_render_target(
229 fResourceProvider, &random, this->caps())); 229 context->textureProvider(), &random, this->caps()));
230 if (!rt.get()) { 230 if (!rt.get()) {
231 SkDebugf("Could not allocate render target"); 231 SkDebugf("Could not allocate render target");
232 return false; 232 return false;
233 } 233 }
234 234
235 GrPipelineBuilder pipelineBuilder; 235 GrPipelineBuilder pipelineBuilder;
236 pipelineBuilder.setRenderTarget(rt.get()); 236 pipelineBuilder.setRenderTarget(rt.get());
237 pipelineBuilder.setClip(clip); 237 pipelineBuilder.setClip(clip);
238 238
239 SkAutoTUnref<GrBatch> batch(GrRandomBatch(&random, context)); 239 SkAutoTUnref<GrBatch> batch(GrRandomBatch(&random, context));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 294 }
295 #endif 295 #endif
296 GrTestTarget target; 296 GrTestTarget target;
297 context->getTestTarget(&target); 297 context->getTestTarget(&target);
298 REPORTER_ASSERT(reporter, target.target()->programUnitTest(context, maxStages)); 298 REPORTER_ASSERT(reporter, target.target()->programUnitTest(context, maxStages));
299 } 299 }
300 } 300 }
301 } 301 }
302 302
303 #endif 303 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698