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

Unified Diff: src/gpu/effects/GrCustomCoordsTextureEffect.cpp

Issue 543623004: Removing vertex attrib indices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: warning fixed Created 6 years, 3 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/effects/GrCustomCoordsTextureEffect.h ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrCustomCoordsTextureEffect.cpp
diff --git a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
index 0401c6c7ef22425654dae40ce1cfb3134a86aeaa..206c5245be7926690703824756546c19d088cf93 100644
--- a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
+++ b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
@@ -10,11 +10,11 @@
#include "gl/GrGLEffect.h"
#include "gl/GrGLSL.h"
#include "gl/GrGLTexture.h"
-#include "gl/GrGLVertexEffect.h"
+#include "gl/GrGLGeometryProcessor.h"
#include "GrTBackendEffectFactory.h"
#include "GrTexture.h"
-class GrGLCustomCoordsTextureEffect : public GrGLVertexEffect {
+class GrGLCustomCoordsTextureEffect : public GrGLGeometryProcessor {
public:
GrGLCustomCoordsTextureEffect(const GrBackendEffectFactory& factory, const GrDrawEffect& drawEffect)
: INHERITED (factory) {}
@@ -26,7 +26,9 @@ public:
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) SK_OVERRIDE {
- SkASSERT(1 == drawEffect.castEffect<GrCustomCoordsTextureEffect>().numVertexAttribs());
+ const GrCustomCoordsTextureEffect& customCoordsTextureEffect =
+ drawEffect.castEffect<GrCustomCoordsTextureEffect>();
+ SkASSERT(1 == customCoordsTextureEffect.getVertexAttribs().count());
SkString fsCoordName;
const char* vsVaryingName;
@@ -35,9 +37,8 @@ public:
fsCoordName = fsVaryingNamePtr;
GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
- const SkString* attr0Name =
- vsBuilder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]);
- vsBuilder->codeAppendf("\t%s = %s;\n", vsVaryingName, attr0Name->c_str());
+ const GrShaderVar& inTextureCoords = customCoordsTextureEffect.inTextureCoords();
+ vsBuilder->codeAppendf("\t%s = %s;\n", vsVaryingName, inTextureCoords.c_str());
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
fsBuilder->codeAppendf("\t%s = ", outputColor);
@@ -52,16 +53,18 @@ public:
const GrDrawEffect& drawEffect) SK_OVERRIDE {}
private:
- typedef GrGLVertexEffect INHERITED;
+ typedef GrGLGeometryProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
GrCustomCoordsTextureEffect::GrCustomCoordsTextureEffect(GrTexture* texture,
const GrTextureParams& params)
- : fTextureAccess(texture, params) {
+ : fTextureAccess(texture, params)
+ , fInTextureCoords(this->addVertexAttrib(GrShaderVar("inTextureCoords",
+ kVec2f_GrSLType,
+ GrShaderVar::kAttribute_TypeModifier))) {
this->addTextureAccess(&fTextureAccess);
- this->addVertexAttrib(kVec2f_GrSLType);
}
bool GrCustomCoordsTextureEffect::onIsEqual(const GrEffect& other) const {
« no previous file with comments | « src/gpu/effects/GrCustomCoordsTextureEffect.h ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698