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 "GrGLVertexShaderBuilder.h" | 8 #include "GrGLVertexShaderBuilder.h" |
9 #include "GrGLFullProgramBuilder.h" | 9 #include "GrGLFullProgramBuilder.h" |
10 #include "GrGLShaderStringBuilder.h" | 10 #include "GrGLShaderStringBuilder.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 SkTDArray<GrGLuint>* shaderIds) const { | 113 SkTDArray<GrGLuint>* shaderIds) const { |
114 GrGpuGL* gpu = fProgramBuilder->gpu(); | 114 GrGpuGL* gpu = fProgramBuilder->gpu(); |
115 const GrGLContext& glCtx = gpu->glContext(); | 115 const GrGLContext& glCtx = gpu->glContext(); |
116 const GrGLContextInfo& ctxInfo = gpu->ctxInfo(); | 116 const GrGLContextInfo& ctxInfo = gpu->ctxInfo(); |
117 SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo)); | 117 SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo)); |
118 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility,
&vertShaderSrc); | 118 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility,
&vertShaderSrc); |
119 fProgramBuilder->appendDecls(fInputs, &vertShaderSrc); | 119 fProgramBuilder->appendDecls(fInputs, &vertShaderSrc); |
120 fProgramBuilder->appendDecls(fOutputs, &vertShaderSrc); | 120 fProgramBuilder->appendDecls(fOutputs, &vertShaderSrc); |
121 vertShaderSrc.append("void main() {"); | 121 vertShaderSrc.append("void main() {"); |
122 vertShaderSrc.append(fCode); | 122 vertShaderSrc.append(fCode); |
123 vertShaderSrc.append("}"); | 123 vertShaderSrc.append("}\n"); |
124 GrGLuint vertShaderId = GrGLCompileAndAttachShader(glCtx, programId, | 124 GrGLuint vertShaderId = GrGLCompileAndAttachShader(glCtx, programId, |
125 GR_GL_VERTEX_SHADER, vertShaderSrc); | 125 GR_GL_VERTEX_SHADER, vert
ShaderSrc, |
| 126 gpu->gpuStats()); |
126 if (!vertShaderId) { | 127 if (!vertShaderId) { |
127 return false; | 128 return false; |
128 } | 129 } |
129 *shaderIds->append() = vertShaderId; | 130 *shaderIds->append() = vertShaderId; |
130 return true; | 131 return true; |
131 } | 132 } |
132 | 133 |
133 void GrGLVertexShaderBuilder::emitCodeAfterEffects() { | 134 void GrGLVertexShaderBuilder::emitCodeAfterEffects() { |
134 const char* rtAdjustName; | 135 const char* rtAdjustName; |
135 fProgramBuilder->fUniformHandles.fRTAdjustmentUni = | 136 fProgramBuilder->fUniformHandles.fRTAdjustmentUni = |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 this->addAttribute(GrShaderVar(coverage_attribute_name(), | 193 this->addAttribute(GrShaderVar(coverage_attribute_name(), |
193 kVec4f_GrSLType, | 194 kVec4f_GrSLType, |
194 GrShaderVar::kAttribute_TypeModifier)); | 195 GrShaderVar::kAttribute_TypeModifier)); |
195 const char *vsName, *fsName; | 196 const char *vsName, *fsName; |
196 fFullProgramBuilder->addVarying(kVec4f_GrSLType, "Coverage", &vsName, &f
sName); | 197 fFullProgramBuilder->addVarying(kVec4f_GrSLType, "Coverage", &vsName, &f
sName); |
197 this->codeAppendf("%s = %s;", vsName, coverage_attribute_name()); | 198 this->codeAppendf("%s = %s;", vsName, coverage_attribute_name()); |
198 *coverage = fsName; | 199 *coverage = fsName; |
199 } | 200 } |
200 fEffectAttribOffset = fInputs.count(); | 201 fEffectAttribOffset = fInputs.count(); |
201 } | 202 } |
OLD | NEW |