aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/builders
diff options
context:
space:
mode:
authorGravatar wangyix <wangyix@google.com>2015-08-04 07:59:37 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-04 07:59:37 -0700
commit4b3050b410254d0cb38df9a30ae2e209124fa1a2 (patch)
tree060bac88523db4058c11c364319ace7368749848 /src/gpu/gl/builders
parentc369348aa596d7be05c9ce0ca5d349e5d1903789 (diff)
Added registerChild; transforms, textures, glKey automatically handled.
Diffstat (limited to 'src/gpu/gl/builders')
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 9c0e7ab526..daa24800d2 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -179,6 +179,18 @@ const GrGLContextInfo& GrGLProgramBuilder::ctxInfo() const {
return fGpu->ctxInfo();
}
+static void append_gr_fp_coord_transforms(const GrFragmentProcessor* processor,
+ SkTArray<const GrCoordTransform*, true>* procCoords) {
+ // add the coord transforms of this processor
+ for (int i = 0; i < processor->numTransforms(); ++i) {
+ procCoords->push_back(&processor->coordTransform(i));
+ }
+ // recursively add the coord transforms of this processor's child processors
+ for (int i = 0; i < processor->numChildProcessors(); ++i) {
+ append_gr_fp_coord_transforms(processor->childProcessor(i), procCoords);
+ }
+}
+
bool GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr4* inputCoverage) {
// First we loop over all of the installed processors and collect coord transforms. These will
// be sent to the GrGLPrimitiveProcessor in its emitCode function
@@ -189,11 +201,10 @@ bool GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr
for (int i = 0; i < this->pipeline().numFragmentStages(); i++) {
const GrFragmentProcessor* processor = this->pipeline().getFragmentStage(i).processor();
SkSTArray<2, const GrCoordTransform*, true>& procCoords = fCoordTransforms.push_back();
- for (int t = 0; t < processor->numTransforms(); t++) {
- procCoords.push_back(&processor->coordTransform(t));
- }
- totalTextures += processor->numTextures();
+ append_gr_fp_coord_transforms(processor, &procCoords);
+
+ totalTextures += processor->numTexturesIncludeChildProcs();
if (totalTextures >= maxTextureUnits) {
GrCapsDebugf(fGpu->caps(), "Program would use too many texture units\n");
return false;
@@ -284,7 +295,7 @@ void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& fs,
const GrFragmentProcessor& fp = *fs.processor();
ifp->fGLProc.reset(fp.createGLInstance());
- SkSTArray<4, GrGLProcessor::TextureSampler> samplers(fp.numTextures());
+ SkSTArray<4, GrGLProcessor::TextureSampler> samplers(fp.numTexturesIncludeChildProcs());
this->emitSamplers(fp, &samplers, ifp);
GrGLFragmentProcessor::EmitArgs args(this, fp, outColor, inColor, fOutCoords[index], samplers);