aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-02-13 16:23:48 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-13 16:23:49 -0800
commit1c3c2d83364ee228e0751df0e1b9c161c0ba8c1e (patch)
treef5913f990f042a0b97992f3c33567bf959902084 /src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
parent3a6672ae0c95f24f873dca21424e060df9f9c3e5 (diff)
Multi-string shaders
Diffstat (limited to 'src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp')
-rw-r--r--src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
index 86c622d456..c739f1162a 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
@@ -6,7 +6,6 @@
*/
#include "GrGLFragmentShaderBuilder.h"
-#include "GrGLShaderStringBuilder.h"
#include "GrGLProgramBuilder.h"
#include "../GrGLGpu.h"
@@ -210,33 +209,19 @@ const char* GrGLFragmentShaderBuilder::getSecondaryColorOutputName() const {
}
bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId,
- SkTDArray<GrGLuint>* shaderIds) const {
+ SkTDArray<GrGLuint>* shaderIds) {
GrGLGpu* gpu = fProgramBuilder->gpu();
- SkString fragShaderSrc(GrGetGLSLVersionDecl(gpu->ctxInfo()));
- fragShaderSrc.append(fExtensions);
+ this->versionDecl() = GrGetGLSLVersionDecl(gpu->ctxInfo());
append_default_precision_qualifier(kDefault_GrSLPrecision,
gpu->glStandard(),
- &fragShaderSrc);
- fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility, &fragShaderSrc);
- this->appendDecls(fInputs, &fragShaderSrc);
+ &this->precisionQualifier());
+ fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility,
+ &this->uniforms());
+ this->appendDecls(fInputs, &this->inputs());
// We shouldn't have declared outputs on 1.10
SkASSERT(k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty());
- this->appendDecls(fOutputs, &fragShaderSrc);
- fragShaderSrc.append(fFunctions);
- fragShaderSrc.append("void main() {\n");
- fragShaderSrc.append(fCode);
- fragShaderSrc.append("}\n");
-
- GrGLuint fragShaderId = GrGLCompileAndAttachShader(gpu->glContext(), programId,
- GR_GL_FRAGMENT_SHADER, fragShaderSrc,
- gpu->stats());
- if (!fragShaderId) {
- return false;
- }
-
- *shaderIds->append() = fragShaderId;
-
- return true;
+ this->appendDecls(fOutputs, &this->outputs());
+ return this->finalize(programId, GR_GL_FRAGMENT_SHADER, shaderIds);
}
void GrGLFragmentShaderBuilder::bindFragmentShaderLocations(GrGLuint programID) {