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

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 132293005: Add a DEF_GPUTEST() macro. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fatory -> factory Created 6 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 | « tests/GLInterfaceValidation.cpp ('k') | tests/GpuBitmapCopyTest.cpp » ('j') | 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 /* 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
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 12
13 #if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 13 #if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
14 14
15 #include "gl/GrGpuGL.h" 15 #include "gl/GrGpuGL.h"
16 #include "GrBackendEffectFactory.h" 16 #include "GrBackendEffectFactory.h"
17 #include "GrContextFactory.h" 17 #include "GrContextFactory.h"
18 #include "GrDrawEffect.h" 18 #include "GrDrawEffect.h"
19 #include "effects/GrConfigConversionEffect.h" 19 #include "effects/GrConfigConversionEffect.h"
20 20
21 #include "SkChecksum.h" 21 #include "SkChecksum.h"
22 #include "SkRandom.h" 22 #include "SkRandom.h"
23 #include "Test.h" 23 #include "Test.h"
24 #include "TestClassDef.h"
24 25
25 void GrGLProgramDesc::setRandom(SkRandom* random, 26 void GrGLProgramDesc::setRandom(SkRandom* random,
26 const GrGpuGL* gpu, 27 const GrGpuGL* gpu,
27 const GrRenderTarget* dstRenderTarget, 28 const GrRenderTarget* dstRenderTarget,
28 const GrTexture* dstCopyTexture, 29 const GrTexture* dstCopyTexture,
29 const GrEffectStage* stages[], 30 const GrEffectStage* stages[],
30 int numColorStages, 31 int numColorStages,
31 int numCoverageStages, 32 int numCoverageStages,
32 int currAttribIndex) { 33 int currAttribIndex) {
33 int numEffects = numColorStages + numCoverageStages; 34 int numEffects = numColorStages + numCoverageStages;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 for (int s = 0; s < numStages; ++s) { 220 for (int s = 0; s < numStages; ++s) {
220 SkDELETE(stages[s]); 221 SkDELETE(stages[s]);
221 } 222 }
222 if (NULL == program.get()) { 223 if (NULL == program.get()) {
223 return false; 224 return false;
224 } 225 }
225 } 226 }
226 return true; 227 return true;
227 } 228 }
228 229
229 static void GLProgramsTest(skiatest::Reporter* reporter, GrContextFactory* facto ry) { 230 DEF_GPUTEST(GLPrograms, reporter, factory) {
230 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { 231 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
231 GrContext* context = factory->get(static_cast<GrContextFactory::GLContex tType>(type)); 232 GrContext* context = factory->get(static_cast<GrContextFactory::GLContex tType>(type));
232 if (NULL != context) { 233 if (NULL != context) {
233 GrGpuGL* gpu = static_cast<GrGpuGL*>(context->getGpu()); 234 GrGpuGL* gpu = static_cast<GrGpuGL*>(context->getGpu());
234 int maxStages = 6; 235 int maxStages = 6;
235 #if SK_ANGLE 236 #if SK_ANGLE
236 // Some long shaders run out of temporary registers in the D3D compi ler on ANGLE. 237 // Some long shaders run out of temporary registers in the D3D compi ler on ANGLE.
237 if (type == GrContextFactory::kANGLE_GLContextType) { 238 if (type == GrContextFactory::kANGLE_GLContextType) {
238 maxStages = 3; 239 maxStages = 3;
239 } 240 }
240 #endif 241 #endif
241 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages)); 242 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages));
242 } 243 }
243 } 244 }
244 } 245 }
245 246
246 #include "TestClassDef.h"
247 DEFINE_GPUTESTCLASS("GLPrograms", GLProgramsTestClass, GLProgramsTest)
248
249 // This is evil evil evil. The linker may throw away whole translation units as dead code if it 247 // This is evil evil evil. The linker may throw away whole translation units as dead code if it
250 // thinks none of the functions are called. It will do this even if there are st atic initializers 248 // thinks none of the functions are called. It will do this even if there are st atic initializers
251 // in the unit that could pass pointers to functions from the unit out to other translation units! 249 // in the unit that could pass pointers to functions from the unit out to other translation units!
252 // We force some of the effects that would otherwise be discarded to link here. 250 // We force some of the effects that would otherwise be discarded to link here.
253 251
254 #include "SkAlphaThresholdFilter.h" 252 #include "SkAlphaThresholdFilter.h"
255 #include "SkLightingImageFilter.h" 253 #include "SkLightingImageFilter.h"
256 #include "SkMagnifierImageFilter.h" 254 #include "SkMagnifierImageFilter.h"
257 #include "SkColorMatrixFilter.h" 255 #include "SkColorMatrixFilter.h"
258 256
259 void forceLinking(); 257 void forceLinking();
260 258
261 void forceLinking() { 259 void forceLinking() {
262 SkLightingImageFilter::CreateDistantLitDiffuse(SkPoint3(0,0,0), 0, 0, 0); 260 SkLightingImageFilter::CreateDistantLitDiffuse(SkPoint3(0,0,0), 0, 0, 0);
263 SkAlphaThresholdFilter::Create(SkRegion(), .5f, .5f); 261 SkAlphaThresholdFilter::Create(SkRegion(), .5f, .5f);
264 SkMagnifierImageFilter mag(SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar 1); 262 SkMagnifierImageFilter mag(SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar 1);
265 GrConfigConversionEffect::Create(NULL, 263 GrConfigConversionEffect::Create(NULL,
266 false, 264 false,
267 GrConfigConversionEffect::kNone_PMConversio n, 265 GrConfigConversionEffect::kNone_PMConversio n,
268 SkMatrix::I()); 266 SkMatrix::I());
269 SkScalar matrix[20]; 267 SkScalar matrix[20];
270 SkColorMatrixFilter cmf(matrix); 268 SkColorMatrixFilter cmf(matrix);
271 } 269 }
272 270
273 #endif 271 #endif
OLDNEW
« no previous file with comments | « tests/GLInterfaceValidation.cpp ('k') | tests/GpuBitmapCopyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698