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); | |
bsalomon
2014/12/12 14:29:35
this flow seems odd to me... should we always be g
| |
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 | |
43 #include "gl/builders/GrGLProgramBuilder.h" | |
44 | |
45 void GrGLGeometryProcessor::setupColor(GrGLGPBuilder* pb, | |
46 GPInput outputType, | |
47 const char* outputName, | |
48 const GrGeometryProcessor::GrAttribute* c olorAttr, | |
49 UniformHandle* colorUniform) { | |
50 GrGLGPFragmentBuilder* fs = pb->getFragmentShaderBuilder(); | |
51 if (kUniform_GPInput == outputType) { | |
52 const char* fragColor; | |
53 *colorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility, | |
54 kVec4f_GrSLType, | |
55 kDefault_GrSLPrecision, | |
56 "Color", | |
57 &fragColor); | |
58 fs->codeAppendf("%s = %s;", outputName, fragColor); | |
59 } else if (kAttribute_GPInput == outputType) { | |
60 SkASSERT(colorAttr); | |
61 pb->addPassThroughAttribute(colorAttr, outputName); | |
62 } else { | |
63 fs->codeAppendf("%s = vec4(1);", outputName); | |
64 } | |
65 } | |
OLD | NEW |