Index: src/gpu/gl/builders/GrGLProgramBuilder.cpp |
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp |
index 8ea03fbba7ff50c0d475336793c6a0dca0f42aca..ab77e059389842145b8018eb95d60ec4e3e68a86 100644 |
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp |
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp |
@@ -9,7 +9,6 @@ |
#include "gl/GrGLProgram.h" |
#include "gl/GrGLSLPrettyPrint.h" |
#include "gl/GrGLUniformHandle.h" |
-#include "../GrGLXferProcessor.h" |
#include "../GrGpuGL.h" |
#include "GrCoordTransform.h" |
#include "GrGLLegacyNvprProgramBuilder.h" |
@@ -56,12 +55,20 @@ |
pb->emitAndInstallProcs(&inputColor, &inputCoverageVec4); |
+ // write the secondary color output if necessary |
+ if (GrProgramDesc::kNone_SecondaryOutputType != header.fSecondaryOutputType) { |
+ pb->fFS.enableSecondaryOutput(inputColor, inputCoverageVec4); |
+ } |
+ |
+ pb->fFS.combineColorAndCoverage(inputColor, inputCoverageVec4); |
+ |
return pb->finalize(); |
} |
-GrGLProgramBuilder* GrGLProgramBuilder::CreateProgramBuilder(const GrOptDrawState& optState, |
- bool hasGeometryProcessor, |
- GrGpuGL* gpu) { |
+GrGLProgramBuilder* |
+GrGLProgramBuilder::CreateProgramBuilder(const GrOptDrawState& optState, |
+ bool hasGeometryProcessor, |
+ GrGpuGL* gpu) { |
const GrProgramDesc& desc = optState.programDesc(); |
if (GrGLProgramDescBuilder::GetHeader(desc).fUseNvpr) { |
SkASSERT(gpu->glCaps().pathRenderingSupport()); |
@@ -88,7 +95,6 @@ |
, fOutOfStage(true) |
, fStageIndex(-1) |
, fGeometryProcessor(NULL) |
- , fXferProcessor(NULL) |
, fOptState(optState) |
, fDesc(optState.programDesc()) |
, fGpu(gpu) |
@@ -250,8 +256,6 @@ |
if (fOptState.hasGeometryProcessor()) { |
fVS.transformToNormalizedDeviceSpace(); |
} |
- |
- this->emitAndInstallXferProc(*fOptState.getXferProcessor(), *inputColor, *inputCoverage); |
} |
void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset, |
@@ -360,53 +364,8 @@ |
verify(gp); |
} |
-void GrGLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp, |
- const GrGLSLExpr4& colorIn, |
- const GrGLSLExpr4& coverageIn) { |
- // Program builders have a bit of state we need to clear with each effect |
- AutoStageAdvance adv(this); |
- |
- SkASSERT(!fXferProcessor); |
- fXferProcessor = SkNEW(GrGLInstalledXferProc); |
- |
- fXferProcessor->fGLProc.reset(xp.createGLInstance()); |
- |
- // Enable dual source secondary output if we have one |
- if (xp.hasSecondaryOutput()) { |
- fFS.enableSecondaryOutput(); |
- } |
- |
- // On any post 1.10 GLSL supporting GPU, we declare custom output |
- if (k110_GrGLSLGeneration != fFS.fProgramBuilder->gpu()->glslGeneration()) { |
- fFS.enableCustomOutput(); |
- } |
- |
- SkString openBrace; |
- openBrace.printf("{ // Xfer Processor: %s\n", xp.name()); |
- fFS.codeAppend(openBrace.c_str()); |
- |
- SkSTArray<4, GrGLProcessor::TextureSampler> samplers(xp.numTextures()); |
- this->emitSamplers(xp, &samplers, fXferProcessor); |
- |
- GrGLXferProcessor::EmitArgs args(this, xp, colorIn.c_str(), coverageIn.c_str(), |
- fFS.getPrimaryColorOutputName(), |
- fFS.getSecondaryColorOutputName(), samplers); |
- fXferProcessor->fGLProc->emitCode(args); |
- |
- // We have to check that effects and the code they emit are consistent, ie if an effect |
- // asks for dst color, then the emit code needs to follow suit |
- verify(xp); |
- fFS.codeAppend("}"); |
-} |
- |
void GrGLProgramBuilder::verify(const GrGeometryProcessor& gp) { |
SkASSERT(fFS.hasReadFragmentPosition() == gp.willReadFragmentPosition()); |
-} |
- |
-void GrGLProgramBuilder::verify(const GrXferProcessor& xp) { |
- // TODO: Once will readDst is only xp enable this assert and remove it from the |
- // FragmentProcessor verify() |
- //SkASSERT(fFS.hasReadDstColor() == xp.willReadDstColor()); |
} |
void GrGLProgramBuilder::verify(const GrFragmentProcessor& fp) { |
@@ -580,7 +539,7 @@ |
GrGLProgram* GrGLProgramBuilder::createProgram(GrGLuint programID) { |
return SkNEW_ARGS(GrGLProgram, (fGpu, fDesc, fUniformHandles, programID, fUniforms, |
- fGeometryProcessor, fXferProcessor, fFragmentProcessors.get())); |
+ fGeometryProcessor, fFragmentProcessors.get())); |
} |
/////////////////////////////////////////////////////////////////////////////////////////////////// |