Adds local coords to GrEffect system.
Effects can ask the builder for local coords which may or may not be distinct from positions.
GrEffectStage tracks changes to relationship between pos and local coords.
GrGLEffectMatrix and GrSingleTextureEffect can use either pos or textures as intput coords
GrSimpleTextureEffect now allows for an explicit texture coords attribute.
Review URL: https://codereview.chromium.org/12531015
git-svn-id: http://skia.googlecode.com/svn/trunk@8264 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index d12aeb5..aeb7ecc 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -15,6 +15,7 @@
#include "gl/GrGpuGL.h"
#include "GrBackendEffectFactory.h"
#include "GrContextFactory.h"
+#include "GrDrawEffect.h"
#include "effects/GrConfigConversionEffect.h"
#include "SkRandom.h"
@@ -57,16 +58,18 @@
fDualSrcOutput = kNone_DualSrcOutput;
}
- bool useOnce = false;
+ // use separate tex coords?
+ if (random->nextBool()) {
+ fAttribBindings |= GrDrawState::kLocalCoords_AttribBindingsBit;
+ }
+
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
if (NULL != stages[s].getEffect()) {
const GrBackendEffectFactory& factory = (*stages[s].getEffect())->getFactory();
- fEffectKeys[s] = factory.glEffectKey(stages[s], gpu->glCaps());
- // use separate tex coords?
- if (!useOnce && random->nextBool()) {
- fAttribBindings |= GrDrawState::ExplicitTexCoordAttribBindingsBit(s);
- useOnce = true;
- }
+ bool explicitLocalCoords = (fAttribBindings &
+ GrDrawState::kLocalCoords_AttribBindingsBit);
+ GrDrawEffect drawEffect(stages[s], explicitLocalCoords);
+ fEffectKeys[s] = factory.glEffectKey(drawEffect, gpu->glCaps());
}
}
@@ -85,8 +88,8 @@
fEdgeAttributeIndex = attributeIndex;
++attributeIndex;
}
- if (GrDrawState::AttributesBindExplicitTexCoords(fAttribBindings)) {
- fTexCoordAttributeIndex = attributeIndex;
+ if (fAttribBindings & GrDrawState::kLocalCoords_AttribBindingsBit) {
+ fLocalCoordsAttributeIndex = attributeIndex;
++attributeIndex;
}
}