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

Side by Side Diff: src/gpu/GrProcessor.cpp

Issue 614163002: Force linking of static member variables for GLPrograms (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 6 years, 2 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
« no previous file with comments | « include/gpu/GrProcessorUnitTest.h ('k') | tests/GLProgramsTest.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 * 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 #include "GrProcessor.h" 8 #include "GrProcessor.h"
9 #include "GrBackendProcessorFactory.h" 9 #include "GrBackendProcessorFactory.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
11 #include "GrCoordTransform.h" 11 #include "GrCoordTransform.h"
12 #include "GrMemoryPool.h" 12 #include "GrMemoryPool.h"
13 #include "SkTLS.h" 13 #include "SkTLS.h"
14 14
15 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
16
17 /*
18 * Originally these were both in the processor unit test header, but then it see med to cause linker
19 * problems on android.
20 */
21 template<>
22 SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true>*
23 GrProcessorTestFactory<GrFragmentProcessor>::GetFactories() {
24 static SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true> gFactori es;
25 return &gFactories;
26 }
27
28 template<>
29 SkTArray<GrProcessorTestFactory<GrGeometryProcessor>*, true>*
30 GrProcessorTestFactory<GrGeometryProcessor>::GetFactories() {
31 static SkTArray<GrProcessorTestFactory<GrGeometryProcessor>*, true> gFactori es;
32 return &gFactories;
33 }
34
35 /*
36 * To ensure we always have successful static initialization, before creating fr om the factories
37 * we verify the count is as expected. If a new factory is added, then these nu mbers must be
38 * manually adjusted.
39 */
40 static const int kFPFactoryCount = 37;
41 static const int kGPFactoryCount = 15;
42
43 template<>
44 void GrProcessorTestFactory<GrFragmentProcessor>::VerifyFactoryCount() {
45 if (kFPFactoryCount != GetFactories()->count()) {
46 SkFAIL("Wrong number of fragment processor factories!");
47 }
48 }
49
50 template<>
51 void GrProcessorTestFactory<GrGeometryProcessor>::VerifyFactoryCount() {
52 if (kGPFactoryCount != GetFactories()->count()) {
53 SkFAIL("Wrong number of geometry processor factories!");
54 }
55 }
56
57 #endif
58
15 namespace GrProcessorUnitTest { 59 namespace GrProcessorUnitTest {
16 const SkMatrix& TestMatrix(SkRandom* random) { 60 const SkMatrix& TestMatrix(SkRandom* random) {
17 static SkMatrix gMatrices[5]; 61 static SkMatrix gMatrices[5];
18 static bool gOnce; 62 static bool gOnce;
19 if (!gOnce) { 63 if (!gOnce) {
20 gMatrices[0].reset(); 64 gMatrices[0].reset();
21 gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100)); 65 gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100));
22 gMatrices[2].setRotate(SkIntToScalar(17)); 66 gMatrices[2].setRotate(SkIntToScalar(17));
23 gMatrices[3].setRotate(SkIntToScalar(185)); 67 gMatrices[3].setRotate(SkIntToScalar(185));
24 gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33)); 68 gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (kB_GrColorComponentFlag & fValidFlags) { 168 if (kB_GrColorComponentFlag & fValidFlags) {
125 if (c[2] > c[3]) { 169 if (c[2] > c[3]) {
126 return false; 170 return false;
127 } 171 }
128 } 172 }
129 } 173 }
130 return true; 174 return true;
131 } 175 }
132 #endif 176 #endif
133 177
OLDNEW
« no previous file with comments | « include/gpu/GrProcessorUnitTest.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698