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 |
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 "GrBackendEffectFactory.h" | 15 #include "GrBackendEffectFactory.h" |
16 #include "GrContextFactory.h" | 16 #include "GrContextFactory.h" |
17 #include "GrDrawEffect.h" | |
18 #include "effects/GrConfigConversionEffect.h" | 17 #include "effects/GrConfigConversionEffect.h" |
19 #include "gl/GrGLPathRendering.h" | 18 #include "gl/GrGLPathRendering.h" |
20 #include "gl/GrGpuGL.h" | 19 #include "gl/GrGpuGL.h" |
21 #include "SkChecksum.h" | 20 #include "SkChecksum.h" |
22 #include "SkRandom.h" | 21 #include "SkRandom.h" |
23 #include "Test.h" | 22 #include "Test.h" |
24 | 23 |
25 bool GrGLProgramDesc::setRandom(SkRandom* random, | 24 bool GrGLProgramDesc::setRandom(SkRandom* random, |
26 const GrGpuGL* gpu, | 25 const GrGpuGL* gpu, |
27 const GrRenderTarget* dstRenderTarget, | 26 const GrRenderTarget* dstRenderTarget, |
(...skipping 21 matching lines...) Expand all Loading... |
49 if (geometryProcessor) { | 48 if (geometryProcessor) { |
50 const GrEffectStage* stage = geometryProcessor; | 49 const GrEffectStage* stage = geometryProcessor; |
51 uint16_t* offsetAndSize = reinterpret_cast<uint16_t*>(fKey.begin() + | 50 uint16_t* offsetAndSize = reinterpret_cast<uint16_t*>(fKey.begin() + |
52 kEffectKeyOffsetsA
ndLengthOffset + | 51 kEffectKeyOffsetsA
ndLengthOffset + |
53 offset * 2 * sizeo
f(uint16_t)); | 52 offset * 2 * sizeo
f(uint16_t)); |
54 uint32_t effectKeyOffset = fKey.count(); | 53 uint32_t effectKeyOffset = fKey.count(); |
55 if (effectKeyOffset > SK_MaxU16) { | 54 if (effectKeyOffset > SK_MaxU16) { |
56 fKey.reset(); | 55 fKey.reset(); |
57 return false; | 56 return false; |
58 } | 57 } |
59 GrDrawEffect drawEffect(*stage, useLocalCoords); | |
60 GrEffectKeyBuilder b(&fKey); | 58 GrEffectKeyBuilder b(&fKey); |
61 uint16_t effectKeySize; | 59 uint16_t effectKeySize; |
62 if (!GetEffectKeyAndUpdateStats(*stage, gpu->glCaps(), useLocalCoords, &
b, | 60 if (!GetEffectKeyAndUpdateStats(*stage, gpu->glCaps(), useLocalCoords, &
b, |
63 &effectKeySize, &dstRead, &fragPos, &ver
texShader)) { | 61 &effectKeySize, &dstRead, &fragPos, &ver
texShader)) { |
64 fKey.reset(); | 62 fKey.reset(); |
65 return false; | 63 return false; |
66 } | 64 } |
67 offsetAndSize[0] = effectKeyOffset; | 65 offsetAndSize[0] = effectKeyOffset; |
68 offsetAndSize[1] = effectKeySize; | 66 offsetAndSize[1] = effectKeySize; |
69 offset++; | 67 offset++; |
70 } | 68 } |
71 | 69 |
72 for (int s = 0; s < numStages; ++s, ++offset) { | 70 for (int s = 0; s < numStages; ++s, ++offset) { |
73 const GrEffectStage* stage = stages[s]; | 71 const GrEffectStage* stage = stages[s]; |
74 uint16_t* offsetAndSize = reinterpret_cast<uint16_t*>(fKey.begin() + | 72 uint16_t* offsetAndSize = reinterpret_cast<uint16_t*>(fKey.begin() + |
75 kEffectKeyOffsetsA
ndLengthOffset + | 73 kEffectKeyOffsetsA
ndLengthOffset + |
76 offset * 2 * sizeo
f(uint16_t)); | 74 offset * 2 * sizeo
f(uint16_t)); |
77 uint32_t effectKeyOffset = fKey.count(); | 75 uint32_t effectKeyOffset = fKey.count(); |
78 if (effectKeyOffset > SK_MaxU16) { | 76 if (effectKeyOffset > SK_MaxU16) { |
79 fKey.reset(); | 77 fKey.reset(); |
80 return false; | 78 return false; |
81 } | 79 } |
82 GrDrawEffect drawEffect(*stage, useLocalCoords); | |
83 GrEffectKeyBuilder b(&fKey); | 80 GrEffectKeyBuilder b(&fKey); |
84 uint16_t effectKeySize; | 81 uint16_t effectKeySize; |
85 if (!GetEffectKeyAndUpdateStats(*stage, gpu->glCaps(), useLocalCoords, &
b, | 82 if (!GetEffectKeyAndUpdateStats(*stage, gpu->glCaps(), useLocalCoords, &
b, |
86 &effectKeySize, &dstRead, &fragPos, &ver
texShader)) { | 83 &effectKeySize, &dstRead, &fragPos, &ver
texShader)) { |
87 fKey.reset(); | 84 fKey.reset(); |
88 return false; | 85 return false; |
89 } | 86 } |
90 offsetAndSize[0] = effectKeyOffset; | 87 offsetAndSize[0] = effectKeyOffset; |
91 offsetAndSize[1] = effectKeySize; | 88 offsetAndSize[1] = effectKeySize; |
92 } | 89 } |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); | 370 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); |
374 GrConfigConversionEffect::Create(NULL, | 371 GrConfigConversionEffect::Create(NULL, |
375 false, | 372 false, |
376 GrConfigConversionEffect::kNone_PMConversio
n, | 373 GrConfigConversionEffect::kNone_PMConversio
n, |
377 SkMatrix::I()); | 374 SkMatrix::I()); |
378 SkScalar matrix[20]; | 375 SkScalar matrix[20]; |
379 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); | 376 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); |
380 } | 377 } |
381 | 378 |
382 #endif | 379 #endif |
OLD | NEW |