Make GrGLShaderBuilder responsible for inserting begining of main() function defition and closing brace.
This will allow another change I am working on to insert code at the begining of a shader.
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6737058
git-svn-id: http://skia.googlecode.com/svn/trunk@6028 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index fcf00af..066da35 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -364,9 +364,8 @@
GrAssert(fContextInfo.glslGeneration() >= k150_GrGLSLGeneration);
segments->fGSHeader.append("layout(triangles) in;\n"
"layout(triangle_strip, max_vertices = 6) out;\n");
- segments->fGSCode.append("void main() {\n"
- "\tfor (int i = 0; i < 3; ++i) {\n"
- "\t\tgl_Position = gl_in[i].gl_Position;\n");
+ segments->fGSCode.append("\tfor (int i = 0; i < 3; ++i) {\n"
+ "\t\tgl_Position = gl_in[i].gl_Position;\n");
if (fDesc.fEmitsPointSize) {
segments->fGSCode.append("\t\tgl_PointSize = 1.0;\n");
}
@@ -379,8 +378,7 @@
}
segments->fGSCode.append("\t\tEmitVertex();\n"
"\t}\n"
- "\tEndPrimitive();\n"
- "}\n");
+ "\tEndPrimitive();\n");
}
#endif
}
@@ -571,9 +569,8 @@
GrGLShaderVar::kAttribute_TypeModifier,
POS_ATTR_NAME);
- builder.fVSCode.appendf("void main() {\n"
- "\tvec3 pos3 = %s * vec3("POS_ATTR_NAME", 1);\n"
- "\tgl_Position = vec4(pos3.xy, 0, pos3.z);\n",
+ builder.fVSCode.appendf("\tvec3 pos3 = %s * vec3("POS_ATTR_NAME", 1);\n"
+ "\tgl_Position = vec4(pos3.xy, 0, pos3.z);\n",
viewMName);
// incoming color to current stage being processed.
@@ -588,8 +585,6 @@
builder.fVSCode.append("\tgl_PointSize = 1.0;\n");
}
- builder.fFSCode.append("void main() {\n");
-
// add texture coordinates that are used to the list of vertex attr decls
SkString texCoordAttrs[GrDrawState::kMaxTexCoords];
for (int t = 0; t < GrDrawState::kMaxTexCoords; ++t) {
@@ -791,9 +786,6 @@
}
}
- builder.fVSCode.append("}\n");
- builder.fFSCode.append("}\n");
-
///////////////////////////////////////////////////////////////////////////
// insert GS
#if GR_DEBUG