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

Unified Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 12462008: Add GrEllipseEdgeEffect (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: rebase again Created 7 years, 9 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/GrGLShaderBuilder.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLShaderBuilder.cpp
===================================================================
--- src/gpu/gl/GrGLShaderBuilder.cpp (revision 8091)
+++ src/gpu/gl/GrGLShaderBuilder.cpp (working copy)
@@ -258,6 +258,22 @@
return fUniforms[handle_to_index(u)].fVariable;
}
+bool GrGLShaderBuilder::addAttribute(GrSLType type,
+ const char* name) {
+ for (int i = 0; i < fVSAttrs.count(); ++i) {
+ const GrGLShaderVar& attr = fVSAttrs[i];
+ // if attribute already added, don't add it again
+ if (attr.getName().equals(name)) {
+ GrAssert(attr.getType() == type);
+ return false;
+ }
+ }
+ fVSAttrs.push_back().set(type,
+ GrGLShaderVar::kAttribute_TypeModifier,
+ name);
+ return true;
+}
+
void GrGLShaderBuilder::addVarying(GrSLType type,
const char* name,
const char** vsOutName,
@@ -491,6 +507,18 @@
samplerHandles->push_back(textureSamplers[i].fSamplerUniform);
}
+ int numAttributes = stage.getVertexAttribIndexCount();
+ const int* attributeIndices = stage.getVertexAttribIndices();
+ SkSTArray<GrEffect::kMaxVertexAttribs, SkString> attributeNames;
+ for (int i = 0; i < numAttributes; ++i) {
+ SkString attributeName("aAttr");
+ attributeName.appendS32(attributeIndices[i]);
+
+ if (this->addAttribute(effect->vertexAttribType(i), attributeName.c_str())) {
+ fEffectAttributes.push_back().set(attributeIndices[i], attributeName);
+ }
+ }
+
GrGLEffect* glEffect = effect->getFactory().createGLInstance(effect);
// Enclose custom code in a block to avoid namespace conflicts
@@ -508,3 +536,16 @@
return glEffect;
}
+
+const SkString* GrGLShaderBuilder::getEffectAttributeName(int attributeIndex) const {
+ const AttributePair* attribEnd = this->getEffectAttributes().end();
+ for (const AttributePair* attrib = this->getEffectAttributes().begin();
+ attrib != attribEnd;
+ ++attrib) {
+ if (attrib->fIndex == attributeIndex) {
+ return &attrib->fName;
+ }
+ }
+
+ return NULL;
+}
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698