| Index: src/gpu/gl/GrGLShaderBuilder.cpp
|
| ===================================================================
|
| --- src/gpu/gl/GrGLShaderBuilder.cpp (revision 8241)
|
| +++ src/gpu/gl/GrGLShaderBuilder.cpp (working copy)
|
| @@ -8,6 +8,7 @@
|
| #include "gl/GrGLShaderBuilder.h"
|
| #include "gl/GrGLProgram.h"
|
| #include "gl/GrGLUniformHandle.h"
|
| +#include "GrDrawEffect.h"
|
| #include "GrTexture.h"
|
|
|
| // number of each input/output type in a single allocation block
|
| @@ -82,7 +83,8 @@
|
| //const int GrGLShaderBuilder::fCoordDims = 2;
|
|
|
| GrGLShaderBuilder::GrGLShaderBuilder(const GrGLContextInfo& ctxInfo,
|
| - GrGLUniformManager& uniformManager)
|
| + GrGLUniformManager& uniformManager,
|
| + bool explicitLocalCoords)
|
| : fUniforms(kVarsPerBlock)
|
| , fVSAttrs(kVarsPerBlock)
|
| , fVSOutputs(kVarsPerBlock)
|
| @@ -99,6 +101,14 @@
|
|
|
| fPositionVar = &fVSAttrs.push_back();
|
| fPositionVar->set(kVec2f_GrSLType, GrGLShaderVar::kAttribute_TypeModifier, "aPosition");
|
| + if (explicitLocalCoords) {
|
| + fLocalCoordsVar = &fVSAttrs.push_back();
|
| + fLocalCoordsVar->set(kVec2f_GrSLType,
|
| + GrGLShaderVar::kAttribute_TypeModifier,
|
| + "aLocalCoords");
|
| + } else {
|
| + fLocalCoordsVar = fPositionVar;
|
| + }
|
| }
|
|
|
| void GrGLShaderBuilder::codeAppendf(ShaderType type, const char format[], va_list args) {
|
| @@ -494,7 +504,6 @@
|
| GrGLEffect::EffectKey key,
|
| const char* fsInColor,
|
| const char* fsOutColor,
|
| - const char* vsInCoord,
|
| SkTArray<GrGLUniformManager::UniformHandle, true>* samplerHandles) {
|
| GrAssert(NULL != stage.getEffect());
|
|
|
| @@ -506,6 +515,7 @@
|
| textureSamplers[i].init(this, &effect->textureAccess(i), i);
|
| samplerHandles->push_back(textureSamplers[i].fSamplerUniform);
|
| }
|
| + GrDrawEffect drawEffect(stage, this->hasExplicitLocalCoords());
|
|
|
| int numAttributes = stage.getVertexAttribIndexCount();
|
| const int* attributeIndices = stage.getVertexAttribIndices();
|
| @@ -519,15 +529,15 @@
|
| }
|
| }
|
|
|
| - GrGLEffect* glEffect = effect->getFactory().createGLInstance(effect);
|
| + GrGLEffect* glEffect = effect->getFactory().createGLInstance(drawEffect);
|
|
|
| // Enclose custom code in a block to avoid namespace conflicts
|
| this->fVSCode.appendf("\t{ // %s\n", glEffect->name());
|
| this->fFSCode.appendf("\t{ // %s \n", glEffect->name());
|
| +
|
| glEffect->emitCode(this,
|
| - stage,
|
| + drawEffect,
|
| key,
|
| - vsInCoord,
|
| fsOutColor,
|
| fsInColor,
|
| textureSamplers);
|
|
|