diff options
author | joshualitt <joshualitt@chromium.org> | 2014-12-03 06:24:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-03 06:24:10 -0800 |
commit | 2dd1ae016d7f297b433c3ea3a771ef8e01657c1f (patch) | |
tree | 96aa03d4b4b1802490cb5b769627b75f3de4a470 /src/gpu/gl/builders | |
parent | 960fb50a1a7ac76fd51e22983812f26bfffa6d1e (diff) |
First step to moving vertex attributes to the geometryProcessor
BUG=skia:
Review URL: https://codereview.chromium.org/761563002
Diffstat (limited to 'src/gpu/gl/builders')
-rw-r--r-- | src/gpu/gl/builders/GrGLProgramBuilder.cpp | 159 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLProgramBuilder.h | 37 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp | 110 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLVertexShaderBuilder.h | 38 |
4 files changed, 153 insertions, 191 deletions
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index 16cc5d4964..64150a4fda 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -52,37 +52,15 @@ GrGLProgram* GrGLProgramBuilder::CreateProgram(const GrOptDrawState& optState, GrGLSLExpr1 inputCoverage; pb->setupUniformColorAndCoverageIfNeeded(&inputColor, &inputCoverage); - // if we have a vertex shader(we don't only if we are using NVPR or NVPR ES), then we may have - // to setup a few more things like builtin vertex attributes - bool hasVertexShader = !(header.fUseNvpr && - gpu->glPathRendering()->texturingMode() == - GrGLPathRendering::FixedFunction_TexturingMode); - - if (hasVertexShader) { - pb->fVS.setupUniformViewMatrix(); - pb->fVS.setupPositionAndLocalCoords(); - - if (header.fEmitsPointSize) { - pb->fVS.codeAppend("gl_PointSize = 1.0;"); - } - if (GrProgramDesc::kAttribute_ColorInput == header.fColorInput) { - pb->fVS.setupBuiltinVertexAttribute("Color", &inputColor); - } - if (GrProgramDesc::kAttribute_ColorInput == header.fCoverageInput) { - pb->fVS.setupBuiltinVertexAttribute("Coverage", &inputCoverage); - } - } - // TODO: Once all stages can handle taking a float or vec4 and correctly handling them we can // remove this cast to a vec4. - GrGLSLExpr4 inputCoverageVec4 = GrGLSLExpr4::VectorCast(inputCoverage); + GrGLSLExpr4 inputCoverageVec4; + if (inputCoverage.isValid()) { + inputCoverageVec4 = GrGLSLExpr4::VectorCast(inputCoverage); + } pb->emitAndInstallProcs(&inputColor, &inputCoverageVec4); - if (hasVertexShader) { - pb->fVS.transformToNormalizedDeviceSpace(); - } - // write the secondary color output if necessary if (GrProgramDesc::kNone_SecondaryOutputType != header.fSecondaryOutputType) { pb->fFS.enableSecondaryOutput(inputColor, inputCoverageVec4); @@ -145,6 +123,15 @@ void GrGLProgramBuilder::addVarying(const char* name, } } +void GrGLProgramBuilder::addPassThroughAttribute(const GrGeometryProcessor::GrAttribute* input, + const char* output) { + GrSLType type = GrVertexAttribTypeToSLType(input->fType); + GrGLVertToFrag v(type); + this->addVarying(input->fName, &v); + fVS.codeAppendf("%s = %s;", v.vsOut(), input->fName); + fFS.codeAppendf("%s = %s;", output, v.fsIn()); +} + void GrGLProgramBuilder::nameVariable(SkString* out, char prefix, const char* name) { if ('\0' == prefix) { *out = name; @@ -242,50 +229,84 @@ void GrGLProgramBuilder::setupUniformColorAndCoverageIfNeeded(GrGLSLExpr4* input } } -void GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, - GrGLSLExpr4* inputCoverage) { - fFragmentProcessors.reset(SkNEW(GrGLInstalledFragProcs)); - int numProcs = fOptState.numFragmentStages(); - this->emitAndInstallFragProcs(0, fOptState.numColorStages(), inputColor); +void GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr4* inputCoverage) { if (fOptState.hasGeometryProcessor()) { + fVS.setupUniformViewMatrix(); + + const GrProgramDesc::KeyHeader& header = this->header(); + if (header.fEmitsPointSize) { + fVS.codeAppend("gl_PointSize = 1.0;"); + } + + // Setup position + // TODO it'd be possible to remove these from the vertexshader builder and have them + // be outputs from the emit call. We don't do this because emitargs is constant. It would + // be easy to change this though + fVS.codeAppendf("vec3 %s;", fVS.glPosition()); + fVS.codeAppendf("vec2 %s;", fVS.positionCoords()); + fVS.codeAppendf("vec2 %s;", fVS.localCoords()); + const GrGeometryProcessor& gp = *fOptState.getGeometryProcessor(); fVS.emitAttributes(gp); - GrGLSLExpr4 output; - this->emitAndInstallProc<GrGeometryProcessor>(gp, 0, *inputCoverage, &output); - *inputCoverage = output; + GrGLSLExpr4 outputColor; + GrGLSLExpr4 outputCoverage; + this->emitAndInstallProc(gp, &outputColor, &outputCoverage); + + // We may override color and coverage here if we have unform color or coverage. This is + // obviously not ideal. + // TODO lets the GP itself do the override + if (GrProgramDesc::kAttribute_ColorInput == header.fColorInput) { + *inputColor = outputColor; + } + if (GrProgramDesc::kUniform_ColorInput != header.fCoverageInput) { + *inputCoverage = outputCoverage; + } } + + fFragmentProcessors.reset(SkNEW(GrGLInstalledFragProcs)); + int numProcs = fOptState.numFragmentStages(); + this->emitAndInstallFragProcs(0, fOptState.numColorStages(), inputColor); this->emitAndInstallFragProcs(fOptState.numColorStages(), numProcs, inputCoverage); + + if (fOptState.hasGeometryProcessor()) { + fVS.transformToNormalizedDeviceSpace(); + } } -void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOut) { +void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset, + int numProcs, + GrGLSLExpr4* inOut) { for (int e = procOffset; e < numProcs; ++e) { GrGLSLExpr4 output; const GrPendingFragmentStage& stage = fOptState.getFragmentStage(e); - this->emitAndInstallProc<GrPendingFragmentStage>(stage, e, *inOut, &output); + this->emitAndInstallProc(stage, e, *inOut, &output); *inOut = output; } } +void GrGLProgramBuilder::nameExpression(GrGLSLExpr4* output, const char* baseName) { + // create var to hold stage result. If we already have a valid output name, just use that + // otherwise create a new mangled one. This name is only valid if we are reordering stages + // and have to tell stage exactly where to put its output. + SkString outName; + if (output->isValid()) { + outName = output->c_str(); + } else { + this->nameVariable(&outName, '\0', baseName); + } + fFS.codeAppendf("vec4 %s;", outName.c_str()); + *output = outName; +} + // TODO Processors cannot output zeros because an empty string is all 1s // the fix is to allow effects to take the GrGLSLExpr4 directly -template <class Proc> -void GrGLProgramBuilder::emitAndInstallProc(const Proc& proc, +void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& proc, int index, const GrGLSLExpr4& input, GrGLSLExpr4* output) { // Program builders have a bit of state we need to clear with each effect AutoStageAdvance adv(this); - - // create var to hold stage result. If we already have a valid output name, just use that - // otherwise create a new mangled one. - SkString outColorName; - if (output->isValid()) { - outColorName = output->c_str(); - } else { - this->nameVariable(&outColorName, '\0', "output"); - } - fFS.codeAppendf("vec4 %s;", outColorName.c_str()); - *output = outColorName; + this->nameExpression(output, "output"); // Enclose custom code in a block to avoid namespace conflicts SkString openBrace; @@ -297,10 +318,28 @@ void GrGLProgramBuilder::emitAndInstallProc(const Proc& proc, fFS.codeAppend("}"); } +void GrGLProgramBuilder::emitAndInstallProc(const GrGeometryProcessor& proc, + GrGLSLExpr4* outputColor, + GrGLSLExpr4* outputCoverage) { + // Program builders have a bit of state we need to clear with each effect + AutoStageAdvance adv(this); + this->nameExpression(outputColor, "outputColor"); + this->nameExpression(outputCoverage, "outputCoverage"); + + // Enclose custom code in a block to avoid namespace conflicts + SkString openBrace; + openBrace.printf("{ // Stage %d, %s\n", fStageIndex, proc.name()); + fFS.codeAppend(openBrace.c_str()); + + this->emitAndInstallProc(proc, outputColor->c_str(), outputCoverage->c_str()); + + fFS.codeAppend("}"); +} + void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& fs, const char* outColor, const char* inColor) { - GrGLInstalledFragProc* ifp = SkNEW_ARGS(GrGLInstalledFragProc, (fVS.hasLocalCoords())); + GrGLInstalledFragProc* ifp = SkNEW(GrGLInstalledFragProc); const GrFragmentProcessor& fp = *fs.getProcessor(); ifp->fGLProc.reset(fp.getFactory().createGLInstance(fp)); @@ -321,8 +360,8 @@ void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& fs, } void GrGLProgramBuilder::emitAndInstallProc(const GrGeometryProcessor& gp, - const char* outCoverage, - const char* inCoverage) { + const char* outColor, + const char* outCoverage) { SkASSERT(!fGeometryProcessor); fGeometryProcessor = SkNEW(GrGLInstalledGeoProc); @@ -331,7 +370,7 @@ void GrGLProgramBuilder::emitAndInstallProc(const GrGeometryProcessor& gp, SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); this->emitSamplers(gp, &samplers, fGeometryProcessor); - GrGLGeometryProcessor::EmitArgs args(this, gp, outCoverage, inCoverage, samplers); + GrGLGeometryProcessor::EmitArgs args(this, gp, outColor, outCoverage, samplers); fGeometryProcessor->fGLProc->emitCode(args); // We have to check that effects and the code they emit are consistent, ie if an effect @@ -377,9 +416,10 @@ void GrGLProgramBuilder::emitTransforms(const GrPendingFragmentStage& stage, suffixedVaryingName.appendf("_%i", t); varyingName = suffixedVaryingName.c_str(); } - const char* coords = kPosition_GrCoordSet == processor->coordTransform(t).sourceCoords() ? - fVS.positionAttribute().c_str() : - fVS.localCoordsAttribute().c_str(); + + bool useLocalCoords = kLocal_GrCoordSet == processor->coordTransform(t).sourceCoords(); + const char* coords = useLocalCoords ? fVS.localCoords() : fVS.positionCoords(); + GrGLVertToFrag v(varyingType); this->addCoordVarying(varyingName, &v, uniName, coords); @@ -419,6 +459,7 @@ GrGLProgram* GrGLProgramBuilder::finalize() { this->cleanupProgram(programID, shadersToDelete); return NULL; } + if (!(GrGLProgramDescBuilder::GetHeader(fDesc).fUseNvpr && fGpu->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunction_TexturingMode)) { @@ -426,7 +467,11 @@ GrGLProgram* GrGLProgramBuilder::finalize() { this->cleanupProgram(programID, shadersToDelete); return NULL; } - fVS.bindVertexAttributes(programID); + + // Non fixed function NVPR actually requires a vertex shader to compile + if (fOptState.hasGeometryProcessor()) { + fVS.bindVertexAttributes(programID); + } } bool usingBindUniform = fGpu->glInterface()->fFunctions.fBindUniformLocation != NULL; if (usingBindUniform) { diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h index 7a4646d03f..76f7ae97c3 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.h +++ b/src/gpu/gl/builders/GrGLProgramBuilder.h @@ -126,10 +126,25 @@ struct GrGLGeoToFrag : public GrGLVarying { /* a specialization of the above for GPs. Lets the user add uniforms, varyings, and VS / FS code */ class GrGLGPBuilder : public virtual GrGLUniformBuilder { public: + /* + * addVarying allows fine grained control for setting up varyings between stages. If you just + * need to take an attribute and pass it through to an output value in a fragment shader, use + * addPassThroughAttribute. + * TODO convert most uses of addVarying to addPassThroughAttribute + */ virtual void addVarying(const char* name, GrGLVarying*, GrGLShaderVar::Precision fsPrecision=GrGLShaderVar::kDefault_Precision) = 0; + /* + * This call can be used by GP to pass an attribute through all shaders directly to 'output' in + * the fragment shader. Though this call effects both the vertex shader and fragment shader, + * it expects 'output' to be defined in the fragment shader before this call is made. + * TODO it might be nicer behavior to have a flag to declare output inside this call + */ + virtual void addPassThroughAttribute(const GrGeometryProcessor::GrAttribute*, + const char* output) = 0; + // TODO rename getFragmentBuilder virtual GrGLGPFragmentBuilder* getFragmentShaderBuilder() = 0; virtual GrGLVertexBuilder* getVertexShaderBuilder() = 0; @@ -205,6 +220,10 @@ public: GrGLVarying*, GrGLShaderVar::Precision fsPrecision=GrGLShaderVar::kDefault_Precision) SK_OVERRIDE; + virtual void addPassThroughAttribute(const GrGeometryProcessor::GrAttribute*, + const char* output) SK_OVERRIDE; + + // Handles for program uniforms (other than per-effect uniforms) struct BuiltinUniformHandles { UniformHandle fViewMatrixUni; @@ -242,22 +261,29 @@ protected: // generating stage code. void nameVariable(SkString* out, char prefix, const char* name); void setupUniformColorAndCoverageIfNeeded(GrGLSLExpr4* inputColor, GrGLSLExpr1* inputCoverage); + // Generates a possibly mangled name for a stage variable and writes it to the fragment shader. + // If GrGLSLExpr4 has a valid name then it will use that instead + void nameExpression(GrGLSLExpr4*, const char* baseName); void emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr4* inputCoverage); void emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOut); - template <class Proc> - void emitAndInstallProc(const Proc&, + void emitAndInstallProc(const GrPendingFragmentStage&, int index, const GrGLSLExpr4& input, GrGLSLExpr4* output); + void emitAndInstallProc(const GrGeometryProcessor&, + GrGLSLExpr4* outputColor, + GrGLSLExpr4* outputCoverage); + // these emit functions help to keep the createAndEmitProcessors template general void emitAndInstallProc(const GrPendingFragmentStage&, const char* outColor, const char* inColor); void emitAndInstallProc(const GrGeometryProcessor&, - const char* outCoverage, - const char* inCoverage); + const char* outColor, + const char* outCoverage); + void verify(const GrGeometryProcessor&); void verify(const GrFragmentProcessor&); void emitSamplers(const GrProcessor&, @@ -372,7 +398,7 @@ struct GrGLInstalledGeoProc : public GrGLInstalledProc { }; struct GrGLInstalledFragProc : public GrGLInstalledProc { - GrGLInstalledFragProc(bool useLocalCoords) : fGLProc(NULL), fLocalCoordAttrib(useLocalCoords) {} + GrGLInstalledFragProc() : fGLProc(NULL) {} class ShaderVarHandle { public: bool isValid() const { return fHandle > -1; } @@ -397,7 +423,6 @@ struct GrGLInstalledFragProc : public GrGLInstalledProc { SkAutoTDelete<GrGLFragmentProcessor> fGLProc; SkSTArray<2, Transform, true> fTransforms; - bool fLocalCoordAttrib; }; struct GrGLInstalledFragProcs : public SkRefCnt { diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp index 7af5ce9843..63cd352dd2 100644 --- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp +++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp @@ -13,15 +13,9 @@ #define GL_CALL(X) GR_GL_CALL(fProgramBuilder->gpu()->glInterface(), X) #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fProgramBuilder->gpu()->glInterface(), R, X) -static const char* color_attribute_name() { return "inColor"; } -static const char* coverage_attribute_name() { return "inCoverage"; } - GrGLVertexBuilder::GrGLVertexBuilder(GrGLProgramBuilder* program) : INHERITED(program) - , fPositionVar(NULL) - , fLocalCoordsVar(NULL) - , fRtAdjustName(NULL) - , fEffectAttribOffset(0) { + , fRtAdjustName(NULL) { } void GrGLVertexBuilder::addVarying(const char* name, GrGLVarying* v) { @@ -39,58 +33,13 @@ void GrGLVertexBuilder::setupUniformViewMatrix() { this->uViewM()); } -void GrGLVertexBuilder::setupPositionAndLocalCoords() { - // Setup position - this->codeAppendf("vec3 %s;", this->glPosition()); - - // setup position and local coords attribute - fPositionVar = &fInputs.push_back(); - fPositionVar->set(kVec2f_GrSLType, - GrGLShaderVar::kAttribute_TypeModifier, - this->inPosition()); - if (-1 != fProgramBuilder->header().fLocalCoordAttributeIndex) { - fLocalCoordsVar = &fInputs.push_back(); - fLocalCoordsVar->set(kVec2f_GrSLType, - GrGLShaderVar::kAttribute_TypeModifier, - "inLocalCoords"); - } else { - fLocalCoordsVar = fPositionVar; - } - fEffectAttribOffset = fInputs.count(); -} - -void GrGLVertexBuilder::setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr1* out) { - GrGLVertToFrag v(kFloat_GrSLType); - fProgramBuilder->addVarying(inName, &v); - SkString name(inName); - name.prepend("in"); - this->addAttribute(GrShaderVar(name.c_str(), - kFloat_GrSLType, - GrShaderVar::kAttribute_TypeModifier)); - this->codeAppendf("%s = %s;", v.vsOut(), name.c_str()); - *out = v.fsIn(); - fEffectAttribOffset++; -} - -void GrGLVertexBuilder::setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr4* out) { - GrGLVertToFrag v(kVec4f_GrSLType); - fProgramBuilder->addVarying(inName, &v); - SkString name(inName); - name.prepend("in"); - this->addAttribute(GrShaderVar(name.c_str(), - kVec4f_GrSLType, - GrShaderVar::kAttribute_TypeModifier)); - this->codeAppendf("%s = %s;", v.vsOut(), name.c_str()); - *out = v.fsIn(); - fEffectAttribOffset++; -} - void GrGLVertexBuilder::emitAttributes(const GrGeometryProcessor& gp) { - const GrGeometryProcessor::VertexAttribArray& vars = gp.getVertexAttribs(); - int numAttributes = vars.count(); - for (int a = 0; a < numAttributes; ++a) { - this->addAttribute(vars[a]); + const GrGeometryProcessor::VertexAttribArray& v = gp.getAttribs(); + int vaCount = v.count(); + for (int i = 0; i < vaCount; i++) { + this->addAttribute(&v[i]); } + return; } void GrGLVertexBuilder::transformToNormalizedDeviceSpace() { @@ -124,49 +73,14 @@ void GrGLVertexBuilder::transformToNormalizedDeviceSpace() { } void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { - // Bind the attrib locations to same values for all shaders - const GrProgramDesc::KeyHeader& header = fProgramBuilder->header(); - SkASSERT(-1 != header.fPositionAttributeIndex); - GL_CALL(BindAttribLocation(programID, - header.fPositionAttributeIndex, - fPositionVar->c_str())); - if (-1 != header.fLocalCoordAttributeIndex) { - GL_CALL(BindAttribLocation(programID, - header.fLocalCoordAttributeIndex, - fLocalCoordsVar->c_str())); - } - if (-1 != header.fColorAttributeIndex) { - GL_CALL(BindAttribLocation(programID, - header.fColorAttributeIndex, - color_attribute_name())); - } - if (-1 != header.fCoverageAttributeIndex) { - GL_CALL(BindAttribLocation(programID, - header.fCoverageAttributeIndex, - coverage_attribute_name())); - } - - const GrOptDrawState& optState = fProgramBuilder->optState(); - const GrVertexAttrib* vaPtr = optState.getVertexAttribs(); - const int vaCount = optState.getVertexAttribCount(); + const GrGeometryProcessor* gp = fProgramBuilder->fOptState.getGeometryProcessor(); - // We start binding attributes after builtins - int i = fEffectAttribOffset; - for (int index = 0; index < vaCount; index++) { - if (kGeometryProcessor_GrVertexAttribBinding != vaPtr[index].fBinding) { - continue; - } - SkASSERT(index != header.fPositionAttributeIndex && - index != header.fLocalCoordAttributeIndex && - index != header.fColorAttributeIndex && - index != header.fCoverageAttributeIndex); - // We should never find another effect attribute if we have bound everything - SkASSERT(i < fInputs.count()); - GL_CALL(BindAttribLocation(programID, index, fInputs[i].c_str())); - i++; + const GrGeometryProcessor::VertexAttribArray& v = gp->getAttribs(); + int vaCount = v.count(); + for (int i = 0; i < vaCount; i++) { + GL_CALL(BindAttribLocation(programID, i, v[i].fName)); } - // Make sure we bound everything - SkASSERT(fInputs.count() == i); + return; } bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.h b/src/gpu/gl/builders/GrGLVertexShaderBuilder.h index 7d6d95e508..dbff24fe83 100644 --- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.h +++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.h @@ -16,29 +16,20 @@ class GrGLVertexBuilder : public GrGLShaderBuilder { public: GrGLVertexBuilder(GrGLProgramBuilder* program); - /** - * Are explicit local coordinates provided as input to the vertex shader. - */ - bool hasLocalCoords() const { return (fLocalCoordsVar != fPositionVar); } - - /** Returns a vertex attribute that represents the local coords in the VS. This may be the same - as positionAttribute() or it may not be. It depends upon whether the rendering code - specified explicit local coords or not in the GrDrawState. */ - const GrGLShaderVar& localCoordsAttribute() const { return *fLocalCoordsVar; } - - /** Returns a vertex attribute that represents the vertex position in the VS. This is the - pre-matrix position and is commonly used by effects to compute texture coords via a matrix. - */ - const GrGLShaderVar& positionAttribute() const { return *fPositionVar; } - /** returns the expected position output */ const char* glPosition() const { return "pos3"; } + const char* positionCoords() const { return "position"; } + const char* localCoords() const { return "localCoords"; } /** returns the expected uviewM matrix */ // TODO all of this fixed function stuff can live on the GP/PP const char* uViewM() const { return "uViewM"; } - const char* inPosition() const { return "inPosition"; } + void addAttribute(const GrGeometryProcessor::GrAttribute* attr) { + this->addAttribute(GrShaderVar(attr->fName, + GrVertexAttribTypeToSLType(attr->fType), + GrShaderVar::kAttribute_TypeModifier)); + } private: /* @@ -52,27 +43,14 @@ private: void transformToNormalizedDeviceSpace(); //TODO GP itself should setup the uniform view matrix void setupUniformViewMatrix(); - void setupPositionAndLocalCoords(); - void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr1* out); - void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr4* out); void emitAttributes(const GrGeometryProcessor& gp); void bindVertexAttributes(GrGLuint programID); bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shaderIds) const; // an internal call which checks for uniquness of a var before adding it to the list of inputs bool addAttribute(const GrShaderVar& var); - struct AttributePair { - void set(int index, const SkString& name) { - fIndex = index; fName = name; - } - int fIndex; - SkString fName; - }; - GrGLShaderVar* fPositionVar; - GrGLShaderVar* fLocalCoordsVar; - const char* fRtAdjustName; - int fEffectAttribOffset; + const char* fRtAdjustName; friend class GrGLProgramBuilder; |