Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp

Issue 924973002: Revert of Multi-string shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/builders/GrGLFragmentShaderBuilder.h ('k') | src/gpu/gl/builders/GrGLGeometryShaderBuilder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
index c739f1162a63fdd3faf3fcd61244f811c3485618..86c622d45686693b8ec25df5a705db14a00b45d8 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
@@ -6,6 +6,7 @@
*/
#include "GrGLFragmentShaderBuilder.h"
+#include "GrGLShaderStringBuilder.h"
#include "GrGLProgramBuilder.h"
#include "../GrGLGpu.h"
@@ -209,19 +210,33 @@
}
bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId,
- SkTDArray<GrGLuint>* shaderIds) {
+ SkTDArray<GrGLuint>* shaderIds) const {
GrGLGpu* gpu = fProgramBuilder->gpu();
- this->versionDecl() = GrGetGLSLVersionDecl(gpu->ctxInfo());
+ SkString fragShaderSrc(GrGetGLSLVersionDecl(gpu->ctxInfo()));
+ fragShaderSrc.append(fExtensions);
append_default_precision_qualifier(kDefault_GrSLPrecision,
gpu->glStandard(),
- &this->precisionQualifier());
- fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility,
- &this->uniforms());
- this->appendDecls(fInputs, &this->inputs());
+ &fragShaderSrc);
+ fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility, &fragShaderSrc);
+ this->appendDecls(fInputs, &fragShaderSrc);
// We shouldn't have declared outputs on 1.10
SkASSERT(k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty());
- this->appendDecls(fOutputs, &this->outputs());
- return this->finalize(programId, GR_GL_FRAGMENT_SHADER, shaderIds);
+ 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;
}
void GrGLFragmentShaderBuilder::bindFragmentShaderLocations(GrGLuint programID) {
« no previous file with comments | « src/gpu/gl/builders/GrGLFragmentShaderBuilder.h ('k') | src/gpu/gl/builders/GrGLGeometryShaderBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698