| 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 "GrBackendProcessorFactory.h" | 15 #include "GrBackendProcessorFactory.h" |
| 16 #include "GrContextFactory.h" | 16 #include "GrContextFactory.h" |
| 17 #include "GrOptDrawState.h" | 17 #include "GrOptDrawState.h" |
| 18 #include "effects/GrConfigConversionEffect.h" | 18 #include "effects/GrConfigConversionEffect.h" |
| 19 #include "gl/builders/GrGLProgramBuilder.h" | |
| 20 #include "gl/GrGLPathRendering.h" | 19 #include "gl/GrGLPathRendering.h" |
| 21 #include "gl/GrGpuGL.h" | 20 #include "gl/GrGpuGL.h" |
| 22 #include "SkChecksum.h" | 21 #include "SkChecksum.h" |
| 23 #include "SkRandom.h" | 22 #include "SkRandom.h" |
| 24 #include "Test.h" | 23 #include "Test.h" |
| 25 | 24 |
| 26 static void get_stage_stats(const GrFragmentStage stage, bool* readsDst, | 25 static void get_stage_stats(const GrFragmentStage stage, bool* readsDst, |
| 27 bool* readsFragPosition, bool* requiresVertexShader)
{ | 26 bool* readsFragPosition, bool* requiresVertexShader)
{ |
| 28 if (stage.getProcessor()->willReadDstColor()) { | 27 if (stage.getFragmentProcessor()->willReadDstColor()) { |
| 29 *readsDst = true; | 28 *readsDst = true; |
| 30 } | 29 } |
| 31 if (stage.getProcessor()->willReadFragmentPosition()) { | 30 if (stage.getProcessor()->willReadFragmentPosition()) { |
| 32 *readsFragPosition = true; | 31 *readsFragPosition = true; |
| 33 } | 32 } |
| 34 } | 33 } |
| 35 | 34 |
| 36 bool GrGLProgramDesc::setRandom(SkRandom* random, | 35 bool GrGLProgramDesc::setRandom(SkRandom* random, |
| 37 GrGpuGL* gpu, | 36 GrGpuGL* gpu, |
| 38 const GrRenderTarget* dstRenderTarget, | 37 const GrRenderTarget* dstRenderTarget, |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 numColorStages, | 328 numColorStages, |
| 330 numCoverageStages, | 329 numCoverageStages, |
| 331 currAttribIndex, | 330 currAttribIndex, |
| 332 drawType)) { | 331 drawType)) { |
| 333 return false; | 332 return false; |
| 334 } | 333 } |
| 335 | 334 |
| 336 SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(this->getDr
awState(), | 335 SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(this->getDr
awState(), |
| 337 *this->caps
(), | 336 *this->caps
(), |
| 338 drawType)); | 337 drawType)); |
| 339 SkAutoTUnref<GrGLProgram> program( | 338 SkAutoTUnref<GrGLProgram> program(GrGLProgram::Create(this, |
| 340 GrGLProgramBuilder::CreateProgram(*optState, | 339 *optState.get(), |
| 341 pdesc, | 340 pdesc, |
| 342 drawType, | 341 geometryProcessor.
get(), |
| 343 geometryProcessor, | 342 stages, |
| 344 stages, | 343 stages + numColorS
tages)); |
| 345 stages + numColorStage
s, | |
| 346 this)); | |
| 347 for (int s = 0; s < numStages; ++s) { | 344 for (int s = 0; s < numStages; ++s) { |
| 348 SkDELETE(stages[s]); | 345 SkDELETE(stages[s]); |
| 349 } | 346 } |
| 350 if (NULL == program.get()) { | 347 if (NULL == program.get()) { |
| 351 return false; | 348 return false; |
| 352 } | 349 } |
| 353 | 350 |
| 354 // We have to reset the drawstate because we might have added a gp | 351 // We have to reset the drawstate because we might have added a gp |
| 355 this->drawState()->reset(); | 352 this->drawState()->reset(); |
| 356 } | 353 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); | 390 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); |
| 394 GrConfigConversionEffect::Create(NULL, | 391 GrConfigConversionEffect::Create(NULL, |
| 395 false, | 392 false, |
| 396 GrConfigConversionEffect::kNone_PMConversio
n, | 393 GrConfigConversionEffect::kNone_PMConversio
n, |
| 397 SkMatrix::I()); | 394 SkMatrix::I()); |
| 398 SkScalar matrix[20]; | 395 SkScalar matrix[20]; |
| 399 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); | 396 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); |
| 400 } | 397 } |
| 401 | 398 |
| 402 #endif | 399 #endif |
| OLD | NEW |