| 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 "GrGLFragmentShaderBuilder.h" | 8 #include "GrGLFragmentShaderBuilder.h" |
| 9 #include "GrGLProgramBuilder.h" | 9 #include "GrGLProgramBuilder.h" |
| 10 #include "../GrGLGpu.h" | 10 #include "../GrGLGpu.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 return dual_source_output_name(); | 208 return dual_source_output_name(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId, | 211 bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId, |
| 212 SkTDArray<GrGLuint>* sha
derIds) { | 212 SkTDArray<GrGLuint>* sha
derIds) { |
| 213 GrGLGpu* gpu = fProgramBuilder->gpu(); | 213 GrGLGpu* gpu = fProgramBuilder->gpu(); |
| 214 this->versionDecl() = GrGetGLSLVersionDecl(gpu->ctxInfo()); | 214 this->versionDecl() = GrGetGLSLVersionDecl(gpu->ctxInfo()); |
| 215 append_default_precision_qualifier(kDefault_GrSLPrecision, | 215 append_default_precision_qualifier(kDefault_GrSLPrecision, |
| 216 gpu->glStandard(), | 216 gpu->glStandard(), |
| 217 &this->precisionQualifier()); | 217 &this->precisionQualifier()); |
| 218 this->compileAndAppendLayoutQualifiers(); |
| 218 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility
, | 219 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility
, |
| 219 &this->uniforms()); | 220 &this->uniforms()); |
| 220 this->appendDecls(fInputs, &this->inputs()); | 221 this->appendDecls(fInputs, &this->inputs()); |
| 221 // We shouldn't have declared outputs on 1.10 | 222 // We shouldn't have declared outputs on 1.10 |
| 222 SkASSERT(k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty())
; | 223 SkASSERT(k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty())
; |
| 223 this->appendDecls(fOutputs, &this->outputs()); | 224 this->appendDecls(fOutputs, &this->outputs()); |
| 224 return this->finalize(programId, GR_GL_FRAGMENT_SHADER, shaderIds); | 225 return this->finalize(programId, GR_GL_FRAGMENT_SHADER, shaderIds); |
| 225 } | 226 } |
| 226 | 227 |
| 227 void GrGLFragmentShaderBuilder::bindFragmentShaderLocations(GrGLuint programID)
{ | 228 void GrGLFragmentShaderBuilder::bindFragmentShaderLocations(GrGLuint programID)
{ |
| 228 // ES 3.00 requires custom color output but doesn't support bindFragDataLoca
tion | 229 // ES 3.00 requires custom color output but doesn't support bindFragDataLoca
tion |
| 229 if (fHasCustomColorOutput && | 230 if (fHasCustomColorOutput && |
| 230 kGLES_GrGLStandard != fProgramBuilder->gpu()->ctxInfo().standard()) { | 231 kGLES_GrGLStandard != fProgramBuilder->gpu()->ctxInfo().standard()) { |
| 231 GL_CALL(BindFragDataLocation(programID, 0, declared_color_output_name())
); | 232 GL_CALL(BindFragDataLocation(programID, 0, declared_color_output_name())
); |
| 232 } | 233 } |
| 233 if (fHasSecondaryOutput) { | 234 if (fHasSecondaryOutput) { |
| 234 GL_CALL(BindFragDataLocationIndexed(programID, 0, 1, dual_source_output_
name())); | 235 GL_CALL(BindFragDataLocationIndexed(programID, 0, 1, dual_source_output_
name())); |
| 235 } | 236 } |
| 236 } | 237 } |
| 237 | 238 |
| 238 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec)
{ | 239 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec)
{ |
| 239 v->fFsIn = v->fVsOut; | 240 v->fFsIn = v->fVsOut; |
| 240 if (v->fGsOut) { | 241 if (v->fGsOut) { |
| 241 v->fFsIn = v->fGsOut; | 242 v->fFsIn = v->fGsOut; |
| 242 } | 243 } |
| 243 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v-
>fFsIn, fsPrec); | 244 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v-
>fFsIn, fsPrec); |
| 244 } | 245 } |
| OLD | NEW |