OLD | NEW |
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 texDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 108 texDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
109 texDesc.fConfig = kRGBA_8888_GrPixelConfig; | 109 texDesc.fConfig = kRGBA_8888_GrPixelConfig; |
110 texDesc.fOrigin = random->nextBool() == true ? kTopLeft_GrSurfaceOrigin : | 110 texDesc.fOrigin = random->nextBool() == true ? kTopLeft_GrSurfaceOrigin : |
111 kBottomLeft_GrSurfaceOrigin; | 111 kBottomLeft_GrSurfaceOrigin; |
112 GrUniqueKey key; | 112 GrUniqueKey key; |
113 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); | 113 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); |
114 GrUniqueKey::Builder builder(&key, kDomain, 1); | 114 GrUniqueKey::Builder builder(&key, kDomain, 1); |
115 builder[0] = texDesc.fOrigin; | 115 builder[0] = texDesc.fOrigin; |
116 builder.finish(); | 116 builder.finish(); |
117 | 117 |
118 GrTexture* texture = context->findAndRefCachedTexture(key); | 118 GrTexture* texture = context->textureProvider()->findAndRefTextureByUniqueKe
y(key); |
119 if (!texture) { | 119 if (!texture) { |
120 texture = context->createTexture(texDesc, true); | 120 texture = context->textureProvider()->createTexture(texDesc, true); |
121 if (texture) { | 121 if (texture) { |
122 context->addResourceToCache(key, texture); | 122 context->textureProvider()->assignUniqueKeyToTexture(key, texture); |
123 } | 123 } |
124 } | 124 } |
125 return texture ? texture->asRenderTarget() : NULL; | 125 return texture ? texture->asRenderTarget() : NULL; |
126 } | 126 } |
127 | 127 |
128 static void set_random_xpf(GrContext* context, const GrDrawTargetCaps& caps, | 128 static void set_random_xpf(GrContext* context, const GrDrawTargetCaps& caps, |
129 GrPipelineBuilder* pipelineBuilder, SkRandom* random, | 129 GrPipelineBuilder* pipelineBuilder, SkRandom* random, |
130 GrTexture* dummyTextures[]) { | 130 GrTexture* dummyTextures[]) { |
131 SkAutoTUnref<const GrXPFactory> xpf( | 131 SkAutoTUnref<const GrXPFactory> xpf( |
132 GrProcessorTestFactory<GrXPFactory>::CreateStage(random, context, caps,
dummyTextures)); | 132 GrProcessorTestFactory<GrXPFactory>::CreateStage(random, context, caps,
dummyTextures)); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 } | 367 } |
368 #endif | 368 #endif |
369 GrTestTarget target; | 369 GrTestTarget target; |
370 context->getTestTarget(&target); | 370 context->getTestTarget(&target); |
371 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); | 371 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); |
372 } | 372 } |
373 } | 373 } |
374 } | 374 } |
375 | 375 |
376 #endif | 376 #endif |
OLD | NEW |