Chromium Code Reviews| 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 "GrGLShaderBuilder.h" | 8 #include "GrGLShaderBuilder.h" |
| 9 #include "GrGLProgramBuilder.h" | 9 #include "GrGLProgramBuilder.h" |
| 10 #include "../GrGpuGL.h" | 10 #include "../GrGpuGL.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 static const int kVarsPerBlock = 8; | 55 static const int kVarsPerBlock = 8; |
| 56 } | 56 } |
| 57 | 57 |
| 58 GrGLShaderBuilder::GrGLShaderBuilder(GrGLProgramBuilder* program) | 58 GrGLShaderBuilder::GrGLShaderBuilder(GrGLProgramBuilder* program) |
| 59 : fProgramBuilder(program) | 59 : fProgramBuilder(program) |
| 60 , fInputs(kVarsPerBlock) | 60 , fInputs(kVarsPerBlock) |
| 61 , fOutputs(kVarsPerBlock) | 61 , fOutputs(kVarsPerBlock) |
| 62 , fFeaturesAddedMask(0) { | 62 , fFeaturesAddedMask(0) { |
| 63 } | 63 } |
| 64 | 64 |
| 65 void GrGLShaderBuilder::declAppend(const GrGLShaderVar& var) { | |
| 66 SkString tempDecl; | |
| 67 var.appendDecl(fProgramBuilder->ctxInfo(), &tempDecl); | |
| 68 this->codeAppendf("%s;\n", tempDecl.c_str()); | |
|
bsalomon
2014/08/29 14:55:06
nit: don't need the \n anymore... we pretty print
| |
| 69 } | |
| 70 | |
| 65 void GrGLShaderBuilder::emitFunction(GrSLType returnType, | 71 void GrGLShaderBuilder::emitFunction(GrSLType returnType, |
| 66 const char* name, | 72 const char* name, |
| 67 int argCnt, | 73 int argCnt, |
| 68 const GrGLShaderVar* args, | 74 const GrGLShaderVar* args, |
| 69 const char* body, | 75 const char* body, |
| 70 SkString* outName) { | 76 SkString* outName) { |
| 71 fFunctions.append(GrGLSLTypeString(returnType)); | 77 fFunctions.append(GrGLSLTypeString(returnType)); |
| 72 fProgramBuilder->nameVariable(outName, '\0', name); | 78 fProgramBuilder->nameVariable(outName, '\0', name); |
| 73 fFunctions.appendf(" %s", outName->c_str()); | 79 fFunctions.appendf(" %s", outName->c_str()); |
| 74 fFunctions.append("("); | 80 fFunctions.append("("); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 coordName, | 152 coordName, |
| 147 configComponentMask, | 153 configComponentMask, |
| 148 swizzle, | 154 swizzle, |
| 149 kVec2f_GrSLType); | 155 kVec2f_GrSLType); |
| 150 } | 156 } |
| 151 | 157 |
| 152 //////////////////////////////////////////////////////////////////////////////// /////////////////// | 158 //////////////////////////////////////////////////////////////////////////////// /////////////////// |
| 153 GrGLFullShaderBuilder::GrGLFullShaderBuilder(GrGLFullProgramBuilder* program) | 159 GrGLFullShaderBuilder::GrGLFullShaderBuilder(GrGLFullProgramBuilder* program) |
| 154 : INHERITED(program) | 160 : INHERITED(program) |
| 155 , fFullProgramBuilder(program) {} | 161 , fFullProgramBuilder(program) {} |
| OLD | NEW |