Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Unified Diff: src/gpu/gl/builders/GrGLProgramBuilder.cpp

Issue 1306803003: Revert of Remove GrStagedProcessor, remove the word Stage as it applies to FPs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/builders/GrGLProgramBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 547bd381d8c7e59763108c66f5909eb2370971f2..2db568693d8a678002866e1560692facb343a76e 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -186,15 +186,15 @@
int totalTextures = primProc.numTextures();
const int maxTextureUnits = fGpu->glCaps().maxFragmentTextureUnits();
- for (int i = 0; i < this->pipeline().numFragmentProcessors(); i++) {
- const GrFragmentProcessor& processor = this->pipeline().getFragmentProcessor(i);
+ for (int i = 0; i < this->pipeline().numFragmentStages(); i++) {
+ const GrFragmentProcessor* processor = this->pipeline().getFragmentStage(i).processor();
if (!primProc.hasTransformedLocalCoords()) {
- SkTArray<const GrCoordTransform*, true>& procCoords = fCoordTransforms.push_back();
- processor.gatherCoordTransforms(&procCoords);
- }
-
- totalTextures += processor.numTextures();
+ SkSTArray<2, const GrCoordTransform*, true>& procCoords = fCoordTransforms.push_back();
+ processor->gatherCoordTransforms(&procCoords);
+ }
+
+ totalTextures += processor->numTextures();
if (totalTextures >= maxTextureUnits) {
GrCapsDebugf(fGpu->caps(), "Program would use too many texture units\n");
return false;
@@ -204,9 +204,9 @@
this->emitAndInstallProc(primProc, inputColor, inputCoverage);
fFragmentProcessors.reset(SkNEW(GrGLInstalledFragProcs));
- int numProcs = this->pipeline().numFragmentProcessors();
- this->emitAndInstallFragProcs(0, this->pipeline().numColorFragmentProcessors(), inputColor);
- this->emitAndInstallFragProcs(this->pipeline().numColorFragmentProcessors(), numProcs,
+ int numProcs = this->pipeline().numFragmentStages();
+ this->emitAndInstallFragProcs(0, this->pipeline().numColorFragmentStages(), inputColor);
+ this->emitAndInstallFragProcs(this->pipeline().numColorFragmentStages(), numProcs,
inputCoverage);
this->emitAndInstallXferProc(*this->pipeline().getXferProcessor(), *inputColor, *inputCoverage);
return true;
@@ -215,10 +215,10 @@
void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset,
int numProcs,
GrGLSLExpr4* inOut) {
- for (int i = procOffset; i < numProcs; ++i) {
+ for (int e = procOffset; e < numProcs; ++e) {
GrGLSLExpr4 output;
- const GrFragmentProcessor& fp = this->pipeline().getFragmentProcessor(i);
- this->emitAndInstallProc(fp, i, *inOut, &output);
+ const GrPendingFragmentStage& stage = this->pipeline().getFragmentStage(e);
+ this->emitAndInstallProc(stage, e, *inOut, &output);
*inOut = output;
}
}
@@ -239,7 +239,7 @@
// TODO Processors cannot output zeros because an empty string is all 1s
// the fix is to allow effects to take the GrGLSLExpr4 directly
-void GrGLProgramBuilder::emitAndInstallProc(const GrFragmentProcessor& fp,
+void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& proc,
int index,
const GrGLSLExpr4& input,
GrGLSLExpr4* output) {
@@ -249,10 +249,10 @@
// Enclose custom code in a block to avoid namespace conflicts
SkString openBrace;
- openBrace.printf("{ // Stage %d, %s\n", fStageIndex, fp.name());
+ openBrace.printf("{ // Stage %d, %s\n", fStageIndex, proc.name());
fFS.codeAppend(openBrace.c_str());
- this->emitAndInstallProc(fp, index, output->c_str(), input.isOnes() ? NULL : input.c_str());
+ this->emitAndInstallProc(proc, index, output->c_str(), input.isOnes() ? NULL : input.c_str());
fFS.codeAppend("}");
}
@@ -276,12 +276,13 @@
fFS.codeAppend("}");
}
-void GrGLProgramBuilder::emitAndInstallProc(const GrFragmentProcessor& fp,
+void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& fs,
int index,
const char* outColor,
const char* inColor) {
GrGLInstalledFragProc* ifp = SkNEW(GrGLInstalledFragProc);
+ const GrFragmentProcessor& fp = *fs.processor();
ifp->fGLProc.reset(fp.createGLInstance());
SkSTArray<4, GrGLProcessor::TextureSampler> samplers(fp.numTextures());
@@ -500,7 +501,7 @@
GrGLInstalledFragProcs::~GrGLInstalledFragProcs() {
int numProcs = fProcs.count();
- for (int i = 0; i < numProcs; ++i) {
- SkDELETE(fProcs[i]);
- }
-}
+ for (int e = 0; e < numProcs; ++e) {
+ SkDELETE(fProcs[e]);
+ }
+}
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698