OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrGLProgramBuilder.h" | 8 #include "GrGLProgramBuilder.h" |
9 | 9 |
10 #include "GrAutoLocaleSetter.h" | 10 #include "GrAutoLocaleSetter.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 , fXferProcessor(nullptr) | 58 , fXferProcessor(nullptr) |
59 , fArgs(args) | 59 , fArgs(args) |
60 , fGpu(gpu) | 60 , fGpu(gpu) |
61 , fUniforms(kVarsPerBlock) | 61 , fUniforms(kVarsPerBlock) |
62 , fSamplerUniforms(4) | 62 , fSamplerUniforms(4) |
63 , fSeparableVaryingInfos(kVarsPerBlock) { | 63 , fSeparableVaryingInfos(kVarsPerBlock) { |
64 } | 64 } |
65 | 65 |
66 void GrGLProgramBuilder::addVarying(const char* name, | 66 void GrGLProgramBuilder::addVarying(const char* name, |
67 GrGLVarying* varying, | 67 GrGLVarying* varying, |
68 GrSLPrecision fsPrecision) { | 68 GrSLPrecision precision) { |
69 SkASSERT(varying); | 69 SkASSERT(varying); |
70 if (varying->vsVarying()) { | 70 if (varying->vsVarying()) { |
71 fVS.addVarying(name, varying); | 71 fVS.addVarying(name, precision, varying); |
72 } | 72 } |
73 if (this->primitiveProcessor().willUseGeoShader()) { | 73 if (this->primitiveProcessor().willUseGeoShader()) { |
74 fGS.addVarying(name, varying); | 74 fGS.addVarying(name, precision, varying); |
75 } | 75 } |
76 if (varying->fsVarying()) { | 76 if (varying->fsVarying()) { |
77 fFS.addVarying(varying, fsPrecision); | 77 fFS.addVarying(varying, precision); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 void GrGLProgramBuilder::addPassThroughAttribute(const GrPrimitiveProcessor::Att
ribute* input, | 81 void GrGLProgramBuilder::addPassThroughAttribute(const GrPrimitiveProcessor::Att
ribute* input, |
82 const char* output) { | 82 const char* output) { |
83 GrSLType type = GrVertexAttribTypeToSLType(input->fType); | 83 GrSLType type = GrVertexAttribTypeToSLType(input->fType); |
84 GrGLVertToFrag v(type); | 84 GrGLVertToFrag v(type); |
85 this->addVarying(input->fName, &v); | 85 this->addVarying(input->fName, &v); |
86 fVS.codeAppendf("%s = %s;", v.vsOut(), input->fName); | 86 fVS.codeAppendf("%s = %s;", v.vsOut(), input->fName); |
87 fFS.codeAppendf("%s = %s;", output, v.fsIn()); | 87 fFS.codeAppendf("%s = %s;", output, v.fsIn()); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 } | 515 } |
516 | 516 |
517 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 517 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
518 | 518 |
519 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 519 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
520 int numProcs = fProcs.count(); | 520 int numProcs = fProcs.count(); |
521 for (int i = 0; i < numProcs; ++i) { | 521 for (int i = 0; i < numProcs; ++i) { |
522 delete fProcs[i]; | 522 delete fProcs[i]; |
523 } | 523 } |
524 } | 524 } |
OLD | NEW |