aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp')
-rw-r--r--src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
index 76026b7a25..1fa946793c 100644
--- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
@@ -23,17 +23,12 @@ GrGLVertexBuilder::GrGLVertexBuilder(GrGLProgramBuilder* program)
, fEffectAttribOffset(0) {
}
-SkString* GrGLVertexBuilder::addVarying(GrSLType type, const char* name,
- const char** vsOutName) {
+void GrGLVertexBuilder::addVarying(const char* name, GrGLVarying* v) {
fOutputs.push_back();
- fOutputs.back().setType(type);
+ fOutputs.back().setType(v->fType);
fOutputs.back().setTypeModifier(GrGLShaderVar::kVaryingOut_TypeModifier);
fProgramBuilder->nameVariable(fOutputs.back().accessName(), 'v', name);
-
- if (vsOutName) {
- *vsOutName = fOutputs.back().getName().c_str();
- }
- return fOutputs.back().accessName();
+ v->fVsOut = fOutputs.back().getName().c_str();
}
void GrGLVertexBuilder::setupLocalCoords() {
@@ -63,15 +58,15 @@ void GrGLVertexBuilder::transformGLToSkiaCoords() {
}
void GrGLVertexBuilder::setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr4* out) {
+ GrGLVertToFrag v(kVec4f_GrSLType);
+ fProgramBuilder->addVarying(inName, &v);
SkString name(inName);
- const char *vsName, *fsName;
- fProgramBuilder->addVarying(kVec4f_GrSLType, name.c_str(), &vsName, &fsName);
name.prepend("in");
this->addAttribute(GrShaderVar(name.c_str(),
kVec4f_GrSLType,
GrShaderVar::kAttribute_TypeModifier));
- this->codeAppendf("%s = %s;", vsName, name.c_str());
- *out = fsName;
+ this->codeAppendf("%s = %s;", v.vsOut(), name.c_str());
+ *out = v.fsIn();
fEffectAttribOffset++;
}