| 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 "GrGLShaderStringBuilder.h" | 9 #include "GrGLShaderStringBuilder.h" |
| 10 #include "GrGLProgramBuilder.h" | 10 #include "GrGLProgramBuilder.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility
, &fragShaderSrc); | 224 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility
, &fragShaderSrc); |
| 225 fProgramBuilder->appendDecls(fInputs, &fragShaderSrc); | 225 fProgramBuilder->appendDecls(fInputs, &fragShaderSrc); |
| 226 // We shouldn't have declared outputs on 1.10 | 226 // We shouldn't have declared outputs on 1.10 |
| 227 SkASSERT(k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty())
; | 227 SkASSERT(k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty())
; |
| 228 fProgramBuilder->appendDecls(fOutputs, &fragShaderSrc); | 228 fProgramBuilder->appendDecls(fOutputs, &fragShaderSrc); |
| 229 fragShaderSrc.append(fFunctions); | 229 fragShaderSrc.append(fFunctions); |
| 230 fragShaderSrc.append("void main() {\n"); | 230 fragShaderSrc.append("void main() {\n"); |
| 231 fragShaderSrc.append(fCode); | 231 fragShaderSrc.append(fCode); |
| 232 fragShaderSrc.append("}\n"); | 232 fragShaderSrc.append("}\n"); |
| 233 | 233 |
| 234 GrGLuint fragShaderId = GrGLCompileAndAttachShader(gpu->glContext(), | 234 GrGLuint fragShaderId = GrGLCompileAndAttachShader(gpu, programId, |
| 235 programId, GR_GL_FRAGMENT_SHADER, fragShaderSrc); | 235 GR_GL_FRAGMENT_SHADER, fr
agShaderSrc); |
| 236 if (!fragShaderId) { | 236 if (!fragShaderId) { |
| 237 return false; | 237 return false; |
| 238 } | 238 } |
| 239 | 239 |
| 240 *shaderIds->append() = fragShaderId; | 240 *shaderIds->append() = fragShaderId; |
| 241 | 241 |
| 242 return true; | 242 return true; |
| 243 } | 243 } |
| 244 | 244 |
| 245 void GrGLFragmentShaderBuilder::emitCodeBeforeEffects() { | 245 void GrGLFragmentShaderBuilder::emitCodeBeforeEffects() { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 dual_source_output_name()); | 343 dual_source_output_name()); |
| 344 fHasSecondaryOutput = true; | 344 fHasSecondaryOutput = true; |
| 345 } | 345 } |
| 346 return dual_source_output_name(); | 346 return dual_source_output_name(); |
| 347 } | 347 } |
| 348 | 348 |
| 349 const char* GrGLFragmentShaderBuilder::getColorOutputName() const { | 349 const char* GrGLFragmentShaderBuilder::getColorOutputName() const { |
| 350 return fHasCustomColorOutput ? declared_color_output_name() : "gl_FragColor"
; | 350 return fHasCustomColorOutput ? declared_color_output_name() : "gl_FragColor"
; |
| 351 } | 351 } |
| 352 | 352 |
| OLD | NEW |