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

Unified Diff: src/gpu/gl/builders/GrGLVertexShaderBuilder.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/GrGLVertexShaderBuilder.h ('k') | tests/GrGLSLPrettyPrintTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
index 00e96a56182812b6236e44f4ef96f11bdd733331..f1671af54cb8f860f243bc47dd1dc098e3926684 100644
--- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
@@ -7,6 +7,7 @@
#include "GrGLVertexShaderBuilder.h"
#include "GrGLProgramBuilder.h"
+#include "GrGLShaderStringBuilder.h"
#include "../GrGLGpu.h"
#define GL_CALL(X) GR_GL_CALL(fProgramBuilder->gpu()->glInterface(), X)
@@ -72,13 +73,25 @@
return;
}
-bool
-GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shaderIds) {
- this->versionDecl() = GrGetGLSLVersionDecl(fProgramBuilder->ctxInfo());
- fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility, &this->uniforms());
- this->appendDecls(fInputs, &this->inputs());
- this->appendDecls(fOutputs, &this->outputs());
- return this->finalize(programId, GR_GL_VERTEX_SHADER, shaderIds);
+bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId,
+ SkTDArray<GrGLuint>* shaderIds) const {
+ GrGLGpu* gpu = fProgramBuilder->gpu();
+ const GrGLContext& glCtx = gpu->glContext();
+ const GrGLContextInfo& ctxInfo = gpu->ctxInfo();
+ SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo));
+ fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility, &vertShaderSrc);
+ this->appendDecls(fInputs, &vertShaderSrc);
+ this->appendDecls(fOutputs, &vertShaderSrc);
+ vertShaderSrc.append("void main() {");
+ vertShaderSrc.append(fCode);
+ vertShaderSrc.append("}\n");
+ GrGLuint vertShaderId = GrGLCompileAndAttachShader(glCtx, programId, GR_GL_VERTEX_SHADER,
+ vertShaderSrc, gpu->stats());
+ if (!vertShaderId) {
+ return false;
+ }
+ *shaderIds->append() = vertShaderId;
+ return true;
}
bool GrGLVertexBuilder::addAttribute(const GrShaderVar& var) {
« no previous file with comments | « src/gpu/gl/builders/GrGLVertexShaderBuilder.h ('k') | tests/GrGLSLPrettyPrintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698