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