aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLProgramDesc.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-30 19:55:49 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-30 19:55:49 +0000
commit234d4fba75aac009e34c088037fcd9e244798c40 (patch)
treeb2a103963d3e85c3aed67947bf10827b48744483 /src/gpu/gl/GrGLProgramDesc.cpp
parent3400f4b00aaf9159713d9a7bb0a4f828fd6899c3 (diff)
Mark when effects and programs have vertex code
Adds a 'hasVertexCode' method to GrEffect and a 'fHasVertexCode' field to GrGLProgramDesc::KeyHeader. Also adds a GrVertexEffect class that effects have to inherit from in order to set the 'hasVertexCode' flag and be able to emit vertex code, and updates the existing effects to use it as needed. R=bsalomon@google.com Author: cdalton@nvidia.com Review URL: https://codereview.chromium.org/23653059 git-svn-id: http://skia.googlecode.com/svn/trunk@11537 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl/GrGLProgramDesc.cpp')
-rw-r--r--src/gpu/gl/GrGLProgramDesc.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 91ac266093..8b731fbc2c 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -19,7 +19,8 @@ inline GrGLEffect::EffectKey get_key_and_update_stats(const GrEffectStage& stage
const GrGLCaps& caps,
bool useExplicitLocalCoords,
bool* setTrueIfReadsDst,
- bool* setTrueIfReadsPos) {
+ bool* setTrueIfReadsPos,
+ bool* setTrueIfHasVertexCode) {
const GrEffectRef& effect = *stage.getEffect();
const GrBackendEffectFactory& factory = effect->getFactory();
GrDrawEffect drawEffect(stage, useExplicitLocalCoords);
@@ -29,6 +30,9 @@ inline GrGLEffect::EffectKey get_key_and_update_stats(const GrEffectStage& stage
if (effect->willReadFragmentPosition()) {
*setTrueIfReadsPos = true;
}
+ if (effect->hasVertexCode()) {
+ *setTrueIfHasVertexCode = true;
+ }
return factory.glEffectKey(drawEffect, caps);
}
}
@@ -87,21 +91,25 @@ void GrGLProgramDesc::Build(const GrDrawState& drawState,
int currEffectKey = 0;
bool readsDst = false;
bool readFragPosition = false;
+ bool hasVertexCode = false;
if (!skipColor) {
for (int s = 0; s < drawState.numColorStages(); ++s) {
effectKeys[currEffectKey++] =
get_key_and_update_stats(drawState.getColorStage(s), gpu->glCaps(),
- requiresLocalCoordAttrib, &readsDst, &readFragPosition);
+ requiresLocalCoordAttrib, &readsDst, &readFragPosition,
+ &hasVertexCode);
}
}
if (!skipCoverage) {
for (int s = 0; s < drawState.numCoverageStages(); ++s) {
effectKeys[currEffectKey++] =
get_key_and_update_stats(drawState.getCoverageStage(s), gpu->glCaps(),
- requiresLocalCoordAttrib, &readsDst, &readFragPosition);
+ requiresLocalCoordAttrib, &readsDst, &readFragPosition,
+ &hasVertexCode);
}
}
+ header->fHasVertexCode = hasVertexCode || requiresLocalCoordAttrib;
header->fEmitsPointSize = isPoints;
header->fColorFilterXfermode = skipColor ? SkXfermode::kDst_Mode : drawState.getColorFilterMode();
@@ -122,6 +130,7 @@ void GrGLProgramDesc::Build(const GrDrawState& drawState,
header->fColorInput = kUniform_ColorInput;
} else {
header->fColorInput = kAttribute_ColorInput;
+ header->fHasVertexCode = true;
}
bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == drawState.getCoverage();
@@ -134,6 +143,7 @@ void GrGLProgramDesc::Build(const GrDrawState& drawState,
header->fCoverageInput = kUniform_ColorInput;
} else {
header->fCoverageInput = kAttribute_ColorInput;
+ header->fHasVertexCode = true;
}
if (readsDst) {