| 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 #include "gl/GrGLProgram.h" | 9 #include "gl/GrGLProgram.h" |
| 10 #include "gl/GrGLSLPrettyPrint.h" | 10 #include "gl/GrGLSLPrettyPrint.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 , fStageIndex(-1) | 96 , fStageIndex(-1) |
| 97 , fGeometryProcessor(NULL) | 97 , fGeometryProcessor(NULL) |
| 98 , fOptState(optState) | 98 , fOptState(optState) |
| 99 , fDesc(optState.programDesc()) | 99 , fDesc(optState.programDesc()) |
| 100 , fGpu(gpu) | 100 , fGpu(gpu) |
| 101 , fUniforms(kVarsPerBlock) { | 101 , fUniforms(kVarsPerBlock) { |
| 102 } | 102 } |
| 103 | 103 |
| 104 void GrGLProgramBuilder::addVarying(const char* name, | 104 void GrGLProgramBuilder::addVarying(const char* name, |
| 105 GrGLVarying* varying, | 105 GrGLVarying* varying, |
| 106 GrGLShaderVar::Precision fsPrecision) { | 106 GrSLPrecision fsPrecision) { |
| 107 SkASSERT(varying); | 107 SkASSERT(varying); |
| 108 if (varying->vsVarying()) { | 108 if (varying->vsVarying()) { |
| 109 fVS.addVarying(name, varying); | 109 fVS.addVarying(name, varying); |
| 110 } | 110 } |
| 111 if (fOptState.hasGeometryProcessor() && fOptState.getGeometryProcessor()->wi
llUseGeoShader()) { | 111 if (fOptState.hasGeometryProcessor() && fOptState.getGeometryProcessor()->wi
llUseGeoShader()) { |
| 112 fGS.addVarying(name, varying); | 112 fGS.addVarying(name, varying); |
| 113 } | 113 } |
| 114 if (varying->fsVarying()) { | 114 if (varying->fsVarying()) { |
| 115 fFS.addVarying(varying, fsPrecision); | 115 fFS.addVarying(varying, fsPrecision); |
| 116 } | 116 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 this->nameVariable(uni.fVariable.accessName(), prefix, name); | 166 this->nameVariable(uni.fVariable.accessName(), prefix, name); |
| 167 uni.fVariable.setArrayCount(count); | 167 uni.fVariable.setArrayCount(count); |
| 168 uni.fVisibility = visibility; | 168 uni.fVisibility = visibility; |
| 169 | 169 |
| 170 // If it is visible in both the VS and FS, the precision must match. | 170 // If it is visible in both the VS and FS, the precision must match. |
| 171 // We declare a default FS precision, but not a default VS. So set the var | 171 // We declare a default FS precision, but not a default VS. So set the var |
| 172 // to use the default FS precision. | 172 // to use the default FS precision. |
| 173 if ((kVertex_Visibility | kFragment_Visibility) == visibility) { | 173 if ((kVertex_Visibility | kFragment_Visibility) == visibility) { |
| 174 // the fragment and vertex precisions must match | 174 // the fragment and vertex precisions must match |
| 175 uni.fVariable.setPrecision(GrShaderVar::kDefault_Precision); | 175 uni.fVariable.setPrecision(kDefault_GrSLPrecision); |
| 176 } | 176 } |
| 177 | 177 |
| 178 if (outName) { | 178 if (outName) { |
| 179 *outName = uni.fVariable.c_str(); | 179 *outName = uni.fVariable.c_str(); |
| 180 } | 180 } |
| 181 return GrGLProgramDataManager::UniformHandle::CreateFromUniformIndex(fUnifor
ms.count() - 1); | 181 return GrGLProgramDataManager::UniformHandle::CreateFromUniformIndex(fUnifor
ms.count() - 1); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void GrGLProgramBuilder::appendUniformDecls(ShaderVisibility visibility, | 184 void GrGLProgramBuilder::appendUniformDecls(ShaderVisibility visibility, |
| 185 SkString* out) const { | 185 SkString* out) const { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 } | 547 } |
| 548 | 548 |
| 549 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 549 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 550 | 550 |
| 551 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 551 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
| 552 int numProcs = fProcs.count(); | 552 int numProcs = fProcs.count(); |
| 553 for (int e = 0; e < numProcs; ++e) { | 553 for (int e = 0; e < numProcs; ++e) { |
| 554 SkDELETE(fProcs[e]); | 554 SkDELETE(fProcs[e]); |
| 555 } | 555 } |
| 556 } | 556 } |
| OLD | NEW |