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 "GrGLFragmentShaderBuilder.h" | 8 #include "GrGLFragmentShaderBuilder.h" |
| 9 #include "GrGLProgramBuilder.h" | 9 #include "GrGLProgramBuilder.h" |
| 10 #include "gl/GrGLGpu.h" | 10 #include "gl/GrGLGpu.h" |
| 11 #include "gl/GrGLGLSL.h" | 11 #include "glsl/GrGLSL.h" |
| 12 #include "glsl/GrGLSLCaps.h" | 12 #include "glsl/GrGLSLCaps.h" |
| 13 | 13 |
| 14 #define GL_CALL(X) GR_GL_CALL(fProgramBuilder->gpu()->glInterface(), X) | 14 #define GL_CALL(X) GR_GL_CALL(fProgramBuilder->gpu()->glInterface(), X) |
| 15 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fProgramBuilder->gpu()->glInterface(), R, X) | 15 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fProgramBuilder->gpu()->glInterface(), R, X) |
| 16 | 16 |
| 17 const char* GrGLFragmentShaderBuilder::kDstTextureColorName = "_dstColor"; | 17 const char* GrGLFragmentShaderBuilder::kDstTextureColorName = "_dstColor"; |
| 18 static const char* declared_color_output_name() { return "fsColorOut"; } | 18 static const char* declared_color_output_name() { return "fsColorOut"; } |
| 19 static const char* declared_secondary_color_output_name() { return "fsSecondaryC olorOut"; } | 19 static const char* declared_secondary_color_output_name() { return "fsSecondaryC olorOut"; } |
| 20 | 20 |
| 21 static const char* specific_layout_qualifier_name(GrBlendEquation equation) { | 21 static const char* specific_layout_qualifier_name(GrBlendEquation equation) { |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 } | 260 } |
| 261 | 261 |
| 262 const char* GrGLFragmentShaderBuilder::getSecondaryColorOutputName() const { | 262 const char* GrGLFragmentShaderBuilder::getSecondaryColorOutputName() const { |
| 263 const GrGLSLCaps& caps = *fProgramBuilder->gpu()->glCaps().glslCaps(); | 263 const GrGLSLCaps& caps = *fProgramBuilder->gpu()->glCaps().glslCaps(); |
| 264 return caps.mustDeclareFragmentShaderOutput() ? declared_secondary_color_out put_name() | 264 return caps.mustDeclareFragmentShaderOutput() ? declared_secondary_color_out put_name() |
| 265 : "gl_SecondaryFragColorEXT"; | 265 : "gl_SecondaryFragColorEXT"; |
| 266 } | 266 } |
| 267 | 267 |
| 268 bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId, | 268 bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId, |
| 269 SkTDArray<GrGLuint>* sha derIds) { | 269 SkTDArray<GrGLuint>* sha derIds) { |
| 270 GrGLGpu* gpu = fProgramBuilder->gpu(); | 270 GrGLGpu* gpu = fProgramBuilder->gpu(); |
|
jvanverth1
2015/10/23 20:39:21
(from the dry run) This variable is no longer used
| |
| 271 this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString(); | 271 this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString(); |
| 272 GrGLAppendGLSLDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, | 272 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, |
| 273 gpu->glStandard(), | 273 *fProgramBuilder->glslCaps(), |
| 274 &this->precisionQualifier()); | 274 &this->precisionQualifier()); |
| 275 this->compileAndAppendLayoutQualifiers(); | 275 this->compileAndAppendLayoutQualifiers(); |
| 276 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility , | 276 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility , |
| 277 &this->uniforms()); | 277 &this->uniforms()); |
| 278 this->appendDecls(fInputs, &this->inputs()); | 278 this->appendDecls(fInputs, &this->inputs()); |
| 279 // We shouldn't have declared outputs on 1.10 | 279 // We shouldn't have declared outputs on 1.10 |
| 280 SkASSERT(k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty()) ; | 280 SkASSERT(k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty()) ; |
| 281 this->appendDecls(fOutputs, &this->outputs()); | 281 this->appendDecls(fOutputs, &this->outputs()); |
| 282 return this->finalize(programId, GR_GL_FRAGMENT_SHADER, shaderIds); | 282 return this->finalize(programId, GR_GL_FRAGMENT_SHADER, shaderIds); |
| 283 } | 283 } |
| 284 | 284 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 309 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2] ); | 309 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2] ); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void GrGLFragmentBuilder::onAfterChildProcEmitCode() { | 312 void GrGLFragmentBuilder::onAfterChildProcEmitCode() { |
| 313 SkASSERT(fSubstageIndices.count() >= 2); | 313 SkASSERT(fSubstageIndices.count() >= 2); |
| 314 fSubstageIndices.pop_back(); | 314 fSubstageIndices.pop_back(); |
| 315 fSubstageIndices.back()++; | 315 fSubstageIndices.back()++; |
| 316 int removeAt = fMangleString.findLastOf('_'); | 316 int removeAt = fMangleString.findLastOf('_'); |
| 317 fMangleString.remove(removeAt, fMangleString.size() - removeAt); | 317 fMangleString.remove(removeAt, fMangleString.size() - removeAt); |
| 318 } | 318 } |
| OLD | NEW |