Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2014 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #include "GrGeometryProcessor.h" | |
| 9 | |
| 10 #include "gl/GrGLGeometryProcessor.h" | |
| 11 #include "GrInvariantOutput.h" | |
| 12 | |
| 13 //////////////////////////////////////////////////////////////////////////////// /////////////////// | |
| 14 | |
| 15 void GrGeometryProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) co nst { | |
| 16 if (fHasVertexColor) { | |
| 17 if (fOpaqueVertexColors) { | |
| 18 out->setUnknownOpaqueFourComponents(); | |
| 19 } else { | |
| 20 out->setUnknownFourComponents(); | |
| 21 } | |
| 22 } else { | |
| 23 out->setKnownFourComponents(fColor); | |
| 24 } | |
| 25 this->onGetInvariantOutputColor(out); | |
| 26 } | |
| 27 | |
| 28 void GrGeometryProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) const { | |
| 29 this->onGetInvariantOutputCoverage(out); | |
| 30 } | |
| 31 | |
| 32 //////////////////////////////////////////////////////////////////////////////// /////////////////// | |
| 33 | |
| 34 void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const { | |
| 35 out->setKnownFourComponents(fColor); | |
| 36 } | |
| 37 | |
| 38 void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con st { | |
| 39 out->setKnownSingleComponent(0xff); | |
| 40 } | |
| 41 | |
| 42 GrPathProcessor::GrPathProcessor(GrColor color) : fColor(color) { | |
| 43 this->initClassID<GrPathProcessor>(); | |
| 44 } | |
| 45 | |
| 46 //////////////////////////////////////////////////////////////////////////////// /////////////////// | |
| 47 | |
| 48 #include "gl/builders/GrGLProgramBuilder.h" | |
| 49 | |
| 50 void GrGLGeometryProcessor::setupColor(GrGLGPBuilder* pb, | |
|
bsalomon
2014/12/15 15:31:13
Maybe call it setupPassThroughColor? Not sure if i
| |
| 51 GrGPInput inputType, | |
| 52 const char* outputName, | |
| 53 const GrGeometryProcessor::GrAttribute* c olorAttr, | |
| 54 UniformHandle* colorUniform) { | |
| 55 GrGLGPFragmentBuilder* fs = pb->getFragmentShaderBuilder(); | |
| 56 if (kUniform_GrGPInput == inputType) { | |
| 57 const char* stagedLocalVarName; | |
| 58 *colorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility, | |
| 59 kVec4f_GrSLType, | |
| 60 kDefault_GrSLPrecision, | |
| 61 "Color", | |
| 62 &stagedLocalVarName); | |
| 63 fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName); | |
| 64 } else if (kAttribute_GrGPInput == inputType) { | |
| 65 SkASSERT(colorAttr); | |
| 66 pb->addPassThroughAttribute(colorAttr, outputName); | |
| 67 } else if (kAllOnes_GrGPInput == inputType) { | |
| 68 fs->codeAppendf("%s = vec4(1);", outputName); | |
| 69 } | |
| 70 } | |
| OLD | NEW |