| 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 26 matching lines...) Expand all Loading... |
| 37 fKey.reset(); | 37 fKey.reset(); |
| 38 | 38 |
| 39 GR_STATIC_ASSERT(0 == kEffectKeyOffsetsAndLengthOffset % sizeof(uint32_t)); | 39 GR_STATIC_ASSERT(0 == kEffectKeyOffsetsAndLengthOffset % sizeof(uint32_t)); |
| 40 | 40 |
| 41 // Make room for everything up to and including the array of offsets to effe
ct keys. | 41 // Make room for everything up to and including the array of offsets to effe
ct keys. |
| 42 fKey.push_back_n(kEffectKeyOffsetsAndLengthOffset + 2 * sizeof(uint16_t) * (
numStages + | 42 fKey.push_back_n(kEffectKeyOffsetsAndLengthOffset + 2 * sizeof(uint16_t) * (
numStages + |
| 43 (geometryProcessor ? 1 : 0))); | 43 (geometryProcessor ? 1 : 0))); |
| 44 | 44 |
| 45 bool dstRead = false; | 45 bool dstRead = false; |
| 46 bool fragPos = false; | 46 bool fragPos = false; |
| 47 bool vertexShader = (NULL != geometryProcessor); | 47 bool vertexShader = SkToBool(geometryProcessor); |
| 48 int offset = 0; | 48 int offset = 0; |
| 49 if (NULL != geometryProcessor) { | 49 if (geometryProcessor) { |
| 50 const GrEffectStage* stage = geometryProcessor; | 50 const GrEffectStage* stage = geometryProcessor; |
| 51 uint16_t* offsetAndSize = reinterpret_cast<uint16_t*>(fKey.begin() + | 51 uint16_t* offsetAndSize = reinterpret_cast<uint16_t*>(fKey.begin() + |
| 52 kEffectKeyOffsetsA
ndLengthOffset + | 52 kEffectKeyOffsetsA
ndLengthOffset + |
| 53 offset * 2 * sizeo
f(uint16_t)); | 53 offset * 2 * sizeo
f(uint16_t)); |
| 54 uint32_t effectKeyOffset = fKey.count(); | 54 uint32_t effectKeyOffset = fKey.count(); |
| 55 if (effectKeyOffset > SK_MaxU16) { | 55 if (effectKeyOffset > SK_MaxU16) { |
| 56 fKey.reset(); | 56 fKey.reset(); |
| 57 return false; | 57 return false; |
| 58 } | 58 } |
| 59 GrDrawEffect drawEffect(*stage, useLocalCoords); | 59 GrDrawEffect drawEffect(*stage, useLocalCoords); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 if (NULL == program.get()) { | 288 if (NULL == program.get()) { |
| 289 return false; | 289 return false; |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 return true; | 292 return true; |
| 293 } | 293 } |
| 294 | 294 |
| 295 DEF_GPUTEST(GLPrograms, reporter, factory) { | 295 DEF_GPUTEST(GLPrograms, reporter, factory) { |
| 296 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { | 296 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { |
| 297 GrContext* context = factory->get(static_cast<GrContextFactory::GLContex
tType>(type)); | 297 GrContext* context = factory->get(static_cast<GrContextFactory::GLContex
tType>(type)); |
| 298 if (NULL != context) { | 298 if (context) { |
| 299 GrGpuGL* gpu = static_cast<GrGpuGL*>(context->getGpu()); | 299 GrGpuGL* gpu = static_cast<GrGpuGL*>(context->getGpu()); |
| 300 int maxStages = 6; | 300 int maxStages = 6; |
| 301 #if SK_ANGLE | 301 #if SK_ANGLE |
| 302 // Some long shaders run out of temporary registers in the D3D compi
ler on ANGLE. | 302 // Some long shaders run out of temporary registers in the D3D compi
ler on ANGLE. |
| 303 if (type == GrContextFactory::kANGLE_GLContextType) { | 303 if (type == GrContextFactory::kANGLE_GLContextType) { |
| 304 maxStages = 3; | 304 maxStages = 3; |
| 305 } | 305 } |
| 306 #endif | 306 #endif |
| 307 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages)); | 307 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages)); |
| 308 } | 308 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 328 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); | 328 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); |
| 329 GrConfigConversionEffect::Create(NULL, | 329 GrConfigConversionEffect::Create(NULL, |
| 330 false, | 330 false, |
| 331 GrConfigConversionEffect::kNone_PMConversio
n, | 331 GrConfigConversionEffect::kNone_PMConversio
n, |
| 332 SkMatrix::I()); | 332 SkMatrix::I()); |
| 333 SkScalar matrix[20]; | 333 SkScalar matrix[20]; |
| 334 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); | 334 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); |
| 335 } | 335 } |
| 336 | 336 |
| 337 #endif | 337 #endif |
| OLD | NEW |